Jump to content

cpu20

Members
  • Posts

    130
  • Joined

  • Last visited

Posts posted by cpu20

  1. @Joe Stepien : Maybe it's a good idea to start a new project to first get µGFX compiling correctly using the single file inclusion mechanism.

    Here is what I did to get µGFX working in IAR embedded workbench:

    - First start with a clean project and include µGFX in the Preprocessor include directories. For this right click on your project, click on options -> C/C++ Compiler -> Preprocessor
    - Do this for Assembler also

    Step1.png.bcd89a091e88d318cb38fb00d9fd6723.pngStep2.png.0dd686e220319c3c24da8182a2e07318.png

    - Next you'll need a gfxconf.h file. I made a directory Inc and placed the template found in "uGFX/gfxconf.example.h" into the directory. For this example I only enabled GFX_USE_OS_RAW32 and nothing else just for basic compilation.
    - Repeat above steps to include the folder where you saved your "gfxconf.h" in the C/C++ Compiler and the Assembler tab

    Step3.png.752f28b6c2943506492ac2a0654acab3.png

    - Now add the "gfx_mk.c" to your project. IAR automatically includes it to build.

    End.thumb.png.013b8111428dc06e10e3922b5fbf526b.png

    Compilation should now be successful. Now you can edit the "gfxconf.h" to include all the modules you want.

    Let us know if you have any other problems compiling! (Please attach the full compiler output so we can see what exactly is going wrong while compiling)

     

  2. So I have been playing around with the µGFX and ChibiOS configurations in a clean new project to see what happens.
    What I found is that when setting CH_CFG_MEMCORE_SIZE to something like 4096 so that ChibiOS does not manage all of the RAM gfile works as expected. But when setting this to 0 (manage all RAM) things get very very weird.

    I don't think I can really describe what is happening as it seems partially random. It does open a file and read from it, but the file read from is almost never the one given to the gfileOpen function. You should really test it out for yourself. Just make three files on an SD-card, and read from them one by one, closing the previous one before opening the other.

    Could it be that when ChibiOS manages all of the RAM, it also manages the SDRAM but doesn't know the LTDC is using that?

  3. Something goes wrong when allocating memory for the file object I think. It allocates memory from the heap, but I already experienced problems when chibios creates threads using memory from heap. The threads start acting very weird.
    I have no idea what could be wrong with this. I'll look into it further tomorrow.

  4. 22 minutes ago, Mad River said:

     I did not understand "do not select the src map!"

    Well if you accidentally select the "src" map when excluding files with the filter it could be that Eclipse excludes your "gfx_mk.c" file again. But looking at your included screenshot everything went well.

    2 minutes ago, Mad River said:

    But, in addition for your steps, I need to remove "gfx.h" from the filter list. Is it ok?

    I can't explain why this would make any difference. Normally the "gfx.h" file is already included by including the uGFX folder in your include paths. You can keep it removed from the filter list as it should not be a problem.

  5. Alright so I started from scratch in Eclipse and just build a project with the single file inclusion system:

    First go to the paths and symbols and add the root uGFX directory to the include paths in all the languages. (for me this was assembly, GNU, GNU C++)

    2017-05-12-195000_1600x900_scrot.thumb.png.c1b32c5d1e786efbafa7dd5e98ef4087.png

    Here you can also include the directory holding the driver files for your specific display. To this again for all languages.

    Now you need to exclude all sources except the gfx_mk.c:

    2017-05-12-193101_1600x900_scrot.thumb.png.1980b116e3087c58cab3116d94514c53.png

    Do this by clicking on edit filter -> add multiple. Now select everything except the gfx_mk.c and do not select the src map!
    To include your drivers later on you have to delete the "drivers" line out of the filter lines. Then add multiple again and select everything in the driver folder except for your driver file.

    2017-05-12-195000_1600x900_scrot.thumb.png.bf77f7fb0a6c6b744f677cd6c71f6eaf.png

    Copy a fresh gfxconf.h in your include directory and it should compile. At least it does for me.

  6. To add source files/folders to your project, you first go to the properties of your project. Then go to C/C++ General -> Paths and Symbols -> Source location.

    Screenshot_20170512_183826.png

    Here you can add the ugfx folder and use a filter (Edit filter) to only include the gfx_mk.c to the sources of your project.

  7. I have used gfile and fatfs together with the STM32 HAL libraries and everything worked fine.
    But now I am trying to use gfile and fatfs together with chibios and strange things happen.

    First the filesystem mounts correctly and gfile can open a file from the filesystem and read from it. But when closing the file and opening another file, things start to get weird. The gfileOpen function just returns the same GFILE it also gave back when opening the first file instead of the GFILE for the new file.

    File1 = gfileOpen("/File1", "r"); // Opens file and reads from it correctly
    gfileRead(File1, &Buf, 4);
    gfileClose(File1);
    File2 = gfileOpen("/File2", "r"); // The returned GFILE is the same as the
    gfileRead(File2, &Buf, 4);		  // File1
    gfileClose(File2);

    So in this example the first file will be opened, read from and closed again. Now when the second file is opened, the GFILE returned by gfileOpen is exactly the same as the one that was returned for File1. So the same file is read again.

    Now here is where it starts to get really confusing:

    File1 = gfileOpen("File1", "r"); // File1 and File2 are opened
    File2 = gfileOpen("File2", "r"); // and read from correctly
    gfileRead(File1, &Buf, 4);
    gfileRead(File2, &Buf, 4);
    gfileClose(File1); // Opening files after this will return
    gfileClose(File2); // the File1 GFILE...

    When doing this it opens the two separate files, reads from them and closes them.
    And now when trying to open another file after these two have been closed, the same GFILE will be returned as the one that was returned for File1.

    Any ideas on what I could be doing wrong? Or what could be going wrong? I am using the STM32F746-disco again for this.
    As opening and reading the first file works I doubt that it has something to do with the SDMMC1 configuration.

  8. If the IDE is eclipse based you should be able to make a "makefile" project.
    You just choose new -> C/C++ -> Makefile project with existing code.

    Import your own code into the project and also a template makefile (or a filled in makefile if you already made one).
    When building your project now it will use your own included makefile to build the project.

  9. That is a nice development board! Maybe I'll be buying it in the future to debug on it. But for now I don't have anything I need from Farnell.

    I read the forum thread about the board, but I could not find any files that were created already. Could you send them to me? I'll try to look into it and see what I can do.

  10. Big morning today because it's fixed!!!

    In the end there were two problems related to the GPIO why the whole thing did not work. The pins PG8: FMC_SDCLK and PI12: LCD_DISP_PIN were configured incorrectly thus making the whole thing not work. First the DISP pin was the reason the display stayed white. After fixing that it turned black and the LTDC initialized correctly.

    Second thing was that the framebuffer did not work. This was due to the fact that the FMC_SDCLK pin was not initialized at all. Maybe this should be reported back to the Chibios people as this initialization sequence is done somewhere in there code?

    After all it was worth the search and the effort :D

    You can find the fixed code on my GitHub page if you want to pull it.

  11. @steved Thanks for the suggestion!
    I tried it out but for the moment it still gives me the same result. (black screen)

    What I have noticed, is that when initiliazing the LTDC peripheral when using Chibios the frame buffer address (register CFBAR) is set to 0.
    When using the raw32 project this address is set to 33792(for the background layer). Is there anyone who can tell me where and how the uGFX library determines the framebuffer address?

  12. Yeah I think ST is not a great example of good practices.

    In the meantime I've forked the uGFX repository and made some changes regarding the incompatibility: https://github.com/cpu20/uGFX-Chibios-STM32F7
    I changed the STM32LTDC code to initialize the pins with the Chibios PAL. After some extended testing I'm quite certain the pins are now configured correctly looking at the GPIO registers. Also setting the DISP pin makes the screen go black (when LTDC is initialized) and got white when the DISP pin is cleared.
    Playing with alot of different clock configurations did not change anything, which makes me think that the problem is not clock related?
    The only thing I can think of that could be a problem is the FLASH/ART-accelerator... I can not find any Chibios code that initializes the I/D-cache on the STM32F7 while when using raw32 they are enabled. Could this form a problem?

    As of now I don't really know what to look for. If any ideas let me know and I'll check it out!

  13. Alright, to continue on this topic, I have been looking at te RCC registers and there are some things I don't understand.
    In the file stm32f746g_raw32_ugfx.c in the comment is stated that the HSE clock is divided by 25 to get a 1MHz clock to send to the other PLL clocks. But in reality it is divided by 12. Also in board_STM32LTDC.c the value of 1MHz is used to calculate a 9.6MHz clock for the LCD. But due to the division of 12 a LCD clock of 20MHz is achieved. I have no idea why this even works because in the LCD datasheet it states that 12MHz is the maximum. Any idea why this was done?

    I have tried in chibios to set the LCD clock to different values including 9.6MHz and 20MHz but nothing works.
    Any input on the clock is welcome!

    I'll keep searching!

  14. @Joel Bodenmann: To continue on the incompatibility topic of these two components, I have been trying to compile the latest ugfx and chibios taken from the respective git page together. I made a new makefile for it based on the chibios_3 one. As many things have changed in the repo's it doesn't work out of the box. Now I get this compiler error:

    ../../ChibiOS/os/common/ports/ARMCMx/compilers/GCC/chcoreasm_v7m.S:37:23: fatal error: chlicense.h: File or folder does not exist

    The only problem is the file is included in my INCPATH and when including it in my .c files it works. But for some reason it does not work for the assembler file.
    Do I need to separately include it for the assembler files?

    Edit: In case someone is interested in the makefile it's included here

    os_chibios_git.mk

  15. Setting the GDISP_STARTUP_COLOR didn't change anything. Drawing also still doesn't work.

    Something I noticed is that when using the raw32 project, before executing the gdisp_lld_init function it enters a mutex. When using chibios this isn't implemented. Could this cause any trouble?

  16. Hello,

    I have read multiple threads about the problems with the stm32f7-disco and chibios.

    Now I am trying to do some basic debugging to see where I can help. First of all I tried rewriting the board_STM32LTDC.h file to initialize the pins with the PAL functions from chibios.

    But when I debug the program now the pins are initialized, and the LCD is turned on (white screen). But after that the gfxInit routine initializes the LTDC controller. From the moment the LTDCEN bit goes high the display goes off (blank screen no backlight) and doesn't want to turn on again.

    Any idea what could be the cause of this? I have no idea...

    Thanks for all your hard work with this library btw!
     

×
×
  • Create New...