Super Dinky Blinky at Hackaday Supercon
We've made a very small contribution to the swag bag at Supercon 2019 in the form of our Super Dinky Blinky. On the surface, it's somewhat the antithesis of the usual swag, being little more than a super cheap microcontroller, a dome switch and some large pads.
It blinks LEDs, that's it's function in life.
Where it becomes interesting is in the microcontroller used, and some small work we've done to port the BSP to an open source compiler so that it can be used more easily.
Niko and Paul will be wandering Supercon 2019 toting a couple of USB programmers if anyone want to have a play and chat about the process.
Niko started the search for a 'house' budget MCU after the popularity of Jay Carlson's excellent post on sub-$1 microcontrollers and the buzz around 3-cent MCUs from EEVblog forums.
He chose the Nuvoton N76E003, which we're using on a bunch of our projects where minimal smarts and versatility are needed but there isn't really budget or need for anything so grand as an ARM Cortex. It's got a decent set of features, is under 20 cents and you can reprogram it.
This 8-bit 8051-based device has 6 PWM outputs and a 12-bit 8 channel ADC which can peak at about 500kSPS. It also has all the usual I2C, UART, and SPI peripherals that we know and love.
It also has 18kB of flash memory and 1kB of SRAM, which is pretty unbeatable in this price class.
Nuvoton were pretty friendly and open. The toolchain, not so much. Officially it supports only the Keil compiler, which costs around $2000 for a license. Realistically, only one person would have had the license in the company to use this to make binaries, but even if it was $50, it was a brake on freer use.
Niko thought it was worth at least trying to look at the Board Support Package, and see if it could be used with his compiler of choice, SDCC. You can find the results of that work on Github. It turned out to be pretty simple.
On how it is to code for the MCU and its quirks, Niko says:
"Programming wise the biggest thing is that the BSP includes a bunch of macros for common tasks, so you just open the big file of macros, choose a macro, and copy-paste the name of the macro into your C code.
It's a very low-level device. No complex libraries. No complex toolchains. No anything. All you get are these macros and some C to glue them together.
If you have done C programming before, the learning curve is shallow, as there is not a lot to go wrong in such a simple device."
You can find the firmware for the SDB and the makefile plus supporting files on our Github.
If anyone uses this stepping-stone to flash this MCU from other platforms such as Feather, Arduino, Raspberry Pi or Micro:bit (FARM), or otherwise make better use of this neat chip, we'd love to hear about it!
Have fun.