2018-06-06 04:45 PM
I have a large data buffer stored in external sdram. I'd like to send data to a serial peripheral (uart, spi or iis) directly on a dma transfer. Is it possible to do so?. Every FMC sdram example available move data from sdram to internal ram.
Thanks in advance.
Tony
Solved! Go to Solution.
2018-06-06 05:35 PM
In this context you could use USART+DMA to send up to 64KB at a time, the real issue would be overwhelming the host. You'd probably want some protocol to control flow and check integrity as you offload the data.
I'd expect there would be examples of DMA transfers from SDRAM to a memory mapped LCD/FMC, standard settings/configuration for USART+DMA should support a buffer in Internal SRAM or External SDRAM.
Something like X-MODEM would work at 921600 baud
2018-06-06 05:35 PM
In this context you could use USART+DMA to send up to 64KB at a time, the real issue would be overwhelming the host. You'd probably want some protocol to control flow and check integrity as you offload the data.
I'd expect there would be examples of DMA transfers from SDRAM to a memory mapped LCD/FMC, standard settings/configuration for USART+DMA should support a buffer in Internal SRAM or External SDRAM.
Something like X-MODEM would work at 921600 baud
2018-06-18 03:15 PM
Thanks Clive, following on your advice i was able to set a dma transfer from external SDRAM memory space to IIS peripheral for sending audio samples to an audio codec as intended. Only noted that when configuring FMC controller through CubeMx a piece of code is missing (according to available examples) concerning a FMC_SDRAM_CommandTypeDef setting. Since i was using the exact same chip as Discovery boards on my design i was able to copy the code from the examples and it worked.
Best Regards
Tony
PS:
Here its the code missing from CubeMx initialization (I'm using CubeMx v4.20)
file fmc.c
FMC_SDRAM_CommandTypeDef command;
SDRAM_HandleTypeDef hsdram2;FMC_SDRAM_CommandTypeDef* Command = &command;
Command->CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2; Command->AutoRefreshNumber = 1; Command->ModeRegisterDefinition = 0; HAL_SDRAM_SendCommand(&hsdram2, Command, 0x1000);HAL_Delay(100);
Command->CommandMode = FMC_SDRAM_CMD_PALL; Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2; Command->AutoRefreshNumber = 1; Command->ModeRegisterDefinition = 0; HAL_SDRAM_SendCommand(&hsdram2, Command, 0x1000); Command->CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE; Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2; Command->AutoRefreshNumber = 4; Command->ModeRegisterDefinition = 0; HAL_SDRAM_SendCommand(&hsdram2, Command, 0x1000); tmpmrd = (uint32_t)SDRAM_MODEREG_BURST_LENGTH_2 | SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL | SDRAM_MODEREG_CAS_LATENCY_3 | SDRAM_MODEREG_OPERATING_MODE_STANDARD | SDRAM_MODEREG_WRITEBURST_MODE_SINGLE; Command->CommandMode = FMC_SDRAM_CMD_LOAD_MODE; Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2; Command->AutoRefreshNumber = 1; Command->ModeRegisterDefinition = tmpmrd; HAL_SDRAM_SendCommand(&hsdram2, Command, 0x1000); HAL_SDRAM_ProgramRefreshRate(&hsdram2, REFRESH_COUNT);2018-06-19 12:03 AM
This code is for graphics sdram for CubeMX 4.26