This is the project content:
The steps of the project are:
- Learn how to flash the board with DAPLink DONE
- Learn how to debug it with DAPLink DONE
- Flash Zephyr project into the board with blink LED DONE
- Flash and run arduino on Zephyr DONE
- Make I2S work on Zephyr
- Make I2S work on Zephyr arduino
Flashing using DAPLink
I bought a DAPLink long time ago and I wanted to try. And it works!
The steps I did was:
- Install pyocd
- Make sure that the permissions are right for the usb device
- Be able to discover it with
pyocd --list - Make the connections for
tck, tms, gndand3v3into the jtag connector. 3v3 into jtag_pwr. - Then run the next command
pyocd flash -t mimxrt1060 /home/lilo-ubuntu/Documents/MCUXpresso_25.6.136/workspace/evkbmimxrt1060_iled_blinky/Debug/evkbmimxrt1060_iled_blinky.axf -u 202108120001
Building and running zephyr blink example
I followed the guide on the official documentation. And add the next commands:
west build -p always -b mimxrt1060_evk/mimxrt1062/qspi samples/basic/blinky
west flash --runner pyocd
Running zephy blinky from other folder
Then I did the next:
mkdir -p ~/zephyr_apps
cp -r ~/zephyrproject/zephyr/samples/basic/blinky ~/zephyr_apps/my_blinky
cd zephyr_apps/my_blinky/
export ZEPHYR_BASE=~/zephyrproject/zephyr
west build -b mimxrt1060_evk/mimxrt1062/qspi
west flash --runner pyocd
Running zephyr Arduino core
I have done an example that works. I placed it in my folder. But basically is follow the documentation, and use the definitions from zephyrproject/zephyr/boards/nxp/mimxrt1060_evk/mimxrt1060_evk.dtsi
My overlay looks like:
#include <zephyr/dt-bindings/gpio/gpio.h>
#include <zephyr/dt-bindings/adc/adc.h>
/ {
zephyr,user {
digital-pin-gpios = <&arduino_header 6 0>, /* Digital 0 */
<&arduino_header 7 0>,
<&arduino_header 8 0>,
<&arduino_header 9 0>,
<&arduino_header 10 0>, /* Digital 4 - use default mapping */
<&arduino_header 11 0>,
<&arduino_header 12 0>,
<&arduino_header 13 0>,
<&arduino_header 14 0>,
<&arduino_header 15 0>,
<&arduino_header 16 0>, /* Digital 10 */
<&arduino_header 17 0>,
<&arduino_header 18 0>,
<&gpio1 8 GPIO_ACTIVE_HIGH>, /* Digital 13 - Built-in LED (GPIO1.8) */
<&arduino_header 0 0>, /* Analog A0 */
<&arduino_header 1 0>, /* Analog A1 */
<&arduino_header 2 0>, /* Analog A2 */
<&arduino_header 3 0>, /* Analog A3 */
<&arduino_header 4 0>, /* Analog A4 */
<&arduino_header 5 0>; /* Analog A5 */
pwm-pin-gpios = <&arduino_header 9 0>,
<&arduino_header 11 0>,
<&arduino_header 12 0>,
<&arduino_header 15 0>,
<&arduino_header 16 0>,
<&arduino_header 17 0>;
adc-pin-gpios = <&arduino_header 0 0>,
<&arduino_header 1 0>,
<&arduino_header 2 0>,
<&arduino_header 3 0>,
<&arduino_header 4 0>,
<&arduino_header 5 0>;
io-channels = <&adc1 0>,
<&adc1 1>,
<&adc1 2>,
<&adc1 3>,
<&adc1 4>,
<&adc1 5>;
};
};
/* Enable ADC for analog pins */
&adc1 {
status = "okay";
pinctrl-0 = <&pinmux_adc1>;
pinctrl-names = "default";
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
zephyr,input-positive = <0>;
};
channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
zephyr,input-positive = <1>;
};
channel@2 {
reg = <2>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
zephyr,input-positive = <2>;
};
channel@3 {
reg = <3>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
zephyr,input-positive = <3>;
};
channel@4 {
reg = <4>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
zephyr,input-positive = <4>;
};
channel@5 {
reg = <5>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
zephyr,input-positive = <5>;
};
cmake_minimum_required(VERSION 3.20)
# Add this line to tell Zephyr where the Arduino module is
list(APPEND ZEPHYR_EXTRA_MODULES $ENV{HOME}/zephyrproject/modules/lib/arduino-core-zephyr)
# Add the device tree overlay for Arduino support
set(DTC_OVERLAY_FILE "mimxrt1060_evk_arduino.overlay")
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(arduino_blinky)
target_sources(app PRIVATE arduino_sketch.cpp)