What exactly is throttling the SPI transfers? If you're using DMA directly (rather than triggered by a timer or something else), then as soon as the SPI is free, the DMA peripheral would start another transfer. As a result, being busy all the time would be expected.
According to the manual for the STM32F1xx series, section 25.3.7 (other series should have similar behavior):
When communication is not continuous, the BSY flag is low between each communication.
When communication is continuous:
● in master mode, the BSY flag is kept high during all the transfers
I am a bit stuck in that because do not have much knowledge on SRAM
and how to access it. can anyone help me out here?
"SRAM" just like the memory on your PC, all your function stacks, and auto variables are located in it. In your code above, the two arrays:
uint32_t source[SIZE]; uint32_t destination[SIZE];
just are allocated in "SRAM", the code your posted, is using DMA to transfer data from array "source" to "destination", and when done, it generate a interrupt.
So, what your need is just locating your data in SRAM, then fire the DMA. If your data need be located at a given address such as "0x??????", the address need be in your SRAM's address. For STM32f303VCT6, the interanl SRAM starts from address 0x20000000, ends on 0x2000A000.
There may be different methods depend on which compiler you are using. For ARM MDK, you can go here: http://www.keil.com/support/docs/2829.htm
Update:
If you want to use DMA to transfer data/command from your memory to LCD. You may need:
- Put your data/command in the fixed memory location. And you may need to set your LCD control pins, such as A0, enable, etc....
- Set the "DMA_PeripheralBaseAddr" to "&GPIOX->ODR", "X" dependent on which GPIO port you are using.
- Set "DMA_DIR" to "DMA_DIR_PeripheralDST";
- Set "DMA_MemoryBaseAddr" to your data address.
- Set the "DMA_BufferSize" to your buffer size. Note:
Specifies the buffer size, in data unit, of the specified Channel. The
data unit is equal to the configuration set in DMA_PeripheralDataSize
or DMA_MemoryDataSize members depending in the transfer direction.
- Set "DMA_PeripheralDataSize" and "DMA_MemoryDataSize" to byte, because your LCD interface is 8 bit.
- When using "DMA_M2M_Disable", you need a hardware DMA trigger source, using "DMA_M2M" you can trig the DMA by your code, when you enable the DMA, the transfer starts.
- Finally, enable DMA and fire it.
Best Answer
Short description:
Timer trig DMA with desired speed, DMA write data to GPIO output register.
Long description:
Code blank: