Skip to main content
fedora4
Associate
August 18, 2019
Question

May I ask does anyone of you have sample codes for STM32F103 to dive ILI9341 OLED display by SPI and DMA?

  • August 18, 2019
  • 4 replies
  • 1236 views

Many many thanks.:smiling_face_with_smiling_eyes:

This topic has been closed for replies.

4 replies

Tesla DeLorean
Guru
August 18, 2019
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
fedora4
fedora4Author
Associate
August 19, 2019

Thank you Clive. I have succeed in controlling the ILI9341 in SPI but can never get the SPI to work with DMA, any idea?

waclawek.jan
Super User
August 19, 2019

> can never get the SPI to work with DMA

Show us what did you do.

DMA for Tx is as much as (assuming DMA clock is alrady enabled in RCC):

  • look up in RM the channel appropriate to your peripheral
  • prepare data in memory
  • in DMA, clear the status register bits respective to given channel, for that channel set the memory address to the buffer with data, peripheral address to SPIx_DR, NDTR to number of data, in control register select direction of transfer to M->P, set width on both sides (to byte I presume, according to how the SPI is set), and set enable
  • in SPI, enable DMA for Tx by setting SPI_CR2.TXDMAEN

JW

Jack Peacock_2
Associate II
August 19, 2019

The problem with using DMA on these low end LCD controllers is the cycle time between commands. The datasheet is vague on just what the minimal time between two commands should be. On the IL9341 it seems to imply 450us between reads, but it isn't clear if that's for GRAM only or some registers. There's a separate cycle time for ID read, so my guess is the cycle times vary considerably based on what you're doing.

Unfortunately that means you can't just send a long string of DMA commands at the fastest clock rate. Either one SPI clock cycle has to be the longest possible cycle time for the LCD controller, or you have to pause the DMA between each command, in which case there's really no benefit in using DMA.

Jack Peacock