Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nrf fromlist] drivers: ieee802154: fix nRF5 Rx error handling #1455

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion drivers/ieee802154/ieee802154_nrf5.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ static int nrf5_init(const struct device *dev)

nrf5_get_capabilities_at_boot();

nrf5_radio->rx_on_when_idle = true;
nrf5_radio_cfg->irq_config_func(dev);

k_thread_create(&nrf5_radio->rx_thread, nrf5_radio->rx_stack,
Expand Down Expand Up @@ -1003,6 +1004,7 @@ static int nrf5_configure(const struct device *dev,

case IEEE802154_CONFIG_RX_ON_WHEN_IDLE:
nrf_802154_rx_on_when_idle_set(config->rx_on_when_idle);
nrf5_data.rx_on_when_idle = config->rx_on_when_idle;
break;

default:
Expand Down Expand Up @@ -1083,7 +1085,13 @@ void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id)

#if defined(CONFIG_IEEE802154_CSL_ENDPOINT)
if (id == DRX_SLOT_RX && error == NRF_802154_RX_ERROR_DELAYED_TIMEOUT) {
return;
if (!nrf5_data.rx_on_when_idle) {
/* Transition to RxOff done automatically by the driver */
return;
} else if (nrf5_data.event_handler) {
/* Notify the higher layer to allow it to transition if needed */
nrf5_data.event_handler(dev, IEEE802154_EVENT_RX_OFF, NULL);
}
}
#else
ARG_UNUSED(id);
Expand Down
3 changes: 3 additions & 0 deletions drivers/ieee802154/ieee802154_nrf5.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ struct nrf5_802154_data {
/* The last configured value of CSL phase time in nanoseconds. */
net_time_t csl_rx_time;
#endif /* CONFIG_NRF_802154_SER_HOST && CONFIG_IEEE802154_CSL_ENDPOINT */

/* Indicates if RxOnWhenIdle mode is enabled. */
bool rx_on_when_idle;
};

#endif /* ZEPHYR_DRIVERS_IEEE802154_IEEE802154_NRF5_H_ */