cancel
Showing results for 
Search instead for 
Did you mean: 

SDRAM on the STM32F429I-DISC

DetlefS
Senior

Hi,

I want to fly the STM32F429I-DISC with the 8 MB SDRAM. I use CubeIDE and selected the right board. All units are set to default. I commented out everything that had to do with os.

With help of ChatGPT I hacked together an initialization of the SDRAM and set up a SDRAM Test. That seems to work partly but with weird effects. In the following code: start/end 0x00/0xff or 0x100/0x1ff works fine, but start/end 0x00/0x101 reads out 0x100 at  address 0x0. Maybe it is an timing issue with precharged lines.

THX

Cheers

Detlef

 

#define SDRAM_BASE_ADDR ((uint32_t)0xD0000000)

void SDRAM_Test(void)

{

volatile uint16_t *p = (volatile uint16_t *)SDRAM_BASE_ADDR;

uint32_t i ;

uint32_t start = 0x100 ;

uint32_t end = 0x302 ;

for (i=start; i<end; i++) p[i] = i;

sprintf(buf,"start \r\n",i);

HAL_UART_Transmit(&huart1, (uint8_t *) buf, strlen(buf), HAL_MAX_DELAY);

while(1){

for (i=start; i<end;i++)

if (p[i] != i){

sprintf(buf,"no 0x%x 0x%x\r\n",i,p[i]);

HAL_UART_Transmit(&huart1, (uint8_t *) buf, strlen(buf), HAL_MAX_DELAY);

}

sprintf(buf,"end \r\n",i);

HAL_UART_Transmit(&huart1, (uint8_t *) buf, strlen(buf), HAL_MAX_DELAY);

}

}

 

3 REPLIES 3
mƎALLEm
ST Employee

Hello,

1- In next time please use </> to share a code. Please read How to write your question to maximize your chances to find a solution

I invite you to edit your post to comply with the rule.

Thank you for your understanding.

2- Better to inspire from the SDRAM driver implemented in the BSP : https://github.com/STMicroelectronics/32f429idiscovery-bsp/blob/d77779a2a4e950246752a4397e2adf40c25829f9/stm32f429i_discovery_sdram.c

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Ozone
Principal III

I never had a F429 Disco board.
However, I believe to remember it was around the time the first boards were "blessed" with Cube/HAL code instead of the legacy SPL.
I recommend to check if a SPL-based firmware package is available, those always contained driver or example code for onboard peripherals or units like SDRAMs, LCDs, MEMS or audio codecs.
And the SPL is much less awkward and easier to understand.

And even if you choose a new Cube-based example, the config settings of the SPL code can serve as a template.

DetlefS
Senior

Merged into existing thread


Hi,

I loaded the discovery board with the default CubeIDE project for that board. FMC and SDRAM are enabled, HAL_SDRAM_GetState(&hsdram1) returns ready. If I want to read or write SDRAM at address 0xC0000000 or 0xD0000000 the program freezes.

What do I miss?

THX Cheers

Detlef