This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Custom 802.15.4 implementation using NCS

Hello all,

I am trying to on implement a custom 802.15.4 implementation (not thread nor zigbee) from the nrfxlib 802.15.4 radio driver in NCS. The goal is to run it in multiprotocol mode with BLE. I however can't get it to work at all, nor can I find any sample using only 802.15.4 (but the phy test, which I don't understand).

Is there any guide in how to enable the 802.15.4 radio driver, or any smaller sample?

I have tried to implement a simple hello world, but as soon as I enable the CONFIG_NRF_802154_RADIO_DRIVER=y in prj.conf I get runtime assertions. 

My main.c (note that I'm not even using any nrf_802154_ functionality):

#include <zephyr.h>
#include <logging/log.h>

// #include <nrf_802154.h>

LOG_MODULE_REGISTER(app);


void main(void)
{
	printk("Hello world\n");
}

This is my prj.conf. Note that it works if I uncomment CONFIG_NRF_802154_ symbols.

CONFIG_ASSERT=y

CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_SERIAL=y
CONFIG_GPIO=y

# Make sure printk is not printing to the UART console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_MAIN_THREAD_PRIORITY=7

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

CONFIG_NRFX_TEMP=y
CONFIG_NRFX_POWER=y
CONFIG_NRFX_RNG=y
CONFIG_XOROSHIRO_RANDOM_GENERATOR=y
CONFIG_NRFX_TIMER2=y
CONFIG_NRF_802154_RADIO_DRIVER=y
# CONFIG_NRF_802154_RADIO_CONFIG=y
CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2
CONFIG_NRF_802154_TEMPERATURE_UPDATE_PERIOD=10000
CONFIG_NRF_802154_ENCRYPTION=n


# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Enable nRF ECB driver
CONFIG_CRYPTO=y
CONFIG_CRYPTO_NRF_ECB=y
CONFIG_CRYPTO_INIT_PRIORITY=80

# Cryptocell is not supported through CSPRNG driver API: NCSDK-4813
CONFIG_ENTROPY_CC3XX=n

# Networking
CONFIG_NET_IPV6_MLD=n
CONFIG_NET_IPV6_NBR_CACHE=n
CONFIG_NET_IPV6_RA_RDNSS=n
CONFIG_NET_IP_ADDR_CHECK=n
CONFIG_NET_UDP=n

The runtime error I get:

ASSERTION FAIL @ WEST_TOPDIR/nrfxlib/nrf_802154/driver/src/nrf_802154_request_swi.c:228
E: r0/a1:  0x00000004  r1/a2:  0x000000e4  r2/a3:  0x00000001
E: r3/a4:  0xe000e117 r12/ip:  0x00000000 r14/lr:  0x0000c949
E:  xpsr:  0x41000000
E: Faulting instruction address (r15/pc): 0x0000bf2a
E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
E: Current thread: 0x20000948 (unknown)

Or, if I instead use the exact prj.conf from 802.15.4 phy test:

ASSERTION FAIL [nrf_802154_irq_is_enabled(SWI3_EGU3_IRQn)] @ WEST_TOPDIR/nrfxlib/nrf_802154/driver/src/nrf_802154_request_swi.c:228

What am I missing? Do I need to enable any more kconfig symbols? Where can I read about which?

I'm running the project on a nRF52840DK, using NCS 1.7.0 in VS code.

  • Hi

    Have you checked out the nRFConnect SDK(NCS) documentation on multiprotocol support and the Multi-protocol Service Layer library?

    The runtime error you're seeing seems to be an assert due to the SWI interrupt being disabled, so you have to enable it to be able  enable the nRF802.15.4 IRQ.

    Best regards,

    Simon

  • Thanks for your reply,

    The SWI interrupt seems reasonable to require. How do I enable it?

    Yes I have seen those documentation pages. But to implement multiprotocol I first need a working 802.15.4, or am I wrong? They are also not too descriptive on what I need to enable to get them working. The multiprotocol support says they work on Thread and Zigbee also, which I'm not interested in this case, but I'm unsure if it works on bare 802.15.4 too.

    Kind regards,

  • Hi

    What platform files are you using? The nrfxlib or the ones from zephyr/modules/hal_nordic? Do you call the nrf_802154_init in your application? It should be called by the IEEE_802154 shim layer in Zephyr, and is enabled when using Zephyr's 802.15.4 driver. Otherwise you need to call it manually.

    Best regards,

    Simon

  • I think that was the issue, I hadn't specified that (or used the wrong one).

    Now I set these symbols, and it works.

    CONFIG_NRF_802154_RADIO_DRIVER=y
    CONFIG_NRF_802154_SOURCE_HAL_NORDIC=y

    Now it's the MPSL I need to fix. Thanks for your help.

  • Glad to hear that. Could you please create a new ticket on the MPSL issue, as we try to keep each ticket to one subject to make it easier for users looking for answers in the future to browse DevZone.

    Best regards,

    Simon

Related