Page 1
The information described in this document is the exclusive intellectual property of Nuvoton Technology Corporation and shall not be reproduced without permission from Nuvoton. Nuvoton is providing this document only for reference purposes of NuMicro microcontroller based system design. Nuvoton assumes no responsibility for errors or omissions.
NuMaker Accel Class .................... 28 Gyro Class ..................... 28 Mag Class ....................28 Summary ..................29 Revision History .................. 30 Mar 29, 2019 Page 3 of 31 Rev 1.00...
NuMaker OVERVIEW ® NuMicroPy is the port of MicroPython to Nuvoton NuMicro family microcontrollers (MCUs). The MicroPython project aims to put an implementation of Python 3.x on the microcontrollers and small embedded systems. Refer to Table 1-1 for NuMicroPy support status.
NuMaker NUMICROPY INTRODUCTION The MicroPython divides the code into two parts, python interpreter firmware (firmware.bin) and the user’s python code. The firmware must be burned into the MCU first. After boot, the firmware executes the user’s python code. The execution of the python code supports the REPL mode and/or performs the python code from storage.
NuMaker force the firmware into USB mass storage mode and then write your python code to these files. Table 2-1 shows the default embedded Flash partition status. Embedded Firmware Firmware Data Data Flash Size Partition Start Partition Size Partition Partition Address Start Size...
NuMaker utime Time related functions uzlib zlib decompression _thread Multithreading support network Network configuration uctypes Access binary data in a structured way Machine Functions related to the hardware ucryptolib Cryptographic ciphers Table 2-2 Default Supported Modules I/O Class Description M487...
NuMaker Gyro Gyroscope control (Bosch BMX055) Only for NuMaker-IOT- M487 Magnetometer control (Bosch BMX055) Only for NuMaker-IOT- M487 Table 2-3 Default Supported I/O Classes Mar 29, 2019 Page 8 of 31 Rev 1.00...
MCU and how to update your python code. Nuvoton Nu-Link Driver Download and Install Please visit the Nuvoton software download website to download “Nu-Link_Command_Tool” file. When the Nu-Link command tool has been downloaded successfully, please unzip the file and execute the “NuMicro NuLink Command Tool.exe” to install the driver.
NuMaker Figure 3-3 Serial Port Setup Burn Firmware The Nu-Link-Me exports a MBED disk, just Copy and Paste your firmware.bin into MBED disk (Figure 3-4). After firmware burning, you can see MicroPython prompt on your terminal screen as Figure 2-1. You can get prebuilt firmware from NuMicroPy repository Figure 3-4 Copy and Paste Firmware...
NuMaker Python Code Update Steps Connect USB1.1 to PC Press the SW2 and RESET button at the same time. The firmware will export a PYBFLASH disk (Figure 3-5). Update your python code to boot.py or main.py (Figure 3-6). Press the RESET button (Figure 3-7). Figure 3-5 PYBFLASH Disk Figure 3-6 Write Switch Button Example Code Mar 29, 2019...
NuMaker HOW TO CUSTOMIZE MICROPYTHON FIRMWARE The development of MicroPython firmware is in the Unix-like environment. The description below uses Ubuntu 16.04. Packages Requirement The following packages will need to be installed before you can compile and run MicroPython. build-essential ...
NuMaker // Python internal features #define MICROPY_ENABLE_GC #define MICROPY_READER_VFS #define MICROPY_HELPER_REPL Enable/Disable I/O Class The MicroPython defines I/O classes in pyb and machine modules. User can modify mpconfigboard.h to enable/disable I/O classes or modify the pin definitions for individual I/O class. The I/O class support is disabled if the definition of I/O pin is deleted.
NuMaker I/O CLASS QUICK REFERENCE The MicroPython provides the document to describe how to access MCU’s I/O by python language, and, has description to introduce how to add a module written in C. This document ® only provides the NuMicro MCU’s I/O quick reference for you reference.
NuMaker LEDR LEDY LEDG Table 5-1 Board Pin Name and CPU Pin Name Mapping from import p_d0 = Pin(Pin.board.D0, Pin.OUT) # create output pin on GPIO B2 p_d0.value(1) # set pin to on/high p_d1 = Pin(Pin.board.D1, Pin.IN) # create input pin on GPIO B3 print(p_d1.value()) # get value, 0 or 1 Pin.board.D2.af_list()
NuMaker Pin.ALT_OPEN_DRAIN – configure the pin for alternate function, open-drain pull can be one of: Pin.PULL_NONE – no pull up or down resistors Pin.PULL_UP – enable the pull-up resistor Pin.PULL – enable the pull-down resister ...
NuMaker SPI0_MISO SPI0_MOSI SPI3_NSS SPI3_SCK SPI3_MISO SPI3_MOSI Table 5-3 SPI Support List from import # construct an SPI bus on the SPI0 # mode is Master # polarity is the idle state of SCK # phase=0 means sample on the first edge of SCK, phase=1 means the second spi = SPI(0, SPI.MASTER, baudrate=100000, polarity=1, phase=0) spi.read(10) # read 10 bytes on MISO...
NuMaker from import i2c = I2C(1, I2C.MASTER) # create and initiate I2C1 as a master i2c.scan() # scan for slaves on the bus, returning a list of valid addresses. Only valid when in master mode. i2c.is_ready(0x42) # check if slave 0x42 is ready i2c.send('123', 0x42) # send 3 bytes to slave with address 0x42 data = bytearray(3)
NuMaker uart.deinit() # turn off the UART bus UART(bus, buadrate, [bits=8, parity=None, stop=1, timeout=2000, flow=0, timeout_char=0, read_buf_len=64]) baudrate is the clock rate. bits is the number of bits per character, 5, 6, 7 or 8. parity is the parity, None, 0(even) or 1(odd). ...
NuMaker baudrate is the clock rate can.setfilter(id=0, fifo=0, mask=0) id is the identifier of the frame that will be received. fifo is the FIFO number, from 0 to 31. mask is the identifier mask used for a acceptance filtering. can.recv(fifo=0, list=None, timeout=5000) ...
NuMaker LED Class The LED object controls an individual LED. Table 5-7 is LED support list by the board. Board LED Name Board Pin Name CPU Pin Name NuMaker_PFM_M487 led0 LEDR led1 LEDY led2 LEDG Table 5-7 LED Support List from import led = LED('led0')
NuMaker tim.callback(tick) # set the function to be called when the timer triggers # configure timer to be a PWM, output compare, or input capture channel chan = tim.channel(Timer.PWM, pin = Pin.board.D0, pulse_width_percent = 20) chan.callback(tick) # set the function to be called when the timer channel triggers chan.capture() # get the capture associated with a input capture channel chan.compare(100)
NuMaker WDT Class from import wdt = WDT(timeout = 1000) # start watchdog timer wdt.feed() # reset watchdog timer counter WDT(timeout=5000) timeout specifies the time-out interval and the interval is 2~ 26000ms Accel Class from import Accel a = Accel(range = Accel.RANGE_4G) # create and return an accelerometer object ax = a.x() # get x axis value...
NuMaker SUMMARY The MicroPython is a Python programming language interpreter that runs on the small embedded system. With MicroPython you can write clean and simple Python code to control hardware instead of having to use complex low-level languages like C or C++. The MicroPython is only a programming language interpreter and does not include an IDE, but you can write code in your desired text editor and then use Copy and Paste (file access) to upload and run the code on a board.
NuMaker REVISION HISTORY Date Revision Description 2019.03.29 1.00 Initially issued. Mar 29, 2019 Page 30 of 31 Rev 1.00...
Page 31
NuMaker Important Notice Nuvoton Products are neither intended nor warranted for usage in systems or equipment, any malfunction or failure of which may cause loss of human life, bodily injury or severe property damage. Such applications are deemed, “Insecure Usage”.
Need help?
Do you have a question about the NuMicro Series and is the answer not in the manual?
Questions and answers