Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC32starter kit with LCD driver ILI9325 using PMP bus

Status
Not open for further replies.

pistole89

Junior Member level 3
Joined
Dec 9, 2010
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,570
Hallo Everyone,

Have you ever programmed using PMP address?
I want to control LCD driver ILI9325 using PIC32 starter kit.
It is controlled using 16 bit PMP bus
Here is the code:

#include <p32xxxx.h> /* PIC32 Main Library */
#include <plib.h> /* PIC32 Prepheral Lib */
#include <stdio.h>
#pragma config FPLLMUL = MUL_20, FPLLIDIV = DIV_2, FPLLODIV = DIV_1
#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_4,FWDTEN = OFF

#define SYS_FREQ (80000000L)
#define PBCLK (20000000L)
#define DESIRED_BAUDRATE (115200)
#define b(X) (1<<X)
#define LCD_RESET_OFF() LATGSET=b(15)
#define LCD_RESET_ON() LATGCLR=b(15)
#define LCD_CS_OFF() LATDSET=b(11)
#define LCD_CS_ON() LATDCLR=b(11)
#define LCD_DATA_ADDR 1
#define LCD_CMD_ADDR 0
#define LCD_CMD(X) PMPSetAddress(LCD_CMD_ADDR);while(mIsPMPBusy()); PMPMasterWrite(X);
#define LCD_DATA(X) PMPSetAddress(LCD_DATA_ADDR);while(mIsPMPBusy()); PMPMasterWrite(X);

