Author Topic: STM32 and ILI9341 16bit Parallel  (Read 11800 times)

0 Members and 1 Guest are viewing this topic.

Offline maurosmartinsTopic starter

  • Regular Contributor
  • *
  • Posts: 62
  • Country: pt
    • Electronics and Embedded systems
STM32 and ILI9341 16bit Parallel
« on: December 16, 2016, 12:07:17 am »
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.
 

Offline Buriedcode

  • Super Contributor
  • ***
  • Posts: 1774
  • Country: gb
Re: STM32 and ILI9341 16bit Parallel
« Reply #1 on: December 16, 2016, 01:20:30 am »
This appnote implies that you can use the DMA with GPIO on the STM32F1xx

http://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.pdf

But 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.
 

Offline krho

  • Regular Contributor
  • *
  • Posts: 225
  • Country: si
Re: STM32 and ILI9341 16bit Parallel
« Reply #2 on: December 16, 2016, 05:06:09 am »
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.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4286
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: STM32 and ILI9341 16bit Parallel
« Reply #3 on: December 16, 2016, 07:44:07 am »
This display controller requires CS every SPI byte. You can't use it with DMA.
 

Offline CK345

  • Newbie
  • Posts: 3
  • Country: cn
Re: STM32 and ILI9341 16bit Parallel
« Reply #4 on: December 16, 2016, 11:38:38 am »
STM32-->FSMC_TFT :clap:
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3634
  • Country: it
Re: STM32 and ILI9341 16bit Parallel
« Reply #5 on: December 16, 2016, 11:57:46 am »
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.
 

Offline bktemp

  • Super Contributor
  • ***
  • Posts: 1616
  • Country: de
Re: STM32 and ILI9341 16bit Parallel
« Reply #6 on: December 16, 2016, 11:59:34 am »
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.
 

Offline maurosmartinsTopic starter

  • Regular Contributor
  • *
  • Posts: 62
  • Country: pt
    • Electronics and Embedded systems
Re: STM32 and ILI9341 16bit Parallel
« Reply #7 on: December 16, 2016, 08:44:50 pm »
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
« Last Edit: December 16, 2016, 08:47:55 pm by maurosmartins »
 

Offline bktemp

  • Super Contributor
  • ***
  • Posts: 1616
  • Country: de
Re: STM32 and ILI9341 16bit Parallel
« Reply #8 on: December 16, 2016, 08:56:00 pm »
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.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4286
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: STM32 and ILI9341 16bit Parallel
« Reply #9 on: December 16, 2016, 10:08:15 pm »
Can confirm, around 100 ms is best software can do on 72 mhz core without overclocking display spi.
 

Offline FreddyVictor

  • Regular Contributor
  • *
  • Posts: 164
  • Country: gb
Re: STM32 and ILI9341 16bit Parallel
« Reply #10 on: December 17, 2016, 10:12:15 am »
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.
My 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.117s

if you want to do some animation effects, you can animate only a small part of the screen to help speed it up
 

Offline electrodacus

  • Super Contributor
  • ***
  • Posts: 1867
  • Country: ca
    • electrodacus
Re: STM32 and ILI9341 16bit Parallel
« Reply #11 on: December 19, 2016, 12:49:41 am »
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.

I'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
 

Offline Md Mubdiul Hasan

  • Regular Contributor
  • *
  • Posts: 202
  • Country: kr
  • Lets learn more to be more inspired in Electronics
Re: STM32 and ILI9341 16bit Parallel
« Reply #12 on: December 19, 2016, 01:14:23 am »
Hey Martin,

Did not you feel difficulties on making SPI protocol in STM?

Besides DMA , didnot you tried in RTC?
Hasan
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf