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


for transfer of image data and


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.

  • 1
    \$\begingroup\$ How are the IM pins (to select the interface mode) configured on your display? There are 8 different parallel bus options between 8/9/16/18-bits and either mode I or mode II for all of them. \$\endgroup\$ – brhans Jun 28 '17 at 11:16
  • \$\begingroup\$ @brhans I'm using ER-TFTM024-3 display on pre-made PCB from buydisplay.com on which IM pins should be already connected. According to datasheet it should be 8080 16-bit mode I. \$\endgroup\$ – wildfireheart Jun 28 '17 at 11:50

Turns out that address bits differ between 8-bit and 16-bit addressing mode. In 8-bit addressing it's mapped to bits [0-23] and in 16-bit to [1-24], so if you want to use A16 pin as CMD / DATA selection, the address of DATA transfer is 0x60010000 in 8-bit mode and 0x60020000 in 16-bit.

Source: STM32F4 Reference Manual: 36.4.1 NOR/PSRAM address mapping


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.