Mobile Terminal Version 3 Up and (nearly) working

Getting a solder stencil really paid off as the new board came out of the oven cooked to perfection (well almost!)

Version 3 prototype power on

Prototype powered on with Wi-fi connection made.

So whats working?

Well the inspection showed a few pins of the TFT connector had bridged, however on closer inspection these were all ground lines and connected anyway (phew!)

The board powered up from the USB and immediately started charging the battery, all the voltages showed good including the 5V from the boost reg (once the enable pin was set correctly!), though there is a bit of ripple to investigate on the main 3.3V line.

After writing a very basic driver for the ILI9341,  I managed to display some text and boxes proving the basics are OK and the refresh rate using 8 bits was totally adequate for the job. (a screen fill is barely noticeable) The 8051 demo program from the east-rising site is too complex and inaccurate and while it will get you a basic display most of the initialisation code is for other devices, ignored by this driver and can be dumped, my very basic driver is

#define CMD 0
#define DATA 1
void TFTWrite(uint8 address, uint8 data)
{
 PMPSetAddress(address);
 PMPMasterWrite(data);
}
void TFTWake(void)
{
 TFTWrite(CMD,0x11); // Wake
 DelayMs(150);
 TFTWrite(CMD,0x29); // Display on
}
void TFTInit()
{
 uint8 i;
// TFT Parallel Master Port initialization
 mPMPOpen(PMP_ON | PMP_READ_WRITE_EN | PMP_CS2_CS1_OFF, PMP_DATA_BUS_8 | PMP_MODE_MASTER2 | PMP_WAIT_BEG_4 | PMP_WAIT_MID_15 | PMP_WAIT_END_4, 0x0001, PMP_INT_OFF);
DelayMs(30); // wait for >30ms
TFT_CS(OFF); // Issue a low to Chip select to enable TFT (not required if TFT CS pin hard-wired to 0V as it will be in later vers)
 DelayMs(5);
 TFT_RESET(OFF); // Issue a hard reset to TFT
 DelayMs(10);
 TFT_RESET(ON);
 DelayMs(120);
// ILI9341 TFT Startup sequence (Copied from example on EastRising web site, then eliminated most as ref sheet said did not do anything!)

 TFTWrite(CMD,0x36); // memory access ctrl
 TFTWrite(DATA,0x48);
 TFTWrite(CMD,0xb6); // displ fn control
 TFTWrite(DATA,0xa0);
 TFTWrite(DATA,0x82);
 TFTWrite(CMD,0xf2); // gamma fn disable
 TFTWrite(DATA,0x00);
 TFTWrite(CMD,0x3a); // pixel format set (16bit 65K colour, Page 65)
 TFTWrite(DATA,0x55);
 TFTWake();
}
void TFTSetPos(uint8 x0,uint16 y0,uint8 x1,uint16 y1) // Set row and column start and end ranges for image data following it to be written to
{
 TFTWrite(CMD,0x2A);
 TFTWrite(DATA,0);
 TFTWrite(DATA,x0);
 TFTWrite(DATA,0);
 TFTWrite(DATA,x1);
 TFTWrite(CMD,0x2b);
 TFTWrite(DATA,y0>>8);
 TFTWrite(DATA,y0);
 TFTWrite(DATA,y1>>8);
 TFTWrite(DATA,y1);
 TFTWrite(CMD,0x2C); //LCD_WriteCMD(GRAMWR);
}
void FillBox(uint16 x0,uint16 y0,uint16 x1,uint16 y1,uint16 FillColour)
{
 uint16 x,y;
 TFTSetPos(x0,y0,x1,y1);
 for(y=y0; y<=y1; y++)
 for(x=x0; x<=x1; x++)
 {
 TFTWrite(DATA,FillColour>>8);
 TFTWrite(DATA,FillColour);
 }
 TFTWrite(CMD,0x2C); //LCD_WriteCMD(GRAMWR);
}

The code above should be enough to display a few boxes on the screen using the main program below, you will need to add your own pic initialisation and a delay routine as specific for your pic chip

#define GREEN 0x0400
#define BLUE 0x001F

void main()
{
 uint32 i;
 char c;
 InitPic();
 TFTInit();
 FillBox(0,0,240,320,BLUE);
 FillBox(40,40,200,280,GREEN);
 while(1);
}

The WI-FI and Barcode UARTS Both worked, however not together and some re-jigging will be necessary. Basically the Peripheral Pin selection features on the PIC dont allow one of the pins to be active when the other one is (a real unlucky choice and one again I should have picked up before making a PCB)

Boot time to a welcome screen was instant (and I mean real instant not a second or two) the Wi-Fi acquired in just 2 seconds so I’m thinking it would almost be possible to use this 2 seconds from power up which would mean instead of setting low-power sleep modes I can basically shut it off completely and get ages of battery life, something to think about.

So whats bad?

The main problem is that the barcode connector is actually reversed, luckilly I noticed this as I was joining the barcode connector to the board, pin 1 on the connector actually goes to pin 12 on the barcode reader due to the nature of the flat flex connector. I’m sure a few professionals out there have hit this problem early on in their working with FFC/FPC and are having a little chuckle!

Secondly, the touch screen. After 3 hours of re-writing analog to digital conversion routines to try and see a signal from the touchscreen and cursing the PIC32 designers to hell, I finally got the scope out and realised the TFT did not actually have a touch-screen on it (dohhh!). Yes it had the pins and connections, but looking back on the web site I noticed the 6.99 touchscreen has a $1.00 option to add the touchscreen at the factory and I hadn’t checked the box when I ordered! I’m so used to capacitive touchscreens these days I just did not notice, oh well again easily rectified with a new order..

Thirdly there is no power switch, until I work out a way to put it all to sleep the system will constantly draw power until the battery is flat! Also to do with the power, I forgot the dual power option so that when it is powered from the USB the battery should be isolated while charging, another mosfet and a diode should take care of this.

Mechanics, oh dear!  Mounting the TFT where I did is not really good when it comes to assembling the item, and I now know why most designers mount the TFT on the reverse side of the PCB. In fact I’m re-thinking the case design totally and may mill out some acrylic board to see if I can improve it.

All of these should hopefully be rectified in the next version. But as I’ve got a mostly working version now I can take my time a bit on the version 4 board, however my trip to HK is planned for 10th Jan so I really need something before then to take with me.

This entry was posted in Mobile Terminal. Bookmark the permalink.