Author Topic: TFT display driver for Cortex M0?  (Read 1827 times)

0 Members and 1 Guest are viewing this topic.

Offline JesterTopic starter

  • Frequent Contributor
  • **
  • Posts: 859
  • Country: ca
TFT display driver for Cortex M0?
« on: February 07, 2019, 10:04:49 pm »
Disclosure, I'm a hardware guy not a programmer.....

I designed a simple PCB using a Cortex M0, and have a blinky LED working, that I compiled using ATMEL Studio v7.0 and downloaded to the board using a Segger J-Link mini. So the part is running and I can program it. Next step is to get the display working and I’m looking for advice.

This is the display: https://www.aliexpress.com/item/2-8-SPI-ILI9341-TFT-LCD-Display-240x320-Touch-Panel-Serial-Port-Module-5V-3-3V/32666535328.html?spm=a2g0s.9042311.0.0.8UicH9

The interface is SPI, to both the display and touchscreen.

FWIW on a previous Arduino Cortex M0 project, using the open source Adafruit display and touch-screen libraries; “Adafruit_ILI9341” I was able to do everything I needed to with this display.  So those libraries might be the fastest and easiest approach to getting this working under Atmel Studio without the Arduino layer, I’m just not sure how I would incorporate those libraries into this non- Arduino project or if that’s actually possible? If not then possibly a similar open source library?

I’m pretty sure this is the library I used: https://github.com/adafruit/Adafruit_ILI9341

Is this possibly as simple as including the .cpp and .h files into my main.c and then calling the routines or I’m guessing not quite so simple?
 

Offline picandmix

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Re: TFT display driver for Cortex M0?
« Reply #1 on: February 08, 2019, 09:56:52 am »
Hi,

Use those screens myself, but only with Arduino C++ and though they say SPI you are still faced with 18 i/o lines if you include the SD card.

Perhaps consider one of these screens, just TX/RX connection and no problems about screen drivers as its all done by the onboard Arm chip via its own IDE, programmed by usb to ttl converter or SD card.

https://www.banggood.com/3_2-Inch-Nextion-Enhanced-HMI-Intelligent-Smart-USART-UART-Serial-Touch-TFT-LCD-Module-Display-Panel-p-1141610.html?cur_warehouse=CN

 



« Last Edit: February 08, 2019, 10:38:21 am by picandmix »
 

Offline JesterTopic starter

  • Frequent Contributor
  • **
  • Posts: 859
  • Country: ca
Re: TFT display driver for Cortex M0?
« Reply #2 on: February 08, 2019, 10:06:25 pm »
I already have hardware based on the display I posted, so I'm searching for a solution for that display.

I tried importing a working Arduino sketch into AS7, but it does not build.
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 9951
  • Country: nz
Re: TFT display driver for Cortex M0?
« Reply #3 on: February 08, 2019, 10:31:44 pm »

Is this possibly as simple as including the .cpp and .h files into my main.c and then calling the routines or I’m guessing not quite so simple?

Looks to be pretty easy, there's not that much code there.
It's really just a basic SPI abstraction layer for the display on top of a the Arduino SPI abstraction layer.

You'll need to go through and replace any arduino calls with your own ones for your SPI peripheral .
eg.
    initSPI();
    startWrite();
    writeCommand();
    SPI_WRITE16();
    spiWrite();
    endWrite();

Most of those are simple hardware calls to the SPI peripheral.  Writing to the SPI peripheral is dead simple as you don't have to worry about buffering.

Ya might want to convert it from C++ to C as well, but maybe that's just me.
« Last Edit: February 08, 2019, 10:36:01 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf