Adafruit tft 2.2" ili9340c and chipkit uc32 How can I make it work

Post Reply
Francois9999
Posts: 2
Joined: Mon Jul 25, 2016 5:11 pm

Adafruit tft 2.2" ili9340c and chipkit uc32 How can I make it work

Post by Francois9999 » Mon Jul 25, 2016 9:08 pm

Hello,

I have a program suited for Arduino Uno to use the tft screen from Adafruit. They give all you need to make it work. I was wondering if it was easy to transfer it to the chipkit uc32. Here is the link

https://www.adafruit.com/product/1480. They give the GFX and TFT library and the program graphictest in arduino uno Avr type of microcontroller. It work on the Arduino but when I try to transfer it on the chipkitUC32 there is error about the pins of the spi. I would like to make it work on that platform or the chipkitMax32 or chipkit WF.

I program the chipkit uc32 in the Arduino IDE with the chipkit core but I have those error. I would like to be able to use the same pins of the Arduino if possible. 13=sck, 12= miso, 11=mosi, 10=cs, 9=RST, 8=D/C and 4=SD/SC for the sd card.

I tried small program from Arduino to Chipkit and it was working fine but now I need to understand How to modify header I guess to make it work.

Sharon told me that Majenko did a display core for that and I downloaded the link but I don't know how to make it work together.

I have seen that Digilent made a library Dspi but I'm bugded and sometimes they put ifndef _pic32MX_ etc... I just don't know where they took it from maybe from the xc compiler from Microchip but it's all fuggy to me at the moment.

Can you help me, please !

Best Regards,

Francois

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Adafruit tft 2.2" ili9340c and chipkit uc32 How can I make it work

Post by majenko » Tue Jul 26, 2016 6:37 pm

The Adafruit ILI9340C TFT screen is the second screen I ever got back at the beginning of making the TFT library which later became DisplayCore - so I know it works, and works well.

You need three libraries:
Plus any other parts of DisplayCore you may want at a later date (Widget sets, Fonts, Icons, etc). Simplest to just install the entire lot.

Then it's very simple to get it going. This little program displays the value of "millis()" on the screen:

Code: Select all

#include <DisplayCore.h>
#include <DSPI.h>
#include <ILI9340.h>

DSPI0 spi;
ILI9340 tft(spi, 10, 8, 9);

void setup() {
	tft.initializeDevice();	
	tft.fillScreen(Color::Black);
	tft.setTextColor(Color::Red, Color::Black);
	tft.setFont(Fonts::Default);
}

void loop() {
	tft.setCursor(20, 20);
	tft.print(millis());
}
The three numbers in the tft constructor are the CS (10), D/C (8) and RES (9) pins. Connect:
  • GND -> GND
  • VIN -> 3.3V
  • D/C -> 8
  • RST -> 9
  • SDCS -> Not needed unless you want to use the SD card slot
  • CS -> 10
  • MOSI -> 11
  • MISO -> Not needed unless you want to use the SD card slot
  • SCK -> 13
  • BL -> Not needed unless you want to control the backlight.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Francois9999
Posts: 2
Joined: Mon Jul 25, 2016 5:11 pm

Re: Adafruit tft 2.2" ili9340c and chipkit uc32 How can I make it work

Post by Francois9999 » Tue Aug 02, 2016 10:44 pm

Hello,

Thank You for your reply.

I just don't know if I should use Arduino IDE with the integrated chipkit core or the MPIDE 023 or the pickit3 with mplabx to program it.

Is the bootloader will still be there? Where should I put those librarys. In the Arduino IDE Library or Chipkit core and where is the chipkit core library? I don't see it on my C drive even if I install it in Arduino IDE. I just don't know which one the compiler is going to use.

I tried to put all those library in the sketch of the Arduino IDE that it produce from your copy and paste code to the Arduino IDE and selecting chipKitUC32 and I have error when compiling. It's a bit messy on How to use the digilent chipkit card with Arduino IDE, MPIDE that they said that it was replace from the new Arduino IDE ( I have version 1.9 ) or should I use Mplabx and pickit 3 to program it. Thank You, Best Regards,

Francois

User avatar
majenko
Site Admin
Posts: 2164
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: Adafruit tft 2.2" ili9340c and chipkit uc32 How can I make it work

Post by majenko » Wed Aug 03, 2016 11:01 am

Using the Arduino IDE libraries go in the `libraries` folder in the Arduino folder in your documents.

Personally though I'd use UECIDE (of course) where you can install the DisplayCore libraries you need using the Plugin Manager. Much much simpler.

Stay away from using MPLAB-X and the PICkit3 unless you need to do hardware-level debugging. Using that you will eradicate the bootloader and break the board for using Arduino or UECIDE, until you have put the bootloader back in place.
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Post Reply