FRDM-MCXN947 are compact, scalable development boards designed for rapid prototyping of MCX N94 MCUs. The board has several features built in and can also be easily expanded with off the shelf add-on boards from NXP and our ecosystem partner, making it a great platform for prototyping with MicroPython.
This document guides you through the initial steps of deploying and using MicroPython on this board. For more information on the FRDM-MCXN947 board, visit the FRDM Development Board for MCX N94/N54 MCUs web page. For additional information on MicroPython, visit the MicroPython web page.
The FRDM-MCXN947 has an onboard MCU-LINK debug probe. Used alongside the LinkServer utility, it can be used to upload MicroPython firmware to the board.
To run MicroPython applications on the board you need to first download the MicroPython interpreter application into the board. The MicroPython firmware will be available on MicroPython download page soon, but for now you can use the early build firmware.bin attached to this article.
Using a simple LinkServer command line operation we can flash the firmware image onto the board. To do this, open the command line at the LinkServer location (C:\Path\to\linkserver\folder) and run the command to flash the image:
LinkServer flash MCXN947:FRDM-MCXN947 load C:\Path\to\firmware\firmware.bin --addr 0
For the LinkServer flash command, two parameters are required - Device and Board. In our case, the device is named MCXN947 and the board is FRDM-MCXN947.
To display the list of supported devices, use the command:
LinkServer devices
To filter through the list, use the command with the filter attribute:
LinkServer devices --filter MC
If you dont see the FRDM-MCXN947 device on the list, update your LinkServer installation.
If the flashing operation fails, try performing a mass erase operation on the flash first, then repeat the programming operation:
LinkServer.exe flash MCXN947:FRDM-MCXN947 erase
LinkServer flash MCXN947:FRDM-MCXN947 load C:\Path\to\firmware\firmware.bin --addr 0
Once the image is flashed, MicroPython becomes available on the device. You can connect to the device using any serial terminal, such as the PuTTY app.
In the device manager, let's identify the port number.
In the PuTTY app, set the connection type to 'Serial', specify the correct number for the 'Serial Line', and set the speed to '115200'. After these configurations, you can click 'Open'.
The Putty apps opens a connection the MicroPython on the board, and we can communicate with the board through REPL.
This is the time to get some information or try some commands to communicate with the board. You can now write MicroPython code into the serial terminal:
There are many IDEs available for MicroPython. You can use Visual Studio Code with the RT-Thread extension to develop with MicroPython. Inside VS Code you can find the RT-thread Micropython extension and install it. This extension supports convenient connection mode (serial port, network, USB), REPL interactive environment. You dont want to have to type your application in each time to use it, and the extension provides not only language-aware editing, but also provides the ability to download your application.
If you want to use the MicroPython autocompletion feature, you need to have at least python 3 installed and VS code python extension. Close and reopen VS Code after installing to ensure all the changes to project in the environment are complete.
In the left corner new tools will appear in the navigation. First, we must create a MicroPython project within which all subsequent operations should run. We click on the rectangle icon with plus in it, then a prompt will open in the upper part of the screen.
We want to create a new MicroPython project and a blank one.
After that we are asked to name the project and fill in a path where the project is supposed to be saved.
In the lower left corner, select the plug button to connect to the device. We already have the device number from the Device Manager. Ensure that no other app is connected to the device (such as Putty from what we were doing earlier).
Make sure your VS Code terminal is PowerShell. A new prompt will appear with list of available devices. Choose the COM port for your board. Now that you are connected a terminal will open.
Now you can right click on the .py file to send it to the device, the result will be printed in the terminal.
Create a new file in the workspace.
Below there is some demo code for making the RGB LED blink; copy the code from bellow and paste into the new file, right click, and upload.
import machine
import utime
red_led = machine.Pin("P0_10", machine.Pin.OUT )
blue_led = machine.Pin("P0_27", machine.Pin.OUT )
green_led = machine.Pin("P1_2", machine.Pin.OUT )
i = 0
while True:
for i in range(8):
blue_led.value((i & ( 1 << 0 )) >> 0)
red_led.value((i & ( 1 << 2 )) >> 2)
green_led.value((i & ( 1 << 1 )) >> 1)
utime.sleep(1)
For your inspiration, there are attached also MicroPython scripts for PWM modulation, RGB led (led_pwm.py) and temperature reading from the onboard sensor (p3t1755.py).
Have fun, and let us know what you think!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.