cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429i-disc1 ili9341 SPI5 DMA-blazing fast but transmission errors

Posted on August 24, 2016 at 22:44

Hello everybody,

I am using the STM32F429i-disc1 board to create a SPI based driver for the ili9341. To achive the best performance with SPI, I am using DMA with SPI5. I connected PC2(configured as GPIO input) and PF6 (configured as SPI5 hardware CS) with a wire for hardware CS for the onboard ili9341 display. With CubeMX 4.16, I configured the Hardware and created an SW4STM32 project (see the attached Project files). So far, so good. With polling SPI data transfer, everything works fine, but a little bit slow. When using SPI DMA transfers, the pixel data (3 different images in an array stored in flash) gets somehow distorted. The first needed fix was to decrease the 8bit pointer to the images to avoid completely false colours before i start the DMA transfer. But the picture quality is still not perfect. When I transfer the image without DMA, the image quality is noticeable better and the decrease of the pointer is not needed. In the demo, you can see the difference. At first, a image is transfered with DMA, but you can spot some distortions in the background and on the skin. then, the same picture is send without DMA, noticeable slower, but with improved image quality(the same like on the PC screen). Can you explain me why the data gets corrupted and I have to decrease the pointer for one byte ? Lowering the SPI speed by choosing a higher prescaler has no effect except the loss of screen refresh speed.

Best regards,

Markus.

#stm32f429-ili9341-dma-spi
4 REPLIES 4
Posted on August 26, 2016 at 18:39

I am still investigating with the SPI DMA mode. To be sure that no hardware related issues cause the DMA transfer corruption, I short circuited D3 (the red cable), which causes a voltage drop from 3,3V to 3,0 Volts on the uC and ili9341. I also ensured that PC1 is high to disable the MEMS SPI CS connection. It had no effect to the data corruption. You can see the disco board with the demonstration here : https://youtu.be/qSf7YtFZIsA

If nobody can give me a hint, i will test the ili9341 driver on another hardware to ensure that it is software related. Are there no ideas from the forum ?

Best regards,

Markus.
Posted on August 31, 2016 at 15:14

Some tests show that the data corruption only occurs if the data source is internal flash. SPI DMA from internal SRAM work flawless. Is the flash perhaps too slow for SPI DMA ? At 180 MHz, CubeMX adds a lot of wait cycles to the flash access of the CPU. Can somebody confirm / prove wrong this idea ?

michaelc.barton9
Associate II
Posted on September 10, 2016 at 14:47

yes, there's definitely a problem

I've tried several things to try and resolve your issue, but currently no success :(

I don't think its the SPI speed, as setting SPI to /4 rate makes no difference

It looks like the 1st pixel is blank, and all column 1 pixels are wrong.

also the picture itself is shifted 1 pixel to the right

I've only used Std Peripheral Libs for F4 so far so little experience with HAL drivers ..

Posted on September 15, 2016 at 11:41

Thanks for checking with the Std Peripheral Libs, so i can assume that it is not a CubeMX Problem. I checked my ili9341 Lib with a Nucleo-F401RE and there i do not need to add a Byte at the beginning of an DMA Transfer, some Picture corruption is still visible. But i can see some noise on the clock Signal. I expect that the STM32F429i-disco also has some noisy signals caused by crosstalk and Signal reflections caused by the multiple Connection Points of almost every uC pin. Perhaps when i find the right Pins, with some Termination, i can fix it. Work in Progress ...

Best regards,

Markus.