2025-01-30 05:45 AM - edited 2025-01-30 06:23 AM
Hello,
Apologies if this is posted in the wrong location. I am trying to control an LCD (ST7789) with my STM32U5G9J-DK2 using FMC. In CubeMX, I configured the NOR Flash/PSRAM/SRAM/ROM/LCD 1 to use NE1 and A0 with 16 bits of data. I also ensured to configure the NOR/PSRAM timing according to the ST7789 datasheet.
To my limited understanding of FMC, I believe that writing to the memory bank I have FMC set up at will cause the STM to automatically handle my control signals (FMC_A0, FMC_NE1, FMC_NWE, FMC_NOE, and data). Because I am using NE1 and A0, I have my memory locations defined as:
#define FMC_BANK1_REG ((uint32_t *)0x60000000)
#define FMC_BANK1_DATA ((uint32_t *)0x60000002)
And I am using the functions below to read and write:
void write_command(uint8_t data)
{
*FMC_BANK1_REG = (uint32_t)data;
}
void write_data(uint8_t data)
{
*FMC_BANK1_DATA = (uint32_t)data;
}
uint16_t read_data() {
return *FMC_BANK1_DATA;
}
// Example
write_command(0xFF);
write_data(0xFF);
HAL_Delay(1000);
uint16_t d = read_data();
I am using the CubeMX generated code for initialization. After initialization, I try to write some data, and I then try to read it back. However, the data is always 0 for some reason. Why is this?
2025-01-30 10:54 AM
Hello @user20324-245 ,
Check the timing parameters in CubeMX and ensure they match the requirements of the ST7789 datasheet. Incorrect timing settings can lead to improper communication with the LCD.