Electronic – STM32 – 2 MegaByte DMA Transfer ADC To SDRAM

adcdmasdramstm32

I want to transfer 2 MB of converted ADC data into SDRAM. I'm using STM32F429 Discovery board which is shipped with a 4-bank SDRAM (1 Meg Bits x 16 Bits x 4 Banks (64-MBIT)).

I've configured the ADC and linked the related DMA; I'm using HAL_ADC_Start_DMA(ADC_HandleTypeDef* hadc, uint32_t* pData, uint32_t Length) to start the adc and DMA transfer, but the length is limited to 65535. As I investigated further I saw that the STM32F4xxx DMA's NDTR (Number of data register) is only 16-bit wide so I can transfer at most 65536 bytes of data in each DMA request!

Is there any way to fill all of the Bank2 of FMC (2MB of data) in one DMA request? Or can it be done with double buffering?

And second to that, The SDRAM has 4 banks each capable of storing 2MB of data; but STM32F4xxx FMC has only 2 banks for SDRAM. How can I initialize and use all 4 banks simultaneously to have the SDRAM's full capacity?

Best Answer

To answer the first question, yes, you can. You'll have to use multiple DMA operations, and most DMA controllers have some means of "chaining" operations together for continuous operation. I don't have the specific details about how that works on the STM32. The CPU will probably have to process an interrupt at the end of each DMA block.

To answer the second question, it's probably a confusion in terminology. The word "bank" is being used in one sense regarding how the SDRAM is organized internally, but in a completely different sense regarding how the SDM32 addresses memory in general. Banks on the CPU do not correspond to banks inside the SDRAM. As far as the CPU is concerned, the entire SDRAM chip is one big bank.