The LPC810 is a microcontroller from NXP, an ARM Cortex M0+ based microcontroller.
NXP provide a dedicated IDE MCUXpresso which is based on Eclipse and is really easy to set up. The IDE is completely free but you need to register at their site in order tow download it.
NXP main site can be found at https://www.nxp.com/
The download page for the IDE is here.
Once the IDE is installed you can import the project. My version of the Simon code can be found here.
To import it click on import project(s) from file system in the bottom left.
This opens a dialogue box where you can select the zip file. Note you should import the Archive in the form of the .zip file directly.
Select the file, and click open.
You will now see the project. The only file you need to worry about is main.c in the src folder.
Vs the original version of this code I made some simple changes to implement the following refinements.
- on power up cycle through the lights / LEDs until the game is started.
- Pressing any button starts the game.
- When the game is ready to start it counts you in. Beep . . beep . . beeeeep. when you are ready to play.
- Making a mistake will make an error sound and the game will end taking you back to the start sequence.
The code is written is C, which is simple enough but it is compiled in to a .hex file which is then flashed to the micro controller.
Next we need to flash the hex file to the LPC810.
I purchased a PL2303-based USB to TTL Serial Cable.
In order to get my Mac to recognise this I had to install the drivers from http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=229&pcid=41
In order to test this was working correctly I performed a “loop back test”.
ls /dev/cu.* with the cable connected to my mac showed me the device was connected on cu.SLAB_USBtoUART
Running screen /dev/cu.SLAB_USBtoUART 115200 opens the serial console and if put a jumper between the white and green wires on the lead and them type something in the console you should see anything you type output back to you on the screen. Disconnect the two wires and nothing will appear in the console.
There are some fairly comprehensive tutorials online on how to write to the LPC810. I basically followed this tutorials at Adafruit here: https://learn.adafruit.com/getting-started-with-the-lpc810/programming-the-lpc810-with-flash-magic.
Firstly you need to wire up the board as below, using a 3.3v voltage regulator and a couple of 100nF capacitors.
The UART cable colors match the colors of Adafruit’s USB to TTL Serial Cable.
NOTE: At one stage I was using the power from my bench power supply, which I thought would fine. However for some reason this stopped me from writing to the chips consistently.
This tutorial suggests using lpc2isp for non Windows users and online resources suggest the mac version of Flash Magic does not support the LPC810 as a result of being a few versions behind the Windows version. However on my Mac I was able to use Flash Magic no problem at all.
This screen shot shows the settings I used.
I think i had to use a bit of trial and error to work out the mapping of the com port. However I subsequently discovered this forum post which would have speed up the process.
http://forum.flashmagictool.com/index.php?topic=4130.15
I also tried lpc21isp which worked fine. I used this command.
lpc21isp -wipe [path to .hex file] /dev/cu.SLAB_USBtoUART 115200 12
- Create a clone of “Simon” the classic electronic toy.
- Project approach, design, intended hardware / software.
- Electronics / Parts / Circuit Design
- Setting up the software
- Parts, prototype, PCB assembly.
- Case / Enclosure.
- Finished Simon Toy / Conclusion / What I would do differently next time.