NuttX has support to SAMD21 MCU and this is the MCU used on Arduino M0. Then I decided to add board support to Arduino M0 on NuttX mainline.
I used the Wemos SAMD21 M0 (a compatible Arduino M0 board), but you can use the original Arduino M0 or even the RobotDyn SAMD21 M0 board.
Enter inside NuttX directory, clear it and configure to use the arduino-m0:
$ cd nuttx
$ make distclean
$ ./tools/configure.sh arduino-m0:nsh
Detected arm Architecture
Detected samd2l2 Chip
After compilation, confirm the binary was generated:
$ ls -l nuttx.bin
-rwxr-xr-x 1 alan alan 43436 set 22 13:13 nuttx.bin
Connect J-Link to SWD (EDBG) pin header and run and flash the firmware:
$ sudo JLinkExe -device ATSAML21G18 -if SWD SEGGER J-Link Commander V6.46h (Compiled Jun 28 2019 17:19:57) DLL version V6.46h, compiled Jun 28 2019 17:19:50
Connecting to J-Link via USB…O.K. Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46 Hardware version: V8.00 S/N: 26800XXXX License(s): FlashBP, GDB OEM: SEGGER-EDU VTref=3.306V
Type "connect" to establish a target connection, '?' for help J-Link>connect Specify target interface speed [kHz]. : 4000 kHz Speed>4000 Device "ATSAML21G18" selected.
Connecting to target via SWD InitTarget() Found SW-DP with ID 0x0BC11477 Scanning AP map to find all available APs AP: Stopped AP scan as end of AP map has been reached AP: AHB-AP (IDR: 0x04770031) Iterating through AP map to find AHB-AP to use AP: Core found AP: AHB-AP ROM base: 0x41003000 CPUID register: 0x410CC601. Implementer code: 0x41 (ARM) Found Cortex-M0 r0p1, Little endian. FPUnit: 4 code (BP) slots and 0 literal slots CoreSight components: ROMTbl @ 41003000 ROMTbl: E00FF000, CID: B105100D, PID: 000BB4C0 ROM Table ROMTbl @ E00FF000 ROMTbl: E000E000, CID: B105E00D, PID: 000BB008 SCS ROMTbl: E0001000, CID: B105E00D, PID: 000BB00A DWT ROMTbl: E0002000, CID: B105E00D, PID: 000BB00B FPB ROMTbl: 41006000, CID: B105900D, PID: 001BB932 MTB-M0+ Cortex-M0 identified.
J-Link>loadbin nuttx.bin 0
Now use a USB/Serial and connect the RXD to RXD pad of the board and TXD to TXD pad. Configure the minicom to use 115200 8n1 and after reseting the board you should get:
NuttShell (NSH) nsh>
2 thoughts on “Running NuttX on Arduino M0”
Very nice. Certainly makes for a more useful Arduino M0 board.
Olá Alan, seria possivel uma ajuda com este problema.
Desculpe-me fazer este contato aqui no seu blog. Porem como no forum oficial não obitve resposta.
Estou tenetando entender o problema.
Desde já agradeço.