Note: This KBA has been marked as deprecated. A more updated KBA can be found here:
This article shows how to configure the TX and RX activity indicators when using Bluetooth SDK 2.4.0 or later.
The TX and RX activity signals can be used to monitor the radio activity. Following screen capture from logic analyzer shows an example where Channel 0 is showing the RX activity and Channel 1 is showing TX activity.
The picture above shows one advertising event. The advertisement is transmitted on all three channels (three pulses in the TX indicator). After sending packet on one channel the receiver is active for short period of time so that possible connection or scan requests can be detected.
In SDK versions 2.3.x and earlier, there has been two alternative ways to configure the RX/TX indicator pins:
BGScript applications: using the <obssel> tag in hardware.xml file
<!-- Enable TX and RX indication pins --> <obssel rx_obs_pin="6" tx_obs_pin="7" />
C applications: using the radio_obs field in the gecko_configuration_t struct:
// gecko_configuration_t settings: .radio_obs.rx_pin=6, .radio_obs.tx_pin=7, .radio_obs.flags=0x1,
Both of these options are removed starting from BLE SDK 2.4.0. (BGScript support in general is removed starting from this version).
In projects built with SDK 2.4.0 or later, the RX/TX activity pins can still be configured in the user application. The files attached to the end of this article include functions to configure the TX and RX pins separately.
Example usage: you can use for example the SoC Empty template as starting point. Add the files obssel.h, obssel.c to the project. After the call to gecko_init() configure the TX and RX indicators to the desired pins (allowed range : port C, pins 6..11)
// needs to be added in the beginning of file: #include "obssel.h" .... /* Initialize stack */ gecko_init(&config); obssel_rx_setup(6); // map RX activity to PC6 obssel_tx_setup(7); // map TX activity to PC7
The header obssel.h includes some defines that depend on the target hardware. Make sure that you configure the code to match your target hardware:
//From obssel.h: /* uncomment one of the following defines, depending on your target device * * EFR32BG1: this setting is valid for BGMxxx modules and EFR32BG1 SoC designs * EFR32BG1X: valid for EFR32BG12, EFR32BG13 * */ #define EFR32BG1 // #define EFR32BG1X
There are callbacks to monitor radio activities?
There are no callbacks for (low level) BLE radio activities. There are events generated for high-level functions such as opening and closing of connection, but at lower levels (like connection events or advertising events) there are no callbacks.
I have 2 questions, first is about (allowed range : port C, pins 6..11): can be other pins used too?
I have a BRD4104A (with BRD4001A) and from schematic I think these are used for FLASH SPI and Si7021 I2C.
In efr32mg12 datasheet I see these alternate functionalities MODEM_DCLK #16, MODEM_DIN #15, MODEM_DOUT #14, MODEM_ANT0 #13 and MODEM_ANT1 #12. But in the code I see these definitions PRS_CH_CTRL_SIGSEL_RACTX=0x01 and PRS_CH_CTRL_SIGSEL_RACRX=0x02. Is there any relation between these (between PRS_CH_CTRL_SIGSEL_RACxx and any MODEM_xx)?
(allowed range : port C, pins 6..11): can be other pins used too?
the code example works only with port C, but basically you can map the signals to (almost) any available GPIO pin.
The TX and RX activity indicators are carried on top of the Peripheral Reflex System (PRS) (AN0025). In this example, we are using PRS channels 10 and 11.
If you look at the Alternative Functionality Overview table in EFR32BG1 datasheet (https://www.silabs.com/documents/login/data-sheets/efr32bg1-datasheet.pdf ), the PRS channels 10 and 11 can be routed only to PC6..PC11.
Therefore the limitation is due to the PRS channel selection. If you need to use some other pins, you can modify the code to use some different PRS channel. For example, in EFR32BG1 the channel 5 can be routed to PD10...PD15.
FYI: bgm13p is EFR32BG1X in obssel.h
Good point, the article was written before BGM13P was released.
In obssel.h :
#define EFR32BG1 // #define EFR32BG1X
EFR32BG1 is valid for: any EFR32BG1 soc, BGM111, BGM113, BGM121, BGM11S
EFR32BG1X is valid for: any EFR32xG12 or EFR32xG13 soc, BGM13P, BGM13S, MGM12P