Monday, April 14, 2014

Firmata for LPC812 is available now


pyFirmata and Firmata for LPC812

As mentioned in previous blog, I ported Firmata from Arduino to my LPC812MiniKit in order to instantiate MCU on board. 

I used pyFirmata as the starting point for my demo testing code. And it can be used a baseline for future desktop applications in Windows/Linux/OSX.


In microcontroller side, Firmata for LPC812's footprint is 9KB ROM and 1KB RAM, including serial driver, ring buffer management, printf, system timers, SCT, PWM and firmata protocol parsers.


Quick testing for analog channels

I have learnt a testing trick from Sparkfun, print analog bar in console. By this way, we can quick check analog channels such as PWM, ADC, DAC or sensor raw data. It works like a osilloscope, excepts vertial scanning.


SCT PWM library

During my development, I found some problemes and bugs. Among them, SCT based PWM takes longer time than my expectation. I have to say, NXP's SCT is a great and flexible pheripheral. And they have offered related tutorials and source code. However, they still have to do more. Otherwise, the great part will only popular in fans. They must make a library for SCT, or PWM on SCT. As least a PWM sweep demo. I know different applications demand different restrictions for PWM, including pulse frequencies, ration, dead zone, phases relationship. But please make it as a library, including source code.

SCT is great, is flexiable, can do this, do that. Do with my SCT drawing tool. We still need user friendly libraries, configured for popular 4xPWM, 2xPWM, RC5 codec, LED drivers. Yes, please do it. NXP.

Actually I ported mbed SCT/PWM library back to Keil's C library. It drives up to 4 channels PWM on 1KHz, which is good enough for LED strip and quad UAV.


It is a pity that LPC812 has no on board ADC. Although we can have external I2C/SPI ADC/DAC or using sensors with bus interface. SCT+COMP can made up a slow delta-sigma ADC, but if we need a decent ADC, we have to use LPC1114 or STM32F030.

After testing firmata firmware in LPC812 as well as pyFirmata application in desktop, now we can move to Android platform. Here we come. Keep tuned.


Bart Theeuwes said...

where can I download this?

1956Hellmut said...

Hi allankliu, For my purposes I need to have SystemModeler from Wolfram to communicate with LPCXpresso boards, I am starting this with the goal to have the LPCXpresso1769. SystemModeler from Wolfram claims to be able to communicate with any board that supports the Firmdata protocol. As you have experience, here my questions:
1. Can your port be ported to the LPCXpresso1769 and how could this be acomplished?
2. I learned from your contributions that you had to implement patches on both sides, the LPC-Board and the Pc side. What does it mean to interface to SystemModeler?