Thursday, January 7, 2010

My very own Linux ISP Programmer software!!

Last evening I was successful in flash programming a NXP P89V51RD2 microcontroller using an ISP Download software that I have written in C. It runs over a standard Serial port, without any extra hardware in between. It is very basic, like it erases only 1st two sectors of the block 0 of the flash and sometimes it gets stuck after getting into the ISP mode. But it WORKS (mostly)!!!

This was a result of about 5 days of serious but part-time programming effort. Having worked on Flash programming tools long back, it was much easier that what I had imagined it to be. In fact, the first assignment (at my first job) in Midas, I had to fix bugs in a software that created various formats of HEX files, like Intel and Motorola S formats. Incidentally Keil generate Intel HEX format. So, familiarity breeds quicker software development.

My primary motivation behind doing this software was to enable a student trainee of mine to work on Linux desktop for compilation and downloading of HEX files into the 8051 hardware kit she has to work on. She has a PIII system and its not too friendly with Windows XP (not sure why and didn't debug it too much). I decided that she should not spend any money (and big money) to buy a new PC only because FlashMagic is not available in Linux version.

But now I realize that this could also help lots of other 8051 learners and programmers who have only Linux PCs or wish that if the entire 8051 development cycle could be done on Linux desktops.

Today, we have the ASEM-51 Macro Assembler for assembling MCS-51 assembly code, an Open Source initiative. We also have Small Device C Compiler project that provides Open Source C cross compilers for several microcontroller architectures, including 8051, PIC 14 and PIC16. We also have MCU 8051 IDE, an integrated development enviroment for microcontrollers based on 8051, that supports assembly and C programming. So, the only software missing in the chain of fully Linux based software development (at least for NXP P89V51Rx2 series) was the ISP Download software. So, I decided to take up this as a personal initiative to provide this link in the chain. I am still wondering how the world missed out on creating such a product for Linux based developers.

My project will be open sourced soon. It still needs some work to convert into a generic and bug-free software. Also I need to add some features like reading the Device ID and Manufacturer ID. I have to try with the other microcontrollers in the P89V51 series. Add some standard timeouts to terminate the programming in case of failed ACKs. First release should be console based as I do not know any GUI programming at this point of time. Who knows maybe this work may lead me to learn GUI development. Maybe someone will design the GUI for this based on my work. Maybe others will add more microcontroller architectures to this software. There are no limits in Open Source!

Say, in about 2 months I should be releasing the initial version on SourceForge. I have enough (other) work on my hand at present and this initiative will remain as a part-time initiative.

www.rupamdas.com