This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zephyr + Argon (nRF52840) + UART with interrupts

Howdy,

I'm trying to get Zypher up and running with the Particle Argon board using the nRF52840 chipset. The goal is to get both Bluetooth and UART working, but for now the question is, "How do I enable UART0 with interrupts".

Background: I'm using using PlatformIO as the IDE, a J-Link for debugging / programming, and Zephyr as the RTOS. PlatformIO is configured and able to write and debug to the board. Zephyr has the call uart_callback_set that let's a user register a callback. However, the compiler report back: undefined reference to `uart_callback_set'. In the uart.h file, uart_callback_set relies on a #define called CONFIG_UART_ASYNC_API. After reading around, this should be unlockable through the project.conf file. I've configured mine based on the Zephyr docs and this post, though it is a different chipset. Here is the config file:

CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_EXCEPTION_STACK_TRACE=y
CONFIG_DEBUG_INFO=y

BOARD_ADAFRUIT_FEATHER_NRF52840=n

#UART Config
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=n
CONFIG_SERIAL_SUPPORT_ASYNC=y
CONFIG_SERIAL_SUPPORT_INTERRUPT=y

CONFIG_UART_ASYNC_API=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_0_INTERRUPT_DRIVEN=y
CONFIG_UART_0_NRFE_UART=y
CONFIG_UART_ASYNC_API=y
CONFIG_UART_NRF=y

Extra: I can find the device using the device tree label:

struct device *uart_device = device_get_binding("UART_0");

Edit 1 - uart_poll_out and uart_poll_in work, but pretty much none of the other uart_ calls will compile. Checked via a loop back wire and a logic analyzer.

Related