I'm trying to use TFT display with ILI9341 8080 16 bit interface with STM32F407 via FSMC. I'm using HAL. To explain a bit more, for ILI9341 command registers only lower 8 bits of the bus are used, full 16 bit bus width is only used for transfer of image data (in RGB 565 format). I tested the program before with identical display configured with 8080 8 bit interface and it worked flawlessly.
I have image data in MCU memory in uint16_t
format and use
HAL_SRAM_Write_16b
for transfer of image data and
HAL_SRAM_Write_8b
for transfer of commands and command parameters.
Now, when I select
hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_8;
everything works fine, only image data (colours and resolution) are wrong of course, because ILI9341 has only lower 8 bits of data (blue and half of the green bits) and upper 8 bits are zero. As soon, as I select
hsram1.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16;
display shows black and grey stripes for a second and then just goes white – error state.
I use A16 for command / data selection, therefore address of command memory is 0x60000000
and data memory 0x60010000
, hopefully same for 8 bit and 16 bit bus width?
Question: Can anybody explain to me, how data transfer in FSMC_NORSRAM_MEM_BUS_WIDTH_16
mode works, more precisely when I use HAL_SRAM_Write_16b
(or HAL_SRAM_Write_8b
) in this mode, if the data are sent one 16 bit (or 8 bit aligned to lsb) word per time frame, or if the MCU somehow distorts / combines them.