Lora-net/SWL2001

Relay tx and rx not setting antenna switch manually

Closed this issue · 1 comments

Hello,
I am working on a port of this code for the STM32WL in a RAK3172. I have noticed that the following Tx and Rx functions in the new relay code do not explicitly set the antenna direction with the smtc_modem_hal_set_ant_switch() call.

SMTC_MODEM_HAL_PANIC_ON_FAILURE( ral_set_tx( &( rp->radio->ral ) ) == RAL_STATUS_OK );

wor_ral_callback_start_tx
wor_ral_callback_start_rx

In general the lr1_stack_mac_layer handles the Tx cases as follows:
smtc_modem_hal_start_radio_tcxo( ); smtc_modem_hal_set_ant_switch( true ); SMTC_MODEM_HAL_PANIC_ON_FAILURE( ral_set_tx( &( rp->radio->ral ) ) == RAL_STATUS_OK );

In my testing if you break point at the ral_set_tx instances and inside the smtc_modem_hal_set_ant_switch you'll see that at least the very first Tx up during the join process will have the antenna in receive mode. Perhaps this is also the case in later transmits as well if there is a race condition between when the tx task is scheduled and when the antenna direction get set elsewhere.

Hi @disruptivedesign

This problem has been found by our team and it will be fixed in the next release.

Other functions are impacted ( wor_ral_callback_start_cad, relay_rxr_tx_launch_callback, wor_ral_callback_start_tx and wor_ral_callback_start_rx) by the same issue.

In the mean time, you can call smtc_modem_hal_set_ant_switch after the TCXO startup function to choose the antenna direction.