2024-04-15 04:01 AM - last edited on 2024-04-15 04:13 AM by SofLit
Dear ST Community,
I need to use an SRAM with the STM32H743AII6 MCU. When I try to configure the project on CubeMX, a warning appears next to the FMC line. I feel like I should fix this before going further with the configuration.
I am curious why I am getting this warning even when FMC is the only peripheral that was already configured. Has anybody experienced this before? Are there any suggestions to resolve this?
Here is a summary as background information:
Thanks,
JD
Solved! Go to Solution.
2024-04-15 05:33 AM
see my configuration I have the same chip connected to IS42S16400J-7TL (SDRAM 64 Mbit )
all is working fine
2024-04-15 04:14 AM
Hello,
What message is showing when you pass the mouse cursor on the warning icon?
2024-04-15 04:36 AM
Hi SofLit,
Here is the message:
Best,
JD
2024-04-15 05:01 AM - edited 2024-04-15 06:13 AM
Hello,
I think you can go ahead and ignore that warning.
If you notice any missing in the FMC config in the generated code, you can notify us.
2024-04-15 05:33 AM
see my configuration I have the same chip connected to IS42S16400J-7TL (SDRAM 64 Mbit )
all is working fine
2024-04-16 03:44 AM
Dear MNapi and SofLit,
Thank you for your answers, you've been so helpful. I'll proceed with my design.
Best,
JD
2024-04-16 07:14 AM - last edited on 2024-04-16 07:56 AM by SofLit
if you want to use the same memory chip
you need to initialize it:
void SDRAM_Initialization_Sequence( void )
{
__IO unsigned long tmpmrd = 0;
FMC_SDRAM_CommandTypeDef cmd;
FMC_SDRAM_CommandTypeDef * Command = &cmd;
/* Step 3: Configure a clock configuration enable command */
Command->CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 1;
Command->ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand( &hsdram1, Command, 0x1000 );
/* Step 4: Insert 100 ms delay */
HAL_Delay( 100 );
/* Step 5: Configure a PALL (precharge all) command */
Command->CommandMode = FMC_SDRAM_CMD_PALL;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 1;
Command->ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand( &hsdram1, Command, 0x1000 );
/* Step 6 : Configure a Auto-Refresh command */
Command->CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 4;
Command->ModeRegisterDefinition = 0;
/* Send the command */
HAL_SDRAM_SendCommand( &hsdram1, Command, 0x1000 );
/* Step 7: Program the external memory mode register */
tmpmrd = ( uint32_t )SDRAM_MODEREG_BURST_LENGTH_2 |
SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL | SDRAM_MODEREG_CAS_LATENCY_3 |
SDRAM_MODEREG_OPERATING_MODE_STANDARD |
SDRAM_MODEREG_WRITEBURST_MODE_SINGLE;
Command->CommandMode = FMC_SDRAM_CMD_LOAD_MODE;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
Command->AutoRefreshNumber = 1;
Command->ModeRegisterDefinition = tmpmrd;
/* Send the command */
HAL_SDRAM_SendCommand( &hsdram1, Command, 0x1000 );
/* Step 8: Set the refresh rate counter */
/* (15.62 us x Freq) - 20 */
/* Set the device refresh counter */
HAL_SDRAM_ProgramRefreshRate( &hsdram1, REFRESH_COUNT );
}
and here is the code to test it.
/* USER CODE BEGIN 2 */
SDRAM_Initialization_Sequence();
/* Write data to the SDRAM memory */
for (uwIndex = 0; uwIndex < BUFFER_SIZE; uwIndex++)
{
*(__IO uint32_t*) (SDRAM_BANK_ADDR + WRITE_READ_ADDR + 4*uwIndex) = aTxBuffer[uwIndex];
}
for (uint16_t i= 0; i < BUFFER_SIZE; i++)
{
aRxBuffer[i] = 0;
}
HAL_Delay(10);
/* Read back data from the SDRAM memory */
for (uwIndex = 0; uwIndex < BUFFER_SIZE; uwIndex++)
{
aRxBuffer[uwIndex] = *(__IO uint32_t*) (SDRAM_BANK_ADDR + WRITE_READ_ADDR + 4*uwIndex);
}
/* USER CODE END 2 */
it worked fine the first time.