void Delayms(unsigned t)
{
T1CON = 0x8000; //Enable TMR1, Tpb , 1:1
while(t--)
{
//t x 1mS loop
TMR1 = 0;
while(TMR1 < PBCLK/1000);
}
void lcd_io_config()
{
//Reset Init
LATGCLR=b(15);
TRISGCLR = b(15);

//Chip Select
LATDCLR =b(4)|b(5)|b(11);
TRISDCLR =b(4)|b(5)|b(11);
/*================*/
/* Reset Sequence */
/*================*/
//Engage Reset
Delayms(100);
//Release Reset
LATGSET=b(15);
Delayms(100);

/*==========*/
/* PMP Init */
/*==========*/
mPMPOpen(PMP_ON|PMP_READ_WRITE_EN/*|PMP_CS2_CS1_EN*/,
PMP_DATA_BUS_16|PMP_MODE_MASTER2/*|PMP_WAIT_BEG_4|PMP_WAIT_MID_15|PMP_WAIT_END_4*/,
PMP_PEN_0,
PMP_INT_OFF);
//the configuration is based on ILI9325 Application Note
LCD_CMD(0xE3); LCD_DATA(0x300;
LCD_CMD(0xE7); LCD_DATA(0x0012);
LCD_CMD(0xEF); LCD_DATA(0x1231);
LCD_CMD(0x01); LCD_DATA(0x0100);
LCD_CMD(0x02); LCD_DATA(0x0700);
LCD_CMD(0x03); LCD_DATA(0x1030);
LCD_CMD(0x04); LCD_DATA(0x0000);
LCD_CMD(0x0; LCD_DATA(0x0207);
LCD_CMD(0x09); LCD_DATA(0x0000);
LCD_CMD(0x0A); LCD_DATA(0x0000);
LCD_CMD(0x0C); LCD_DATA(0x0000);
LCD_CMD(0x0D); LCD_DATA(0x0000);
LCD_CMD(0x0F); LCD_DATA(0x0000);
LCD_CMD(0x10); LCD_DATA(0x0000);
LCD_CMD(0x11); LCD_DATA(0x0007);
LCD_CMD(0x12); LCD_DATA(0x0000);
LCD_CMD(0x13); LCD_DATA(0x0000);
Delayms(200);

LCD_CMD(0x10); LCD_DATA(0x1490);
LCD_CMD(0x11); LCD_DATA(0x0227);
Delayms(50);

LCD_CMD(0x12); LCD_DATA(0x001C);
Delayms(50);

LCD_CMD(0x13); LCD_DATA(0x1A00);
LCD_CMD(0x29); LCD_DATA(0x0025);
Delayms(50);

LCD_CMD(0x2B); LCD_DATA(0x000C);
Delayms(50);

LCD_CMD(0x20); LCD_DATA(0x0000);
LCD_CMD(0x21); LCD_DATA(0x0000);

LCD_CMD(0x30); LCD_DATA(0x0000);
LCD_CMD(0x31); LCD_DATA(0x0506);
LCD_CMD(0x32); LCD_DATA(0x0104);
LCD_CMD(0x35); LCD_DATA(0x0207);
LCD_CMD(0x36); LCD_DATA(0x000F);
LCD_CMD(0x37); LCD_DATA(0x0306);
LCD_CMD(0x3; LCD_DATA(0x0102);
LCD_CMD(0x39); LCD_DATA(0x0707);
LCD_CMD(0x3C); LCD_DATA(0x0702);
LCD_CMD(0x3D); LCD_DATA(0x1604);
// Delayms(80);
LCD_CMD(0x50); LCD_DATA(0x0000);
LCD_CMD(0x51); LCD_DATA(0x00EF);
LCD_CMD(0x52); LCD_DATA(0x0000);
LCD_CMD(0x53); LCD_DATA(0x013F);
LCD_CMD(0x60); LCD_DATA(0xA700);
LCD_CMD(0x61); LCD_DATA(0x0001);
LCD_CMD(0x6A); LCD_DATA(0x0000);
//Delayms(80);
LCD_CMD(0x80); LCD_DATA(0x0000);
LCD_CMD(0x81); LCD_DATA(0x0000);
LCD_CMD(0x82); LCD_DATA(0x0000);
LCD_CMD(0x83); LCD_DATA(0x0000);

LCD_CMD(0x84); LCD_DATA(0x0000);
LCD_CMD(0x85); LCD_DATA(0x0000);
//Delayms(80);
LCD_CMD(0x90); LCD_DATA(0x00010);
//Delayms(80);
LCD_CMD(0x92); LCD_DATA(0x0600);
//Delayms(80);
// LCD_CMD(0x93); LCD_DATA(0x0003);
//Delayms(80);
// LCD_CMD(0x95); LCD_DATA(0x0110);
//Delayms(80);
//LCD_CMD(0x97); LCD_DATA(0x0000);
//LCD_CMD(0x9; LCD_DATA(0x0000);
//Delayms(80);
LCD_CMD(0x07); LCD_DATA(0x0133);


}
void lcd_fulldisplay(unsigned short d1)
{
unsigned short i,j;
for(i=0;i<320;i++)
{
for(j=0;j<240;j++)
{
LCD_DATA(d1);
}
}
}
main()
{
/* Config Prefetch Cache */
SYSTEMConfig(SYS_FREQ, SYS_CFG_WAIT_STATES | SYS_CFG_PCACHE);

lcd_io_config();
while(1)
{
lcd_fulldisplay(0xF800);
Delayms(1000);
lcd_fulldisplay(0x07E0);
Delayms(1000);
lcd_fulldisplay(0x001F);
Delayms(1000);
lcd_fulldisplay(0xFFFF);
Delayms(1000);
lcd_fulldisplay(0x0000);
Delayms(1000);

}
}

I interface the PIC32 starter kit and ILI9325 like this (in between i connect 100Ohm resistor in series):

RE0-RE7 -> LCD_D0-LCD_D7 (PMP) Low
RG0 -> LCD_D8 (PMP) Low
RG1 -> LCD_D9 (PMP) Low
RF1 -> LCD_D10 (PMP) Low
RF0 -> LCD_D11 (PMP) Low
RD12 -> LCD_D12 (PMP) Low
RD13 -> LCD_D13 (PMP) Low
RD6 -> LCD_D14 (PMP) Low
RD7 -> LCD_D15 (PMP) Low

RB15 -> LCD_RS (PMP) Low [Config the Port Pin for Digital Operation]
RD4 -> LCD_WR (PMP) High
RD5 -> LCD_RD (PMP) High
RD11 -> LCD_CS o/p High

RG15 -> LCD_RESET o/p High

I am still a newbie in PMP bus.
In the program, I only want to fill the LCD with different data colour.
But It does not work. It is only blinking white and turn off again, according to my delay.
I am really frustated with this, and do not know which one is wrong.
Please, I need help or any suggestion..

Thanks
 

Hi,

Unfortunately, debugging display controllers can be one of the most challenging task, even if the device is sitting on your bench in front of you. Troubleshooting the device long distance can be daunting, to say the least. I have not had any experience with that particular controller. I'm in the middle of several projects at the moment, but I 'll try and download the datasheet and see if anything jumps out at me.

Out of curiousity, have you compiled the code with a debug or release build? Timing is often the culprit with these particular devices. What happens if you build it with debug and let it free wheel with the 'animate' debug option? Any difference in the display?

I'll let you know if I come across anything after I take a look at the datasheet. I'll also drop an email off to a couple of friends of mine that use various displays of this type in their designs; see if they have any suggestions.

Ciao

---------- Post added at 04:39 ---------- Previous post was at 04:09 ----------

Hi Again,

One item of note. The PMP should be set to 8080 interface during its initialization. I do not see this being done anywhere in the code provided. Also some of the delays seems very short between configuration messages. Double check your recommeded timing durations.

Ciao
 

P.S.

Do you have a copy of 32-bit-Peripheral-Library-Guide.pdf? If not see the attachment, oddly I can't find in on Microchip's website. It contains detailed initialization of the PMP using the library.
 

Attachments

  • 32-bit-Peripheral-Library-Guide.7z
    647.2 KB · Views: 117

Hallo

Thanks for your help,

Yes, I have the copy of it.
based on my debugging, LCD often does not show anything (LED was off). but sometimes it is blinking with white colour (because the backlight is white).
I still try to debug it, when the LCD show the blinking white.
It seem that it is blinking when It writes the data.

It is my initialization for my PMP bus:
mPMPOpen(PMP_ON|PMP_READ_WRITE_EN,
PMP_DATA_BUS_16|PMP_MODE_MASTER2,
PMP_PEN_0,
PMP_INT_OFF);

For the LCD configurationView attachment applicationILI9325.pdf
i used the configuration from ILI9325 application note including the delay itself.
I just write the same configuration on these application note
CPT 2.8” Initial Code
(my lcd is 2.8")

I will struggle to analyze from debug again, hope will get some clue.
 

Hallo everyone,

now my LCD could show some colour, but it is very bad,
The colour is spilt up incorrectly, I do not know why.
The program is still the same, but i only change my C32 compiler version from 1.1 into 1.05
I am still confused why it is happened, it could be something with my C32 library or the clock

I also attach the picture of my LCD.
If there are any update, I will tell you again.
I will really appreciate if there are some suggestions :D

Thanks
 

Attachments

  • photo(2).JPG
    photo(2).JPG
    305.9 KB · Views: 137
  • photo(4).JPG
    photo(4).JPG
    305.2 KB · Views: 132
  • photo(3).JPG
    photo(3).JPG
    289.9 KB · Views: 134

Well that is at least progress in the right direction. I still believe there could be a timing issue, which might account for the change when you switched compiler versions. I still waiting for a friend of mine to get back with me on his experiences with this controller. I let you know if he has anything to share.

Ciao
 

Well that is at least progress in the right direction. I still believe there could be a timing issue, which might account for the change when you switched compiler versions. I still waiting for a friend of mine to get back with me on his experiences with this controller. I let you know if he has anything to share.

Ciao

Hi pistole89,

I think you have succeed to Interface PIC32 with ILI9325 with PMP Interface ?

I am doing same project . Can you guide me for same ?

Thanks in advance ..


--
Karan
 

Yes ,

I have succeeded . But Speed is little bit slow .


Any Ways ... Thanks
--
Karan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top