Nuvoton NuMaker – Volcano – Getting Started – LED Blink

3,499 views

In this tutorial, we are going to Blink an LED using the “Nuvoton NuMaker-Volcano M0A23 microcontroller”. This is basically a step-by-step getting started guide for using Nuvoton Microcontrollers. But before we start let’s gathered some information about “NuMicro Microcontrollers” and why these are different from other companies’ microcontrollers.

This product is sponsored by Nuvoton and TECHDesign (https://bit.ly/3QSeEqV), Nuvoton is a microcontroller manufacturer based in Taiwan. Nuvoton is one of the suppliers in the TECHDesign marketplace.

TECHDesign’s marketplace (https://bit.ly/3K0iz2J) allows original manufacturers to manage their online stores themselves. Whether it’s a small quantity for testing or a larger purchase for mass production, all orders are processed and shipped directly by the manufacturers. You can directly place an order on TECHDesign, and the products will be directly shipped by Nuvoton to you.

NuMicro M0A23

Key Features

  • Small package: 2.5mm x 5mm
  • All-in-one programming function
  • IC can endure a high temperature of 125°C.

The NuMicro M0A23 series is a 32-bit microcontroller based on an Arm Cortex-M0 core. It provides a compact package with highly flexible digital pin function assignment, rich analog peripherals, -40 ℃ to 125 ℃ operating temperature, 2.4V ~ 5.5V operating voltage, and LIN interface for robust communication. The NuMicro M0A23 series targets robust and high operating temperature applications, such as 24 GHz mmWave radar, car lighting, electric window lifter, power seat, and intelligent power supply.

The NuMicro M0A23 series provide SSOP20 and TSSOP28 package with rich analog and digital functions, which are especially suitable for small form factor products. SSOP20 provides up to 18 IO pins and TSSOP28 provides up to 26 IO pins. Each IO pin of the M0A23 series can be arbitrarily assigned to digital peripherals, such as UART, SPI, and PWM. The M0A23 series provides rich analog functions including 17-ch 12-bit 500 KSPS ADC, 1 set of 5-bit DAC, and 2 sets of ACMP in both SSOP20 and TSSOP28 packages. Moreover, it provides a low voltage reset (LVR) and brown-out detector (BOD) to ensure system safety.

NuDeveloper Ecosystem

“Software and Tool”, which is also called the “NuDeveloper ecosystem”, provides developers with the environment to download resources needed for their projects. NuDeveloper Ecosystem—Make Engineers’ Job Easier.

You can buy NuMaker-Volcano from the following links below.

Hardware Required

You will require the following hardware

S.noComponentValueQty
1.NuMaker-Volcano1
2.Breadboard1
3.LED1
4.Resistor220 Ohm1
5.Jumper Wires

Getting Started Step-By-Step

Here is a complete video showing step-by-step how to upload an example code on NuMicro M0A23. Let’s discuss some important steps here

  • First download NuEclipse (GCC) from Nuvoton
  • After downloading extract & install NuEclipse IDE Software.
  • Here in the example, we use the Board Support Package (BSP) library
  • Download the extract and import it to NuEclipse Project
  • Copy the src folder from the extracted folder and paste it to the NuEclipse Library folder
  • After that. build and compile the code

LED Blink Circuit

Here blinking LED circuit is very simple Just connect the positive of an LED with a 100-ohm resistor. One end will be connected to PC0 and the ground is connected to the VSS of NuMicro M0A23.

Code

/******************************************************************************
 * @file     main.c
 * @version  V1.00
 * @brief    A project template for M0A23 MCU.
 *
 * SPDX-License-Identifier: Apache-2.0
 * @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#include <stdio.h>
#include "NuMicro.h"

void UART_Open(UART_T *uart, uint32_t u32baudrate);

void SYS_Init(void)
{
    /* Unlock protected registers */
    SYS_UnlockReg();

    /* Enable HIRC clock (Internal RC 48MHz) */
    CLK_EnableXtalRC(CLK_PWRCTL_HIRCEN_Msk);

    /* Wait for HIRC clock ready */
    CLK_WaitClockReady(CLK_STATUS_HIRCSTB_Msk);

    /* Select HCLK clock source as HIRC and HCLK source divider as 1 */
    CLK_SetHCLK(CLK_CLKSEL0_HCLKSEL_HIRC, CLK_CLKDIV0_HCLK(1));

    /* Enable UART0 clock */
    CLK_EnableModuleClock(UART0_MODULE);

    /* Switch UART0 clock source to HIRC */
    CLK_SetModuleClock(UART0_MODULE, CLK_CLKSEL1_UART0SEL_HIRC, CLK_CLKDIV0_UART0(1));

    /* Update System Core Clock */
    SystemCoreClockUpdate();

    /* Set PB multi-function pins for UART0 RXD=PB.6 and TXD=PB.4 */
    SYS->GPB_MFP1 = (SYS->GPB_MFP1 & ~(SYS_GPB_MFP1_PB4MFP_Msk | SYS_GPB_MFP1_PB6MFP_Msk)) |        \
                    (SYS_GPB_MFP1_PB4MFP_UART0_TXD | SYS_GPB_MFP1_PB6MFP_UART0_RXD);

    /* Lock protected registers */
    SYS_LockReg();
}

/*
 * This is a template project for M0A23 series MCU. Users could base on this project to create their
 * own application without worry about the IAR/Keil project settings.
 *
 * This template application uses external crystal as HCLK source and configures UART0 to print out
 * "Hello World", users may need to do extra system configuration based on their system design.
 */

int main()
{
    SYS_Init();

    /* Init UART0 to 115200-8n1 for print message */
    UART_Open(UART0, 115200);

    /* Connect UART to PC, and open a terminal tool to receive following message */
    printf("Hello World\n");
    GPIO_SetMode(PC,BIT0,GPIO_MODE_OUTPUT);

    /* Got no where to go, just loop forever */
    while(1){
    	PC0 = 1;
    	for(int i = 960000; i>0;i--);
        PC0 = 0;
        for(int i = 960000; i>0;i--);
    }
}

/*** (C) COPYRIGHT 2017 Nuvoton Technology Corp. ***/

=====================================================================================