Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Operating system
Development tools
Security and connectivity
Important update: Arm Announces End of Life Timeline for Mbed. This site will be archived in July 2026. Read the full announcement.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Nick Marsh.
2
replies
Explicitly tell it to convert the integer to an integer pointer by:
Address = (int*) BaseAddress;
By the way in your printf I assume you want to print *Address and not &Address (first one is the value of what the Address points too, second one is the location where the Address pointer itself is stored)
Hi, Yes, that worked, thanks Eric.
but now I am stuck unable to understand how to proceed under MBedOS3 framework.
I am trying to initialise the SDRAM in MBed OS 16.03. Platform: STM32F429i DISC1
( I am struggling to understand C let alone the SDRAM driver. ) ( Should I be using C or CPP ?? )
here is the help, but I cannot understand how to complete these instructions,
do we have an example under MBed OS for the correct configuration of the SDRAM chip ?
How do we view the API's for MBed OS?
Then, how do I ask Malloc to use the SDRAM for Data storage ?
TEXT
/****************
# How to use this driver #
[..] This driver is a generic layered driver which contains a set of APIs used to control SDRAM memories. It uses the FMC layer functions to interface with SDRAM devices. The following sequence should be followed to configure the FMC to interface with SDRAM memories:
(#) Declare a SDRAM_HandleTypeDef handle structure, for example: SDRAM_HandleTypeDef hdsram
(++) Fill the SDRAM_HandleTypeDef handle "Init" field with the allowed values of the structure member.
(++) Fill the SDRAM_HandleTypeDef handle "Instance" field with a predefined base register instance for NOR or SDRAM device
(#) Declare a FMC_SDRAM_TimingTypeDef structure; for example: FMC_SDRAM_TimingTypeDef Timing; and fill its fields with the allowed values of the structure member.
(#) Initialize the SDRAM Controller by calling the function HAL_SDRAM_Init(). This function performs the following sequence:
() MSP hardware layer configuration using the function HAL_SDRAM_MspInit()
() Control register configuration using the FMC SDRAM interface function
FMC_SDRAM_Init()
() Timing register configuration using the FMC SDRAM interface function
FMC_SDRAM_Timing_Init()
() Program the SDRAM external device by applying its initialization sequence
according to the device plugged in your hardware. This step is mandatory
for accessing the SDRAM device.
(#) At this stage you can perform read/write accesses from/to the memory connected to the SDRAM Bank. You can perform either polling or DMA transfer using the following APIs:
(++) HAL_SDRAM_Read()/HAL_SDRAM_Write() for polling read/write access
(++) HAL_SDRAM_Read_DMA()/HAL_SDRAM_Write_DMA() for DMA read/write transfer
(#) You can also control the SDRAM device by calling the control APIs HAL_SDRAM_WriteOperation_Enable()/ HAL_SDRAM_WriteOperation_Disable() to respectively enable/disable the SDRAM write operation or the function HAL_SDRAM_SendCommand() to send a specified command to the SDRAM device. The command to be sent must be configured with the FMC_SDRAM_CommandTypeDef structure.
(#) You can continuously monitor the SDRAM device HAL state by calling the function HAL_SDRAM_GetState()
@endverbatim ****************
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.
Hi,
how can I reference a memory address like 0xD0000000 ?
int BaseAddress,Offset_Address; int i; int * Address; BaseAddress = 0x60000000; Offset_Address = 0x10000000; Address = BaseAddress; <- this fails here //printf("Address %d\n",Address); for (i = 0; i < 4; ++i) { printf("Data %d\n\r",&Address); Address += Offset_Address; } Address += Offset_Address; // skip 0xA0000000 Address += Offset_Address; // skip 0xB0000000 printf("Data %d\n\r",&Address); Address += Offset_Address; printf("Data %d\n\r",&Address);C:/workspace/Blinky3/source/Blinky3.cpp: In function 'void Check_for_SDRAM()': C:/workspace/Blinky3/source/Blinky3.cpp:68:14: error: invalid conversion from 'int' to 'int*' [-fpermissive]
Address = BaseAddress;
C:/workspace/Blinky3/source/Blinky3.cpp:73:36: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int' [-Wformat=]
printf("Data %d\n\r",&Address);
C:/workspace/Blinky3/source/Blinky3.cpp:73:36: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int' [-Wformat=]
C:/workspace/Blinky3/source/Blinky3.cpp:80:36: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int' [-Wformat=]
printf("Data %d\n\r",&Address);
C:/workspace/Blinky3/source/Blinky3.cpp:80:36: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int' [-Wformat=]
C:/workspace/Blinky3/source/Blinky3.cpp:82:36: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int' [-Wformat=]
printf("Data %d\n\r",&Address);
C:/workspace/Blinky3/source/Blinky3.cpp:82:36: warning: format '%d' expects argument of type 'int', but argument 2 has type 'int' [-Wformat=]
ninja: build stopped: subcommand failed.
error: command ['ninja'] failed