Switching from TX to RX mode

Dear Nordic support service,

I am currently using nRF21540 with nRF52840 and nRF5_SDK_17.1.0.

I am able to transmit and receive, but I am not able to switch from RX to TX mode.

Checking the code, I see that when a TX is needed, the following routine is called:

ret_code_t nrf21540_tx_set(uint32_t user_trigger_event, nrf21540_execution_mode_t mode)

that  calls the routine:

static ret_code_t trx_set(nrf21540_trx_t dir, uint32_t trigger_event,
nrf21540_execution_mode_t mode)

that generates an error on this check:

// at the moment we are not able to switch direction on the fly.
// @todo switching between RXEN and TXEN.
NRF21540_ERROR_CHECK(device_state_get() == NRF21540_STATE_RX);

i.e. if the nRF21540 is in RX mode it can't switch on the fly to TX mode.

I wonder what is the correct way to handle the switch; if you e.g. have a link to a code snippet or to a related issue, it would be very useful.

I looked into the devzone but I was not able to find useful info.

Many thanks again for your help!

Best regards

Michele Sponchiado 

Related