Mini51 a Cortex-M0 from Nuvoton

On this post we analyse some characteristics of the low-power Mini51 microcontrollers, which instead of their name suggests, are 32-bit Cortex-M0 machines manufactured by Chinese Nuvoton.

For those who don’t know, the Cortex-M0 are the simplest Cortex microcontroller line from ARM. The Cortex line is divided into three major families: Cortex-A (high performance microprocessors focused on mobile market (smartphones and tablets), Cortex-R (high performance microprocessors and microcontrollers focused on real-time applications) and Cortex-M (general microcontrollers focused on lower complexity applications).

On the Cortex-M product line, ARM has 5 sub-lines: Cortex-M0, Cortex-M0+, Cortex-M1, Cortex-M3 and Cortex-M4. Generally speaking, the Cortex-M0 are the lower performance devices, with lower cost, focused on simpler applications and can compete head-to-head with 8, 16 and 32-bit low end microcontrollers. On the other hand, the Cortex-M4 line presents higher performance devices which include fancy features such as digital signal processing (DSP) instructions.

The Cortex-M0 is a 32-bit microcontroller with a 56-instruction set (RISC) compatible with ARMv6-M architecture where most instructions are 16-bit large with a few 32-bits large instructions (note this is only regarding the instruction size, not the operand size). The Cortex-M0 can manipulate 8, 16 and 32-bit data in an extremely efficient way (that is not the case for ARM7 CPUs).

Other interesting features of the M0 line are: NVIC vectored interrupt controller with priorities and tail-chaining (a system that reduces interrupt latency by servicing other pending interrupts before returning to the main application, thus avoiding unnecessary register stacking and unstacking), high code density (considerably better when compared to ARM7s), integrated single-wire debugger (SWD), hardware multiplier, among others.

Document DDI0432 presents the Cortex-M0 major features (pdf version here). Document DUI0497 presents details of the Cortex-M0 CPU, the instruction set and programming model (pdf version here ).


On this article we analyse the kit we received from Nuvoton’s local distributor Infinity Informática ( It comprises a Nuvoton’s MINI54LAN microcontroller packed with 16KiB of flash memory, 2KiB of RAM, 30 I/O pins, 2 32-bit timers, UART, SPI, I2C, 2 analog comparators and one 8-channel 10-bit ADC, all packed in a 48-pin LQFP plastic package. The MINI51 product line also includes devices with 4 and 8KiB of flash.

Linha Mini51

Nuvoton’s lineup also includes higher capacity devices (up to 128KiB of flash and 16KiB of RAM), higher pin-count (up to 100 pins) and more peripherals (USE interface, 12-bit ADC, RTC, DMA, etc.). The complete product line can be found here.

The Mini54 is a small (LQFP 48-pin) and cheap (around US$ 1,70 for 250 units, according to Infinity) microcontroller, but can deal with small and average complexity applications.

Some of Mini51LAN’s major features are:

  • 16 Kib of code flash memory;
  • 2 Kib of boot flash memory (LDROM);
  • 2 Kib of RAM;
  • 30 I/O pins (capable of sinking 24mA and drain 16mA per pin);
  • Internal 22.1184MHz oscillator (1% accuracy at 25 Celsius degrees on 5V), the oscillator can also operate with an external crystal (4 to 24MHz, or 32,768Hz), and also an auxiliary 10kHz oscillator sourcing the watchdog and auto wake-up modules;
  • Two 32-bit timers (24-bit counting plus 8-bit prescaler) with pulse capture, compare and PWM and a periodic timer integrated to the CPU core (24-bit SysTick);
  • Three 2-channel PWM (6 channels);
  • UART with a 16-byte FIFO supporting IrDA and 485;
  • SPI (up to 12MHz master or 4MHz slave);
  • multimaster I2C with up to 4 addresses per mask;
  • Two analog comparators with programmable 16-level internal reference;
  • 10-bit 8-channel SAR ADC with 150ksps maximum sampling rate;
  • Low-voltage detector with programmagle threshold and interrupt/reset generation.
Mini51 Kit

The kit includes a serial LCD display (SPI) with a resolution of 128×64 pixels, led backlighting (controlled by P5.4 pin). There is also a DB9 serial connector for the UART, a 24LC64 I2C serial EEPROM, 8 green leds, an RGB led (wired to PWMs 0, 1 and 2), a buzzer (wired to PWM3), two switches (reset and a user switch wired to P3.2/INT0), a trimpot (wired to AN0) and a NTC (wired to AN1). Four 12-pin headers allow accessing to all MCU pins and another 16-pin header allows connecting the 8 leds to the MCU. There are also 4 debugger status leds.

A mini DVD is included. It has lots of documents but, as usual for chinese manufactures, it is somewhat confusing with lots of untranslated (chinese) text. The DVD also includes IAR and Keil IDEs. I opted out for IAR as I am very familiar with their IDEs and compilers (in this case EWARM 6.21).

Along with compiler installing, it is also necessary to install the debugger driver (the debugger is embedded into the kit PCB) and it is named NU-Link. The installation includes examples and board support package (BSP) available on the “BSP Library” folder. The BSP includes the CMSIS (Cortex Microcontroller Software Interface Standard) library which is an ARM standardized API for Cortex microcontrollers.

Finally, we can make some quick modifications to the SMPL_LCD example, changing the code to toogle LED0 each time the switch connected to INT pin is pressed (it also changes backlight intensity). We also changed the text presented on the LCD.

The modified code is shown below. The complete project can be downloaded HERE.

void EINT0Callback(void)
  if(g_level_change==4) g_level_change = 0;
  else g_level_change++;
  _PORT_DOUT (3, 1) = !_PORT_DOUT (3,1); // toggles LED0

int main(void)
  print_lcd(0, " Hello World!");
  print_lcd(1, " Nuvoton");
  print_lcd(2, "Testing Mini51!");
  DrvGPIO_Open (E_PORT3, E_PIN1, E_IO_OUTPUT);    // P3.1 as an output

Leave a Reply