cancel
Showing results for 
Search instead for 
Did you mean: 

FMC and Code Generation Issue

JKhal
Associate III

Hi,

I am developing an application running on STM32F469 MCU to control an LCD

Generating my Code using STM32CubeMX.

Using FMC Memry type is LCD_Interface, A23 Data: 16 bits

The bug I found is in the STemwin_wrapper.c file, in functions : FMC_BANK_WriteData and FMC_BANK_ReadData.

the bug is that the code generated tries to write and read the data from  FMC_BANK->RAM and that address is 0x60000002 where it have to be 0x61000000

typedef struct
 
{
 __IO uint16_t REG;
 __IO uint16_t RAM;
 
}LCD_CONTROLLER_TypeDef;
 
/* The Bank address need to be entred by the USER */
#define FMC_BANK_BASE ((uint32_t)    0x60000000 )
#define FMC_BANK    ((LCD_CONTROLLER_TypeDef *) FMC_BANK_BASE)
 
/**
  * @brief  Writes register value.
  * @param  Data: 
  * @retval None
  */
static void FMC_BANK_WriteData(uint16_t Data) 
{
  /* Write 16-bit Reg */
  *(uint16_t*)0x61000000 = Data; // FMC_BANK->RAM = Data;
}
 
/**
  * @brief  Writes register address.
  * @param  Reg: 
  * @retval None
  */
static void FMC_BANK_WriteReg(uint8_t Reg) 
{
  /* Write 16-bit Index, then write register */
  FMC_BANK->REG = Reg;
}
 
/**
  * @brief  Reads register value.
  * @param  None
  * @retval Read value
  */
static uint16_t FMC_BANK_ReadData(void) 
{
  return *(uint16_t*)0x61000000 ; // return FMC_BANK->RAM;
}
 
 

the issue is that every time I regenerate the code using STM32CubeMX the bug returns and have to fix it again.

is there a way to avoid this bug regenerating or better to fix it from the beginning?

1 REPLY 1

Hello @Community member​ 

Could you please share your .ioc to check the issue .

Best regards,

Nesrine