AnsweredAssumed Answered

Problem using the HAL libraries for memory to SDRAM transfer using DMA

Question asked by parikh.dhaval on Jun 29, 2014

Hello All,

I’m trying to read and write data from memory to SDRAM using DMA. I’ve used the STM32 Cube software to generate the initialization code which uses the HAL libraries. I'm using the STM32F429 discovery board.

I was able to read and write data to SDRAM WITHOUT using DMA.

And I was also able to use DMA to transfer data between 2 arrays.

But, when I set the destination address as 0xD0000000 (since I’m using SDRAM bank 2) and after writing data to that location, when I read it, I always get 0x00.

These are the HAL functions which I have used:

1)      1)HAL_SDRAM_Write_32b() and HAL_SDRAM_Read_32b().

These functions write and read data to the SDRAM without DMA. They work fine.

2)      2)HAL_DMA_Start_IT() or HAL_DMA_Start().

These functions are used for transfer of data between source and destination address using DMA. I was able to transfer data between 2 arrays using this function. But, when I specify the SDRAM address, it doesn’t work. It just reads 0x00. So I think it doesn’t write anything to that location in the first place.

3)      3)HAL_SDRAM_Write_DMA() and HAL_SDRAM_Read_DMA().

These functions are used for writing and reading of data to SDRAM using DMA. Internally, they call the HAL_DMA_Start_IT(). I used these functions, but it didn’t work.

I’m attaching my main.c file which has all the initialization of the SDRAM and DMA and the function calls.

I’m also attaching the following header files and .c files.

1)      1)Stm32f4xx_hal_sdram.c and Stm32f4xx_hal_sdram.h

They contain the HAL_SDRAM_Write_32b(), Read_32b(), HAL_SDRAM_Write_DMA() and Read_DMA().

2)      2)Stm32f4xx_hal_dma.c and Stm32f4xx_hal_dma.h

These files have the HAL_DMA_Start_IT() and HAL_DMA_Start() functions.

It would be really helpful if someone could guide me and help me out.

Thank you.