Thursday, July 15, 2010

Microchip Application Library: GOL trouble

In a previous article I discussed the PIC32 Multi Media Board (MMB) from Mikroelektronika. Looking around a bit on the web searching for PIC32 related projects I came across the PIC32 Audio spectrum analyzer project by Andrei Mehiläinen. He used a PIC32MX360F512L on a TechToys PIC24 evaluation board (PIC24-Eval-Board, this board supports 100-pin PIC24 & PIC32) with an additional 320x240 TFT display board with resistive touchscreen and an SSD1928 graphics driver. Andrei’s system is very close to the MMB, the main differences are the processor (the MMB has a 460F512L), the graphics chip (an HX8347D on the MMB) and the way the pins are used. I therefore decided to port Andrei’s code to the MMB. This would be a good summer holiday project (being a nerd I always take a development system to the beach). This summer was going to be dedicated to PIC32 projects.

Studying Andrei’s code I soon felt the urge to improve it a bit, especially the user interface as Andrei’s system didn’t really have one. I first started drawing a grid based on MMB example code and then became serious about it by deciding to develop some generic user interface for measurement systems in the style of modern oscilloscopes. So I downloaded and installed the latest Microchip Applications Library (MAL) (v2010-04-28). Having never used them before, I also watched the web seminar about the GUI architecture of the graphics library. In the help files I found a tutorial explaining how to start a new graphics project and off I went.

In the beginning all went well, but when I wanted to add the library C-source files to the project I discovered that I was apparently not doing things the right way as the project would only accept assembler files. So I started all over again but this time using MPLAB’s Project Wizard and now I could go all the way up to trying to build the project. This is where things started to go really wrong: the tutorial code would not compile at all. Of course this was to be expected as the tutorial is for a PIC24 on an Explorer 16 board (yes it is, read the last sentence of the tutorial) and I had modified it a bit to use with a third party PIC32 board.

The first step to glory would be to get the Hardware Profile right. That was easy enough as I used one from the MMB example code. As mentioned before the MMB has an HX8347D (note the D) graphics chip and the Microchip library seems to support it (it knows the A and D version). It won’t compile however as brackets are missing all over the place (DeviceSelect/DeviceDeselect). Clearly this part of the graphics library was not tested properly before releasing it. I fixed this, but only to find out that I was now missing a definition somewhere and compilation would therefore still not complete. Comparing the new library to the (working) one that came with the MMB I noticed that the new library had some changes that required a definition that has something to do with GFX(E)PMP (now what is that again?). There are two possibilities that I tried both, and both gave me other (but different) errors. This is where I gave up (for the moment, I will continue since my holidays aren’t over yet).

Microchip has put a lot of effort in developing their Applications Library, but it is a shame that I am to dumb to use it. It would have been nice if they would have tested it better and if they had provided a working tutorial. Now I have wasted lots of time without getting anywhere. I now know the ins and outs of the graphics driver selection and other low-level GOL details, but I still haven’t been able to draw a single button. Surely it is all very easy, but why didn’t they explain it a bit better? Or maybe it only works properly on Microchip evaluation boards?

At the time of writing I have not figured it out yet, so if you know what I am doing wrong, please let me know. Also, if you happen to know where the API description is that is mentioned in the web seminar, drop me a line.

1 comment:

  1. Hi,

    On this website there's an explanation on how to use the microchip GOL with the mikroe MMB:

    I also tried this with success. As you said yourself it aint that hard to get it going once you know the way.