FAQ: How to enable Antenna Diversity on the AXM0F343

Question
How can you use the Antenna Diversity feature using the AXM0F343 SoC?

Answer
The AX5043 Radio chip has two programmable GPIOs that are driven directly by the Radio`s state machine:

  • PWRAMP: normally used to drive the VDD line of a TCXO or external power amplifier.
  • ANTSEL: normally used to drive an RF switch connected to two antennas.

Due to the limited number of pins available in the QFN40 package of the AXM0F343, not all the pins of the AX5043 radio within the SoC are directly available for access. Instead, these signals are internally connected to the PORT_R of the AXM0F343 and can be made available on the PORT_B by properly configuring the crossbar.

Our examples code already program the redirect of the Radio’s PWRAMP from PR6 to PB2, where the TCXO’s VDD is connected.
Similarly ANTSEL can be redirected from PR7 to PB3.

Programming Steps
In order to enable the Antenna Diversity feature, the following three code modification must be implemented:

  1. in gpio.c, inside the function void GPIO_Axm0GevkBoardInit(void) set PB3 as an output with the following:
/* Configure state of PORT A to R: Input(0) or Output(1) */
   GPIO->OUT_EN = 	//....
(1 << PIN_PB3_Pos) | (0 << PIN_PB4_Pos) //Change 0 << PIN_PB3_Pos into 1
//...
  1. also inside void GPIO_Axm0GevkBoardInit(void) of gpio.c add the mirroring of the ANTSEL signal to PB3:
XBAR->PB_CFG_b.PB2 = 0x5; /* Forward RADIO_PWRAMP(PR6) to RADIO_VCC_TCXO(PB2) */ 
XBAR->PB_CFG_b.PB3 = 0x5; /* Forward RADIOANTSEL (PR7) to MCU`s GPIO (PB3) */ 
  1. In the config.c modify the default registers configurations to enable Antenna Diversity:
radio_write8(AX5043_REG_PINFUNCANTSEL	,  0x06);  //ANTSEL Output Diversity Antenna Select 
radio_write8(AX5043_REG_DIVERSITY	,  0x01);      //Antenna Diversity Enable
radio_write8(AX5043_REG_TMGRXPREAMBLE1	,  0x19);  //bit-time before switching antenna

Note: it is important to select a proper TMGRXPREAMBLE1 as this will define for how long the radio will be sniffing for a preamble on one antenna before jumping to the other antenna. This is shown by the highlighted state from Figure 13 of the AX5043 Programming Manual: