KB: Using DIO PIN to show TX and RX activity on RSL10

USE DIO PIN TO SHOW TX or RX ACTIVE

Sometimes we need know when TX/RX is active for some application (like coexistence with WIFI).
RSL10 can have this capability to show TX/RX activity by using DIO PINs.

Here is an example of how to use DIO1 to show TX activity, and DIO3 to show RX activity.
Let’s use the peripheral_server sample application for reference.

Step 1: Define DIO1 and DIO3 for output.

 Sys_DIO_Config(1, DIO_MODE_GPIO_OUT_0);
 Sys_DIO_Config(3, DIO_MODE_GPIO_OUT_0);

Step 2: Define delay for real TX and RX.

  *((uint32_t *)BB_COEXIFCNTL0_BASE) = 0x1100f3;
    BB_COEXIFCNTL2->RX_ANT_DELAY_BYTE = 0xf; //delay, give time before real RX
    BB_COEXIFCNTL2->TX_ANT_DELAY_BYTE = 0xf; //delay, give time before real TX

Step 3: Configure the interrupt for TX and RX active.

   // configure which condition will cause interrupt
    BBIF_COEX_INT_CFG->RESERVED0[0] = (BLE_TX_EVENT_TRANSITION | BLE_RX_EVENT_TRANSITION);
    //Enable interrupt
    NVIC_ClearPendingIRQ(BLE_COEX_RX_TX_IRQn);
    NVIC_EnableIRQ(BLE_COEX_RX_TX_IRQn);

Step 4: After running BLE_Initialization(), we could use BLE_COEX_RX_TX_IRQHandler() to show RX/TX activity by using DIO.

/* BBIF_COEX_INT_STATUS (0x40001414) = RF coexistence interrupt status register
 * Bit[0] = BLE_RX_EVENT_FLAG (Indicates if a BLE_RX_EVENT interrupt has been generated)
 * Bit[4] = BLE_TX_EVENT_FLAG (Indicates if a BLE_TX_EVENT interrupt has been generated)
 *
 * BBIF_COEX_STATUS (0x4000140C) = RF coexistence status register
 * Bit[0] = BLE_TX (Indicates if the BLE baseband core is busy and performs Tx activity, active high)
 * Bit[4] = BLE_RX (Indicates if the BLE baseband core is busy and performs Rx activity, active high)
 * */
void BLE_COEX_RX_TX_IRQHandler (void)
{
	volatile uint32_t temp = (*(uint32_t *)0x40001414);
	volatile uint32_t temp2 = (*(uint32_t *)0x4000140C);
	if(temp & 0x10)  // TX Event
	{
		if(temp2 & 0x10)   // Keep high when TX active
		{
			Sys_GPIO_Set_High(1);
		}

	    else
	    {
	    	Sys_GPIO_Set_Low(1); // Keep low when no TX active
	    }
	}
	else if(temp & 0x1)  //RX Event
	{
		if(temp2 & 0x1)
		{
			Sys_GPIO_Set_High(3); //High when RX active
		}
		else
		{
			Sys_GPIO_Set_Low(3); // Low when no TX active
		}
	}
}

To verify this, we can see that peripheral_server uses 40ms for the advertising interval in ble_std.h.

/* Advertising minimum interval - 40ms (64*0.625ms) */
#define APP_ADV_INT_MIN                 64
/* Advertising maximum interval - 40ms (64*0.625ms) */
#define APP_ADV_INT_MAX                 64

Now we can see this at DIO1 for TX and DIO3 for RX, and we can also see the advertising interval time.

2 Likes