Preparing S32K344 Evaluation Board for Zephyr Installation
The following hardware setup is required for installing and running a Zephyr sample on the NXP S32K344 Evaluation Board:
The serial console is provided through “lpuart2” on the 7-pin DCD-LZ debug connector “P6”:
Connector | Pin | Pin Function |
P6.2 | PTA9 | LPUART2_TX |
P6.3 | PTA8 | LPUART2_RX |
The SEGGER J-Link is connected to the P26 connector (this is a 10 pin 0.50” space JTAG with the standard pinout used by standard Arm debuggers). Ensure pin 1 on the PCB silkscreen is aligned with pin 1 on the debugger (refer to the picture above).
The Ethernet connection to the local network using the RDDRONE-T1ADAPT Ethernet media converter connected to the P9 100Base-T1 Ethernet Connector.
The power is to be supplied at the 5 pin P27 connector at the top left corner of the board (Pin 1-2 power, Pin 3 NC, Pin 4-5 ground). The input voltage range is from 5V to 40V.
Building Zephyr for S32K344 Evaluation Board
Zephyr samples can be built as described in the Zephyr Project documentation:
https://docs.zephyrproject.org/latest/develop/getting_started/index.html
For example, use the following command to build the hello_world
sample for the S32K344 Evaluation Board:
cd zephyr west build -p always -b mr_canhubk3 samples/hello_world
Installing Zephyr on S32K344 Evaluation Board
If the J-Link probe is directly connected to the build machine then the “west flash
" command can be used to flash the sample as described in the Zephyr Project documentation:
https://docs.zephyrproject.org/latest/develop/getting_started/index.html
However, it is not always convenient to use the same PC for building and flashing. It is actually enough to install the J-Link software
https://www.segger.com/downloads/jlink/
on the host PC to be able to Flash the boards over the J-Link probe. After installing the J-Link software, verify that the J-Link probe is detected by the SEGGER J-Link Commander and identifies the MCU successfully:
$ JLinkExe -nogui 1 -if swd -speed auto -device S32K344 SEGGER J-Link Commander V7.92c (Compiled Aug 30 2023 14:58:04) DLL version V7.92c, compiled Aug 30 2023 14:57:42 Connecting to J-Link via USB...O.K. ... J-Link>connect ... Cortex-M7 identified. J-Link>
Create the J-Link Commander script for flashing Zephyr onto the S32K344 Evaluation Board:
$ cat runner.jlink ExitOnError 1 r loadfile "zephyr.hex" r g writeDP 1 0 readDP 1 q $
Put the build/zephyr/zephyr.hex
file into the current directory and run the following command:
$ JLinkExe -nogui 1 -if swd -speed auto \ > -device S32K344 -CommanderScript runner.jlink ... Downloading file [zephyr.hex]... Comparing flash [100%] Done. Erasing flash [100%] Done. Programming flash [100%] Done. J-Link: Flash download: Bank 0 @ 0x00400000: 1 range affected (57344 bytes) J-Link: Flash download: Total: 0.661s (Prepare: 0.082s, Compare: 0.055s, Erase: 0.032s, Program & Verify: 0.442s, Restore: 0.049s) J-Link: Flash download: Program & Verify speed: 126 KB/s O.K. ... Script processing completed. $
As soon as a Zephyr image is flashed, it can be started by resetting the board using the reset button or the “reset/go
" command sequence of the J-Link Commander:
$ JLinkExe -nogui 1 -if swd -speed auto -device S32K344 ... J-Link>connect ... J-Link>reset ... J-Link>go J-Link>
Now you can connect to the target serial console using a terminal program on your Linux PC, for example:
$ picocom -b 115200 /dev/ttyUSB0 ... Type [C-a] [C-h] to see available commands Terminal ready
Depending on the installed Zephyr application, you will see some output on the serial console after reset. The Zephyr banner is usually printed:
*** Booting Zephyr OS build emcraft-ef041c6-2-gdaa341a973af ***
Controlling S32K344 Evaluation Board LEDs from the NAVQ+ Kit
Emcraft provides the simple Zephyr demo (emcraft/app/led_network_control
) that allows to control the board LEDs from the NAVQ+ kit over the local network.
Before building the demo, choose a static IP address for your target board and configure the demo appropriately, for example:
$ grep CONFIG_NET_CONFIG_MY_IPV4_ADDR emcraft/app/led_network_control/prj.conf CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.0.111" $
Build the
led_network_control
sample for the S32K344 Evaluation Board:cd zephyr west build -p always -b mr_canhubk3 emcraft/app/led_network_control
Install the demo on the target board as described above. If you connect to the target serial console, you will see the following output after reset:
*** Booting Zephyr OS build emcraft-ef041c6-2-gdaa341a973af *** user_led1_green: ready user_led1_blue: ready user_led1_red: ready Single-threaded TCP server waits for a connection on address 192.168.0.111 port 4242...
From the NAVQ+ console, connect to the target board using
telnet
:$ telnet 192.168.0.111 4242 Trying 192.168.0.111... Connected to 192.168.0.111. Escape character is '^]'. list: print supported LEDs <LED> on: turn on the specified LED <LED> off: turn off the specified LED
Type “
list
" to see the available LEDs on the target board:list user_led1_green user_led1_blue user_led1_red
Turn
user_led1_green
on and off:user_led1_green on OK user_led1_green off OK