chipKIT® Development Platform

Inspired by Arduino™

MikroMedia and MPIDE

Created Sat, 07 Jun 2014 00:54:51 +0000 by pklimchuk


Sat, 07 Jun 2014 00:54:51 +0000

I have a Mikromedia for Pic32 board I am trying to get working with MPIDE.
It is essentially a PIC32MX460F512L connected to a (I think) an ILI9341 320x240 display with touchscreen. It uses the Parallel Master port of the PIC for this display.

I have used UTFT in the past with one of these displays that was an SPI interface, so believe I could modify that code to work with this display (it already has the init sequence and code for drawing different fonts) if I could only figure out how to configure the PMP port and send data through it.

Can anyone here provide me a little help with this?

Appreciated , thanks!


Sat, 07 Jun 2014 08:41:41 +0000

You need my TFT library:


It has ILI9340 support which can be copied and adjusted to ILI9341 support simply enough (you have the init sequence and setxy code which are the important ones - they may be the same as the 9340), but most importantly it has PMP support built in.

Oh, and it's far far more advanced than UTFT.


Mon, 09 Jun 2014 21:13:33 +0000

I downloaded the library you sent. I opened up the 2 examples but they appear to be for SPI

So I took the ILI9340 primitives example and changed it as follows:


#include <DSPI.h>
#include <TFT.h>

#define ILI_CS   10
#define ILI_DC           8

// Configure the display
DSPI0 spi;
TFTDSPI mySpi(&spi, ILI_CS, ILI_DC);
ILI9340 tft(&mySpi);

void setup() {
        tft.setTextColor(Color::White, Color::Black);  


#include <DSPI.h>
#include <TFT.h>

#define ILI_CS   10
#define ILI_DC           8

// Configure the display


ILI9340 tft(&pmp);
//ILI9340 tft(&mySpi);

void setup() {
        tft.setTextColor(Color::White, Color::Black);  

No Dice, but I'm still working on it..

Just wanted to thank you for your help, I know it's going to work in the end, and be better than what I had. I just need to read through what you've sent.


Mon, 09 Jun 2014 22:27:26 +0000

You're certainly heading the right way. It could be that you'll need to modify the TFTPMP driver if the display is using other addresses than 0/1 for the data and control registers.


Tue, 10 Jun 2014 01:12:20 +0000

OK, so far I think I need to change the control pins in your code to match what I think the mikroelectronica board uses, and maybe some other stuff like the PMP config.

This is what I've found from their forums:

// TFT module connections
char TFT_DataPort at LATE;
sbit TFT_RST at LATC1_bit;
sbit TFT_BLED at LATD2_bit;
sbit TFT_RS at LATB15_bit;
sbit TFT_CS at LATF12_bit;
sbit TFT_RD at LATD5_bit;
sbit TFT_WR at LATD4_bit;
char TFT_DataPort_Direction at TRISE;
sbit TFT_RST_Direction at TRISC1_bit;
sbit TFT_BLED_Direction at TRISD2_bit;
sbit TFT_RS_Direction at TRISB15_bit;
sbit TFT_CS_Direction at TRISF12_bit;
sbit TFT_RD_Direction at TRISD5_bit;
sbit TFT_WR_Direction at TRISD4_bit;
// End TFT module connections

Now I think I need to go into TFTPMP.cpp and change it there..

and then :

void Init_MCU() {
  PMMODE = 0;
  PMAEN  = 0;
  PMCON  = 0;  // WRSP: Write Strobe Polarity bit
  PMMODEbits.MODE = 2;     // Master 2
  PMMODEbits.WAITB = 0;
  PMMODEbits.WAITM = 1;
  PMMODEbits.WAITE = 0;
  PMMODEbits.MODE16 = 1;   // 16 bit mode
  PMCONbits.CSF = 0;
  PMCONbits.PTRDEN = 1;
  PMCONbits.PTWREN = 1;
  PMCONbits.PMPEN = 1;

Sound about right?


Tue, 10 Jun 2014 01:36:01 +0000

I don't see anywhere to define what pin is which for CS,RST,RS,RD,WR etc. To use the PMP, do they HAVE to be connected to certain pins? and then do you have to set some config registers to tell it which?

I open TFTPMP.CPP and Im having a hard time understanding it. I see another file called TFTPMP.CPP.Mine and it almost looks like the same thing ? (I think only PMMODEbits.WAITE = 0; was different.)

I'm going to throw in the towel for the night..


Tue, 10 Jun 2014 10:45:59 +0000

If they have used the PMP properly then yes, the RD/WR etc have to be on specific pins as the PMP subsystem itself handles them. If they haven't used it properly, and they're manually manipulating the IO lines, then you're on your own.

If you look on the pinout for the '460L chip you can see the PMRD/PMWR etc pins labelled - RD4 and RD5, so that looks correct going by that listing. The RS pin is supposedly RB15. That is the same as PMA0 which is good - so that means that it's PMP addresses 0 and 1, which is what I would expect. CS they have as RF12. RF12 is nothing special (doubles with a UART CTS pin), so you will have to manually drive that LOW to enable the TFT.

And don't forget to turn on the backlight (RD2 / OC3) or you'll never see anything ;)