REPOST: TouchGFX port for STM32F4xx (using 8080 I/F II Mode communication)
QUESTION - TouchGFX Community repost - Stefan Lindegger - Nov 08 2016
We intended to use the STMF429I-DISCOVERY Board as an electronics base for a proto (TouchGFX is already ported to this board).
We don’t want to use the (poor) TFT display of the board. We intend to use another TFT Display with the same controller (ILI 9341).
There’s one problem / challenge with the TFT we want to use. It cannot be connected via RGB Interface.
The TFT module can only be configured to communicate in 8080 I/F II Mode (CPU 16-bit I/F II or CPU 8-bit I/F II or CPU 18-bit I/F II or CPU 9-bit I/F II).
- Is there a hardware layer port available which runs an STM32F429 (or similar) using the 8080 interface ?
- If not: Can I port the hardware layer by myself (with a relatively low effort)?
Thanks for any response.
ANSWER - TouchGFX Community repost - Soren Pingel Dalsgaard - Nov 08 2016
Hi Stefan,
We do not have an 8080 implementation I'm afraid. I think you'll be able to get something running relatively quickly though. TouchGFX calls a hook function whenever something in the frame buffer changes, and you'll need to implement this so it transfers the updated region to the display using 8080. This is explained in more detail in this knowledge base article: https://touchgfx.zendesk.com/hc/en-us/articles/203642951-MCUs-without-TFT-controller
You can also check out this forum post: https://touchgfx.zendesk.com/hc/communities/public/questions/201481402-Porting-TouchGFX-to-8080-based-LCDs
Maybe John has some additional tips he can share.
ANSWER - TouchGFX Community repost - Stefan Lindegger - Nov 08 2016
Hi Søren
Thank's for your answer. I think with the descriptions in your linked articles, I should be able to port the HAL to 8080 interface.
Thanks a lot.
BR
Stefan
ANSWER - TouchGFX Community repost - Soren Pingel Dalsgaard - Nov 08 2016
You are welcome. I would also point out the hardware selection guide article (https://touchgfx.zendesk.com/hc/en-us/articles/203563602-Hardware-selection-guide) which might contain useful information if/when you are doing a custom board at some point.
ANSWER - TouchGFX Community repost - John Leung - Nov 08 2016
Stefan
Surely I could share the code for 8080 with FMC interface in this forum but it is sad to say, I am running into difficulty too!
I am using a bridge chip with 8080 interface which is similar to ILI9341 I believe, as long as they are both 8080. The pinout is summarized below:
//Pinout summary for FMC interfacing SSD2805 in 8080 16-bit IF
/** FMC GPIO Configuration
PF0 ------> FMC_A0 (DC)
PE7 ------> FMC_D4
PE8 ------> FMC_D5
PE9 ------> FMC_D6
PE10 ------> FMC_D7
PE11 ------> FMC_D8
PE12 ------> FMC_D9
PE13 ------> FMC_D10
PE14 ------> FMC_D11
PE15 ------> FMC_D12
PD8 ------> FMC_D13
PD9 ------> FMC_D14
PD10 ------> FMC_D15
PD14 ------> FMC_D0
PD15 ------> FMC_D1
PD0 ------> FMC_D2
PD1 ------> FMC_D3
PD4 ------> FMC_NOE (RD#)
PD5 ------> FMC_NWE (WR#)
PG9 ------> FMC_NE2 (CS#)
*/
The code works alone, in the sense tht this LCD interface works when no SDRAM got initialized.
Data read/write uses memory mapped IO as follows:
#define LCD_BANK_ADDR ((uint32_t)0x64000000) //bank2 address for FSMC SRAM
#define LCD_DC_CMD ((uint32_t)0x00) //DC line (FMC_A0(PF0)) for 8080-mode LCD
#define LCD_DC_DATA ((uint32_t)0x02)
#define writeData(ui16Data) (__IO uint16_t) (LCD_BANK_ADDR + LCD_DC_DATA) = ui16Data
#define writeCmd(ui16Cmd) (__IO uint16_t) (LCD_BANK_ADDR + LCD_DC_CMD) = ui16Cmd
The problem is that, this 8080-based using FMC interface to STM32F429. Whenever SDRAM got initialized, LCD is not working and vice versa.
How to make FMC for SDRAM and SRAM co-exist? This is the question.
Anyone has experience on this? Look forward to any suggestion.
John
ANSWER - TouchGFX Community repost - John Leung - Nov 08 2016
One more comment on this. From various application notes I do notice this statement regarding FSMC: "FSMC performs only one access at a time to an external device".
So, to make LCD in 8080 interface (SRAM interface) co-exists with SDRAM onboard of stm32f429-disco, does it mean we need to build a cache in internal memory of the MCU? Any DMA to copy directly data from SDRAM to SRAM of 8080-LCD?
ANSWER - TouchGFX Community repost - Soren Pingel Dalsgaard - Nov 08 2016
Hi John,
I have never tried using both SRAM and SDRAM simultaneously but I would be surprised if that did not work. I am basing this on that NOR+SDRAM certainly works, and NOR is the same principle as SRAM (static memory). Along the same lines I would guess that the "only one access at a time" statement simply means that a second access is delayed until first access completes. We certainly do not need a cache with simultaneous NOR+SDRAM.
There is an errata for MCU revisions Y and 1 of the STM32F429 which does not allow simulatenous static and dynamic memories. This was fixed in rev. 3. This could explain it, try checking your MCU rev.
Apart from that try posting on the ST forums. And keep us updated on this issue =)
ANSWER - TouchGFX Community repost - John Leung - Nov 08 2016
Soren
It seems the problem last time was due to some stupid mistake with RCC setup. Making a good progress as I can initialize both SDRAM and LCD as SRAM now. A further question regarding framebuffer data read/write.
Looking at the file stm32f429i_discovery_sdram.c and find this function:
SDRAM_ReadBuffer(uint32_t * pBuffer, uint32_t uwReadAddress, uint32_t uwBufferSize).
Is it the function used by TouchGFX or there is another one packed inside touchgfx_core.lib?
As far as I know TouchGFX uses up to16-bit color, that is half of the pBuffer data pointer width. Should I pack two pixels into one 32-bit data or simply ignore the higher 16-bit ?
John
