2016-11-08 04:46 AM
Hi,
I want to transfer data 16bit over SPI using DMA, Like thatSPI_Transmit(SPIx, (uint16_t) value, (uint16_t) count);For driver ILI9341 function clear screen faster than using SPI mode 8 bit.Many thanks.2016-11-08 05:22 AM
Hi diep.ha,
Your question is kinda vague. You need to provide more information what kind of issue you are facing. However are you familiar with the STM32CubeMX tool? It uses the Cube libraries, which is a HAL implementation for STM32 devices. In the tool you can configure the SPI for your device and in the main function call the HAL_SPI_Transmit_DMA() function, which will do exactly what you are trying to achieve. :) I hope this answers your question, Have a nice day, Renegade2016-11-08 09:03 AM
Which STM32 part, specifically are you using now?
Can you provide details of the board, or the SPI channel used? Can't the controller block fill memory? Or copy the frame buffer internally? Which library are you using currently? No need to use a new one if you have a code based in the other.2016-12-10 12:12 PM
Changing from 8 bit to 16 bit may not change anything as in both cases the DMA is used. The only difference is the frequency of the stolen DMA cycles on the internal bus of the STM32. With DMA 8 or 16 bit, the SPI stream on the oscilloscope probed lines should have no delay between bytes. To clear faster a graphics controller, increasing the SPI clock frequency or using different controller frame memory buffer fill/command would be better.
Please note that some SPI can go faster than others (depend on what is their root clock) and max frequency is either SYSCLK /2 or /4.
2016-12-20 07:27 PM
Thanks for you repone,
I want to transfer fill color in screen ILI9341. I use function
ILI9341_Width = 320, ILI9341_Height = 240. Color in 16 bit
for (i = 0; i < 320; i++)
{
for (j = 0; j < 240; j++)
{
// transmit 1 byte color over SPI
HAL_SPI_Transmit(SPIx, color >> 8, 1);
HAL_SPI_Transmit(SPIx, color, 1);
}
}
It's OK. But very slow. I search in google, use SPI DMA transfer faster but not implementation HAL driver. There is STM32 Standard Peripheral Libraries.
uint32_t pixel_count = 240 * 320;
SPI_Init_16Bit(); // Go to 16-bit SPI mode
/* Send first 65535 bytes */
SPI_DMA_SendHalfWord(SPIx, color, (pixels_count > 0xFFFF) ? 0xFFFF : pixels_count);
/* check again */
if (pixels_count > 0xFFFF)
SPI_DMA_SendHalfWord(SPIx, color, pixels_count - 0xFFFF);
Many Thanks.