Hello,
I am starting working on a nRF9160DK board, but I am new to this and I am a bit lost.
Using the Dev Academy course and example, I was able to make a small project that sends data to a CoAP server on the push of a button.
I now need to setup a UART connection, in order to chat with an external sensor. Looking at documentation, the high level part seem pretty simple (configuration, callback, etc). However, I am stuck configuring the low level !
I want to keep uart0 for LOG/printk() and setup another UART (Rx and Tx only) to communicate with my external sensor, via the pin header.
I tried many things, but I am still unable to get my project to compile ...
Here is where I am at :
I've created an overlay file and added some code found in this forum.
&uart2{
status = "okay";
current-speed = <115200>;
tx-pin = <16>;
rx-pin = <17>;
rts-pin = <0xFFFFFFFF>;
cts-pin = <0xFFFFFFFF>;
};
In the main, I added:
const struct device *uart= DEVICE_DT_GET(DT_NODELABEL(uart2));
In prj.conf, I added:
CONFIG_SERIAL=y CONFIG_UART_ASYNC_API=y
Here is what I get when building
First, I get this warning. Compilation keeps going, but it seems that the examples I found are a bit old now...
-- Found devicetree overlay: c:/Users/axelc/Desktop/nRF9160/Mes_Applications/myApp/nrf9160dk_nrf9160_ns.overlay 'tx-pin' is marked as deprecated in 'properties:' in C:/ncs/v2.2.0/zephyr/dts/bindings\serial\nordic,nrf-uarte.yaml for node /soc/peripheral@40000000/uart@a000. 'rx-pin' is marked as deprecated in 'properties:' in C:/ncs/v2.2.0/zephyr/dts/bindings\serial\nordic,nrf-uarte.yaml for node /soc/peripheral@40000000/uart@a000. 'rts-pin' is marked as deprecated in 'properties:' in C:/ncs/v2.2.0/zephyr/dts/bindings\serial\nordic,nrf-uarte.yaml for node /soc/peripheral@40000000/uart@a000. 'cts-pin' is marked as deprecated in 'properties:' in C:/ncs/v2.2.0/zephyr/dts/bindings\serial\nordic,nrf-uarte.yaml for node /soc/peripheral@40000000/uart@a000.
Then, I get the following error
[59/143] Building C object zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj
FAILED: zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj
C:\ncs\toolchains\v2.2.0\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF9160_XXAA -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DUSE_PARTITION_MANAGER=1 -D_ANSI_SOURCE -D_FORTIFY_SOURCE=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -IC:/ncs/v2.2.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v2.2.0/zephyr/soc/arm/nordic_nrf/nrf91 -IC:/ncs/v2.2.0/zephyr/lib/libc/newlib/include -IC:/ncs/v2.2.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.2.0/zephyr/subsys/net/lib/coap/. -IC:/ncs/v2.2.0/zephyr/subsys/net/lib/sockets/. -IC:/ncs/v2.2.0/nrf/include -IC:/ncs/v2.2.0/nrf/lib/at_cmd_parser/include -IC:/ncs/v2.2.0/nrf/include/tfm -IC:/ncs/v2.2.0/nrf/tests/include -Itfm/generated/interface/include -IC:/ncs/v2.2.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.2.0/modules/hal/nordic/nrfx -IC:/ncs/v2.2.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.2.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.2.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.2.0/nrfxlib/nrf_modem/include -Itfm/install/interface/include -Imodules/nrfxlib/nrfxlib/nrf_security/src/include/generated -IC:/ncs/v2.2.0/nrfxlib/nrf_security/include -IC:/ncs/v2.2.0/nrfxlib/nrf_security/include/mbedtls -IC:/ncs/v2.2.0/mbedtls/include -IC:/ncs/v2.2.0/mbedtls/include/mbedtls -IC:/ncs/v2.2.0/mbedtls/include/psa -IC:/ncs/v2.2.0/mbedtls/library -IC:/ncs/v2.2.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -IC:/ncs/v2.2.0/nrfxlib/crypto/nrf_oberon/include -fno-strict-aliasing -Os -imacros C:/Users/axelc/Desktop/nRF9160/Mes_Applications/myApp/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=C:/ncs/toolchains/v2.2.0/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.2.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/Users/axelc/Desktop/nRF9160/Mes_Applications/myApp=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.2.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.2.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=c99 -MD -MT zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj -MF zephyr\drivers\serial\CMakeFiles\drivers__serial.dir\uart_nrfx_uarte.c.obj.d -o zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/uart_nrfx_uarte.c.obj -c C:/ncs/v2.2.0/zephyr/drivers/serial/uart_nrfx_uarte.c
In file included from C:\ncs\v2.2.0\zephyr\include\zephyr\toolchain.h:50,
from C:\ncs\v2.2.0\zephyr\include\zephyr\devicetree\zephyr.h:15,
from C:\ncs\v2.2.0\zephyr\include\zephyr\devicetree.h:3931,
from C:\ncs\v2.2.0\zephyr\include\zephyr\device.h:12,
from C:\ncs\v2.2.0\zephyr\include\zephyr\drivers\uart.h:26,
from C:\ncs\v2.2.0\zephyr\drivers\serial\uart_nrfx_uarte.c:11:
C:\ncs\v2.2.0\zephyr\include\zephyr\toolchain\gcc.h:77:36: error: static assertion failed: "/soc/peripheral@40000000/uart@a000 has legacy *-pin properties defined although PINCTRL is enabled"
77 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)
| ^~~~~~~~~~~~~~
c:\ncs\v2.2.0\zephyr\soc\arm\nordic_nrf\common\soc_nrf_common.h:229:9: note: in expansion of macro 'BUILD_ASSERT'
229 | BUILD_ASSERT(!IS_ENABLED(CONFIG_PINCTRL) || \
| ^~~~~~~~~~~~
C:\ncs\v2.2.0\zephyr\drivers\serial\uart_nrfx_uarte.c:2080:9: note: in expansion of macro 'NRF_DT_CHECK_PIN_ASSIGNMENTS'
2080 | NRF_DT_CHECK_PIN_ASSIGNMENTS(UARTE(idx), 1, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\ncs\v2.2.0\zephyr\drivers\serial\uart_nrfx_uarte.c:2193:1: note: in expansion of macro 'UART_NRF_UARTE_DEVICE'
2193 | UART_NRF_UARTE_DEVICE(2);
| ^~~~~~~~~~~~~~~~~~~~~
[60/143] Linking C static library zephyr\soc\arm\common\cortex_m\libsoc__arm__common__cortex_m.a
[61/143] Linking C static library zephyr\boards\boards\arm\nrf9160dk_nrf9160_ns\libboards__arm__nrf9160dk_nrf9160.a
[62/143] Linking C static library zephyr\libzephyr.a
[63/143] Building C object zephyr/drivers/pinctrl/CMakeFiles/drivers__pinctrl.dir/pinctrl_nrf.c.obj
[64/143] Linking C static library zephyr\drivers\timer\libdrivers__timer.a
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'c:\ncs\toolchains\v2.2.0\opt\bin\cmake.EXE' --build 'c:\Users\axelc\Desktop\nRF9160\Mes_Applications\myApp\build'
Could you please help me on solving this. I have the feeling that I am close to what I need, I just miss a small thing in the configuration.
Thanks.
