How do you feel about this article? Help us to provide better content for you.
Thank you! Your feedback has been received.
There was a problem submitting your feedback, please try again later.
What do you think of this article?
The previous episode of the FORTHdsPIC saga introduced version 0.5 with its new ability to work in an embedded ‘turnkey’ application. I thought I’d take a break from adding new functionality and try porting it across to a more mainstream platform – the Microchip MicroStick II . Production of a User Manual also seemed to be a good idea.
MicroStick II with a dsPIC33 Digital Signal Controller
The Microchip MicroStick is a tiny entry-level development board for dsPIC and PIC32 microcontrollers, specifically the 28-pin DIP package versions. Its two main advantages (apart from low cost) are that it plugs into a prototyping block and it has programmer/debug circuitry built in. Hence there is no need for a separate programmer like the PICkit 3. Porting FORTHdsPIC from the WIDE.HK Arduino-format board to the MicroStick is a fancy way of saying I made one or two minor changes before rebuilding the code with MPLAB IDE and Flashing the same chip in a new home. I decided to test the new setup using my trusty 4-servo walking robot I used last time.
FORTHdsPIC running in embedded mode on a MicroStick (Heath Robinson style)
Now the whole point of making FORTHdsPIC run compiled code from the non-volatile Flash memory is to allow its use with ‘embedded’, portable applications. This means batteries and no umbilical cables. Being essentially lazy I wanted to re-use as much of the existing hardware as possible, preferably with no soldering. The result is a rather Heath Robinson affair as can be seen from the photo.
The WIDE.HK board is used again along with the Parallax BoE shield for Arduino. The four PWM and Gnd signals are jumpered across from the prototyping block to the appropriate headers on the Parallax board once the MicroStick has been plugged in. The main problem is getting a 5 volt supply to the MicroStick as this normally comes via the USB connector. Fortunately the Arduino board underneath provides the answer. That board had its dsPIC chip removed and replaced in the MicroStick socket and was seemingly redundant. However the 7.5 volt battery pack plugs into it feeding Vin to its own 5 volt regulator and that on the Parallax board above. This results in 5 volts being available on the Arduino board’s USB-B connector. A couple of short USB adapter cables later, we have power on the MicroStick. There are even jumper links to isolate the unwanted USB signal lines from the USB-B socket. The Parallax regulator provides the servomotor power as before.
The modifications to the firmware are minimal; consisting largely of setting up the internal processor clock to replace the external crystal option and re-mapping UART1 signals from one side of the chip to the other. At this point I should say I did use another piece of hardware to provide the link to the terminal emulator on the host PC. The MicroStick provides access to UART1 via header pins. A UART to USB link cablecompleted the terminal link to the host PC, the one I chose being designed for the same purpose on a Raspberry Pi! Actually the UART-USB cable is probably not necessary because it should be possible to jumper across to the USB bridge circuit on the Arduino board and use a plain USB-B cable to the PC as before. The MicroStick can be powered by another USB cable to the PC. Neither cable is needed once the embedded program is installed in Flash memory.
Spot the development kit: microcontroller development on a budget
Finally, I did get around to writing a User Manual of sorts for FORTHdsPIC. I have attempted to show how the basic linked code operation works in FORTHdsPIC and how the dsPIC’s Program Space Visibility (PSV) mode is used to get around the problem of having separate Program and Data memory areas. This may seem a bit pretentious for what is just a bit of code tinkering, but I found being forced to explain how it all works has given me a clearer understanding of dSPIC hardware and software and that, as I said at the outset, is the whole point of the exercise.
If you're stuck for something to do, follow my posts on Twitter. I link to interesting new electronics components and development kits (some of them available from my employer!) and retweet posts I spot about robot, space exploration and other issues.