cancel
Showing results for 
Search instead for 
Did you mean: 

Can't write to external SDRAM address 0xD0000000, only 0xD0000002

aro
Associate III

This code doesn't write anything:

*(__IO uint16_t*) 0xD0000000 = (uint16_t) 0x01;

However, this code does write:

*(__IO uint16_t*) 0xD0000002 = (uint16_t) 0x01;

As you can see, the only difference is the 2 vs 0 at the end. The 0xD0000000 address is defined in the .ioc settings and in the .ld. 

What can this be? Where am I going wrong?

6 REPLIES 6
SKEnbio
Associate

Hi,

Please send more information about Your project. Please check also for other address. Maybe You have problem with physically connection to the external SDRAM. Please see this guide: https://support.touchgfx.com/docs/development/board-bring-up/how-to/04-enable-external-ram 

Best Regards,

Slawek

jiangfan
ST Employee

some points to check:

- what board used ? your own board or board from ST ? Are you sure your board works fine ?

- any debug with scope to check the corresponding signals ? like address and data signals ?

aro
Associate III

It's a display connected to a Waveshare board. I had already done the setup that the link suggests.

Sure, the hardware could be an issue. I didn't attempt to debug with the scope yet.

I run this code to test:

uint16_t sdrambuf[SDRAM_BUFFER_SIZE] __attribute__ ((section(".sdram")));

for (counter = 0x00; counter < (SDRAM_SIZE); counter++) {
    sdrambuf[counter] = (uint16_t) counter;
}

You can see in the memory that it first writes 00010001. The variable 'counter' is zero on the first iteration, so I don't know why it writes that. 

The second thing is that first it writes 00000003 and then 00040003. I thought it would be 00030004.

sdram.png

You mentioned "It's a display connected to a Waveshare board."

it is confusing. it seems that Waveshare board has MCU STM32H7 on it. but what is the relationship between SDRAM and display ? You would access SDRAM and it is on the display (connected to a Waveshare board) ?

or You would access display (connected to a Waveshare board) and the display using SDRAM address ?

aro
Associate III

The SDRAM is on the board and I use that to connect to the display.

https://www.waveshare.com/openh743i-c-package-a.htm

aro
Associate III

I finally got it to work by simply copying and pasting the board vendor sdram initialization code.

What is strange and I haven't found the reason yes is how it writes to memory: 00030002 00050004 etc. The endianness in the memory region is set to default.

It doesn't really matter for what I do, but it is annoying not to understand what's happening.