STM32 and ILI9341 16bit Parallel - Page 1
Forum section: electronics / general

author: maurosmartins
author_rank: Regular Contributor
timestamp: December 16, 2016, 12:07:17 am
content: Hello all,for my recent hobby project I've have a display board with a STM32F101RBT6 and a 320x240 display with the ILI9341 controller.The display is connected to the microcontroller by means of a 16bit parallel bus as follows:I've managed to put the display to work but I need constant "attention" from the CPU to generate the "Write" pulse at the end of each pixel I put on screen.Is there a way to free the CPU of this task, is DMA capable o something similar? from what I've read the way to go would be the FSMC module but this microcontroller doesn't have it.looking forward for your comments,thanks in advanced,Best regards, Mauro.

author: Buriedcode
author_rank: Super Contributor
timestamp: December 16, 2016, 01:20:30 am
content: This appnote implies that you can use the DMA with GPIO on the STM32F1xxhttp://www.st.com/content/ccc/resource/technical/document/application_note/47/41/32/e8/6f/42/43/bd/CD00160362.pdf/files/CD00160362.pdf/jcr:content/translations/en.CD00160362.pdfBut going through the datasheet, I am skeptical. I have no doubt it is possible to do direct DMA-to-GPIO parallel transfers on some devices, I dont' see anything in the manual for that device that allows it.If you're not really after 'speed', but don't want constant CPU attention, a way thats 16x slower would be to use two cascaded parallel shift registers, and use the DMA with the SPI module. I'm guessing (never good) that the STM23F1 has hardware controlled chip select line that you can use as a parallel 'load' for the shift registers. And of course, 16-bit transfers. As I said, it'll be much slower, but unless you're updating the display many times a second (ie: for video) then it could be pretty quick. Hardly ideal when there should be some devices in that line that have DMA parallel GPIO, but I didn't find any.

author: krho
author_rank: Regular Contributor
timestamp: December 16, 2016, 05:06:09 am
content: I think he is over-complicating things. The display controller has a SPI, sou he should just connect everything via SPI and be done with it.

author: Jeroen3
author_rank: Super Contributor
timestamp: December 16, 2016, 07:44:07 am
content: This display controller requires CS every SPI byte. You can't use it with DMA.

author: CK345
author_rank: Newbie
timestamp: December 16, 2016, 11:38:38 am
content: STM32-->FSMC_TFT

author: JPortici
author_rank: Super Contributor
timestamp: December 16, 2016, 11:57:46 am
content: if your STM doesn't have the TFT controller, this is what i would do:Timer with Output compare (PWM) + DMA.Timer Rollover initiate a DMA transfer, Output Compare/PWM generate a pulse of a certain width at a certain point during the timer run.

author: bktemp
author_rank: Super Contributor
timestamp: December 16, 2016, 11:59:34 am
content: If you want to transfer a large block of data into the LCD use FSMC or SPI. Both work fine using DMA.I would not use DMA + GPIO, because getting the WR pulse timing right can be difficult. It can be done with timer+output compare, but you need to slow it down, otherwise it might miss a pulse when more than one DMA channels are active.

author: maurosmartins
author_rank: Regular Contributor
timestamp: December 16, 2016, 08:44:50 pm
content: Hello all, thank you very much for your replies.My hardware is set I haven't developped the board so I have to work with what I've got.Neverthless I would like to ask if you have experience with this type of display it takes me about 90 miliseconds to completely fill the screen with a given color, is this a nice value or should I expect to be faster? My microcontroller is running at 36MHz.Again thank you for your help,best regards Mauro.Enviado do meu SM-T710 através de Tapatalk

author: bktemp
author_rank: Super Contributor
timestamp: December 16, 2016, 08:56:00 pm
content: 90ms is ok unless you want to display fast animations.ILI9341 allows 66ns write cycle. So the fastest possible screen update can be done in 320x240*66ns=5.1ms. But this is not possible for most low end microcontrollers.Your avarage write cycle time is 90ms/(320*240)=1.18us. You probably can do better if you optimize your code or use inline assembler for the timing critical part.

author: Jeroen3
author_rank: Super Contributor
timestamp: December 16, 2016, 10:08:15 pm
content: Can confirm, around 100 ms is best software can do on 72 mhz core without overclocking display spi.

author: FreddyVictor
author_rank: Regular Contributor
timestamp: December 17, 2016, 10:12:15 am
content: Quote from: maurosmartins on December 16, 2016, 08:44:50 pmMy tests with this display are giving ~117ms with SPI clock running @ 10.5MHz (STM32F401 using DMA)funnily enough: 240 x 320 x 16 / 10500000 = 0.117sif you want to do some animation effects, you can animate only a small part of the screen to help speed it up

author: electrodacus
author_rank: Super Contributor
timestamp: December 19, 2016, 12:49:41 am
content: Quote from: maurosmartins on December 16, 2016, 08:44:50 pmI'm sure you can get much faster fill rate with a 16bit parallel interface. I use STM32 at 40Mhz and SPI at 20MHz and I'm able to get about 15fps with DMA. Without DMA ruining the SPI at 30Mhz I was able to get around 100ms.You can check my videos on youtube in the description on one of them there is also the source code

author: Md Mubdiul Hasan
author_rank: Regular Contributor
timestamp: December 19, 2016, 01:14:23 am
content: Hey Martin,Did not you feel difficulties on making SPI protocol in STM?Besides DMA , didnot you tried in RTC?