Question
STM32429I-EVAL SDRAM as data example shows incorrect memory address.
Posted on May 15, 2014 at 16:12
Hi,
So I've ran the FMC_SDRAM_DataMemory example, which should allow use of the external SDRAM. However the following, gives me incorrect results:uint32_t aTable[1024];
/* Counter index */
uint32_t uwIndex;
__IO uint32_t uwTabAddr;
__IO uint32_t MSPValue = 0;
/* Private function prototypes -----------------------------------------------*/
static
void
SystemClock_Config(
void
);
/* Private functions ---------------------------------------------------------*/
/**
* @brief Main program
* @param None
* @retval None
*/
int
main(
void
)
{
/* STM32F4xx HAL library initialization:
- Configure the Flash prefetch, instruction and Data caches
- Configure the Systick to generate an interrupt each 1 msec
- Set NVIC Group Priority to 4
- Global MSP (MCU Support Package) initialization
*/
HAL_Init();
/* Configure the system clock to 180 Mhz */
SystemClock_Config();
UartHandle.Instance = USARTx;
UartHandle.Init.BaudRate = 9600;
UartHandle.Init.WordLength = UART_WORDLENGTH_8B;
UartHandle.Init.StopBits = UART_STOPBITS_1;
UartHandle.Init.Parity = UART_PARITY_ODD;
UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
UartHandle.Init.Mode = UART_MODE_TX_RX;
if
(HAL_UART_Init(&UartHandle) != HAL_OK)
{
/* Initialization Error */
}
for
(uwIndex = 0; uwIndex <1024 ; uwIndex++)
{
aTable[uwIndex] =uwIndex;
}
uwTabAddr = (uint32_t)aTable;
/* should be 0xC00xxxxx */
/* Get main stack pointer value */
MSPValue = __get_MSP();
/* should be 0xC00xxxxx */
printf
(
''testVar mem: %x\r\n''
, &uwTabAddr);
printf
(
''MSP mem: %x\r\n''
, &MSPValue);
/* Infinite loop */
while
(1)
{
}
}
This outputs (I assume hex) - 20000018 for MSP mem and 20000020 for testVar.
stm32f4xx_hal_conf.h even keeps the SDRAM module commented out:
/* #define HAL_SDRAM_MODULE_ENABLED */ I'm trying to use the SDRAM to store a large buffer, so I assume setting it up this way is the right way to do it.
I noticed the example app doesn't appear to include any extSDRAM init code. Nor does Keil memory areas have an entry starting at 0xC0000000, am I missing something here or is this example correct?
Thanks in advance.