Tuesday, March 4, 2008

ARM7TDMI: RealView Compiler LCD and DELAY Headers

My Own LCD and Delay Headers
For the RealView Compiler for ARM


(Above: Usage Demonstrated on a NXP LPC2138 ARM7TDMI uC)


Keil's RealView Microcontroller Development Kit (a.k.a The RealView MDK) is a (Pardon the expression ;) ) really Phat piece of software. Considering the results from this Benchmark(PDF), Keil produces object code which is no less then 15% smaller and 10% faster then its closest competitor, It's a whopping 1.5 times better code generation then the GNU (think WinARM) compiler.

So whats wrong with it? (I mean, I'm sure that this post has got to have some meaning and conclusion right? Lol!) Well for starters the lack af a good library. Yes, It does contain all the ANSI/ISO - C libraries, and yes it contains a really kick-ass RTX-Kernel library, but it misses out on many simple libraries like the basic Character LCD library, the basic Delay libraries, and the simple things in life that we miss, like chocolate milk, and white roses, like the smell of dry leaves on green grass, the twitter of bir. . . . . . . . erm ....... you get the point.

So what did I do? I made a library for all to use. Well not strictly speaking. I took Martin Thomas's LCD Library for WinARM, fully dissected it, and remade it for the RealView MDK. This was no easy task, since the RealView MDK uses different notations for the same Registers (which is quite irritating, especially if you constantly need to move back and forth from the GNU compiler). Any ways, the task is done. The file is available for downloading, from this link, and thats that.

To test the headers, I used a LPC2138, you can see the Header board that I used below. I used a simple character LCD (the 162A variants).




You can modify the code to suit your hardware, when you make a project. I suppose you will not need to change anything but the following lines in LCD.h


Like this post? Leave a comment, it always makes my day. :)


Sunday, March 2, 2008

USB Bulk Transfer Device

In continuation of my previous post (USB-101), USB Human Interface Devices, have a disadvantage. HID devices have a maximum speed of 64Kb/s (or 512 KB/s) in each direction. Sounds like a lot? Not so much. Imagine building a USB based Scanner, or Image acquisition tool. A single image could be up to several hundred megs!! It could take several minutes (or hours :-O ) to transfer data.
But USB is supposed to be a high speed bus, right? Solution: Bulk Transfers. Bulk transfers utilize the full bus speed of USB. So transfer rates of 12MB/s in full speed devices (Like the 18f4550) or 480MB/s in high speed devices are possible.

I've included with this post a file Bulk_transfer_device.rar (298 KB) which contains the PIC's firmware (Once again using the CCS 'C' Compiler for PIC). Which uses Bulk mode transfers for the hardware we built before.

Now, do note one thing: This firmware is NOT an USB HID device, so you will need drivers for this device. USB Bulk transfer devices require writing of drivers (With the exception of Mass Storage Profille devices, which also use bulk transfer endpoints). I've included all the necessary files in the RAR archive, including the INF file, the project written in C#, and the DLL file. I've made some use of the JUNGO WinDriver library for the project files.



The pictures above explain how the device is detected and installed, it should be no problem for anyone who has installed a device on their PC before.