Skip to main content
Visitor II
October 16, 2024
Question

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

  • October 16, 2024
  • 5 replies
  • 1654 views

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?

    This topic has been closed for replies.

    5 replies

    Visitor II
    October 16, 2024

    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

    ST Employee
    October 16, 2024

    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 ?

    aroAuthor
    Visitor II
    October 16, 2024

    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

    ST Employee
    October 17, 2024

    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 ?

    aroAuthor
    Visitor II
    October 17, 2024

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

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

    aroAuthor
    Visitor II
    October 24, 2024

    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.