cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to use this external SDRAM to store program variables instead of using MCU onboard RAM using the Flexible memory controller (FMC)?

Andrew Hazelton
Associate III

Hi.

I am using the STM32746G Discovery Board and running the STemWin which uses the external SDRAM [Part No.: MT48LC4M32B2B5-6A, Manufacturer: MICRON] to buffer the LCD rendering. Is it possible to use this external SDRAM to store program variables instead of using MCU onboard RAM using the Flexible memory controller (FMC)? 

struct  My_Object {
    uint8_t             Number;
    char                Description[25];          
    double              Input_DI;
    uint8_t             Alarm_Status; 
    uint32_t            Delay_ON_ctr;    
};
 
struct  My_Object	Dectector1;
uint8_t			Varriable1;
uint16_t		Varriable2;
uint32_t		Varriable3;

Can the above variables be stored off MCU in the external SDRAM? How do you go about doing this? The RM0410 Reference manual, section 13 says that there are 2 External device address mapping banks that each contain 4 x 64Mb of address space. But it is very difficult how to figure out how to implement this. Is there an example project that someone could point me too?

Compiler:       IAR Workbench v8.30.1

Graphics:       STemWin

Hardware:       STM32746G Discovery Board

Demo Project:  C:\...\STM32Cube_FW_F7_V1.8.0\Projects\STM32746G-Discovery\Applications\STemWin\EWARM

1 REPLY 1
Andreas Bolsch
Lead II

Surely, and it's already described in STM32Cube_FW_F7_V1.14.0/Projects/STM32746G-Discovery/Demonstrations/STemWin:

ETH_DMADescTypeDef DMARxDscrTab[ETH_RXBUFNB] __attribute__((section(".RxDecripSection")));/* Ethernet Rx MA Descriptor */

ETH_DMADescTypeDef DMATxDscrTab[ETH_TXBUFNB] __attribute__((section(".TxDescripSection")));/* Ethernet Tx DMA Descriptor */

and the corresponding sections in e. g. SW4STM32/STM32F7-DISCO/STM32F746NGHx_FLASH.ld:

 .RxDecripSection (NOLOAD) : { *(.RxDecripSection) } >Memory1

 .TxDescripSection (NOLOAD) : { *(.TxDescripSection) } >Memory2

and the definition of Memory1 and Memory2 in the very same file.

The syntax for assigning data to specific sections and loader file depends on your toolchain, of course, so you have to consult the manuals, though.

The major pitfall: Either these sections must not be initialized at all (therefore "NOLOAD", but you must still ensure that no access will be made before initialization of FMC/SDRAM) or you must adapt the startup file so that the FMC and SDRAM are properly initialized *before* initialization of these sections. That's because the compilers have no real idea about hardware attributes of sections.