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 

Parents
  • Hi Michele,

    The driver does not supprot switching between Tx and Rx (neither way), so I believe you need to ower down first before switching state.

    One thing, though. The supportt for the nRF21540 in the nRF5 SDK is very limited (it can for instance not be used with Bluetooth). So if possible, I would consider the nRF Connect SDK (for this an other reasons).

    Best regards,

    Einar

Reply
  • Hi Michele,

    The driver does not supprot switching between Tx and Rx (neither way), so I believe you need to ower down first before switching state.

    One thing, though. The supportt for the nRF21540 in the nRF5 SDK is very limited (it can for instance not be used with Bluetooth). So if possible, I would consider the nRF Connect SDK (for this an other reasons).

    Best regards,

    Einar

Children
Related