I am curious if the nRF52840 has the ability to assert a gpio when the BLE transmission is active?
Try this; let me know if it works as I haven't tested it yet. Choose any one of the events, or multiple events if you have spare io pins and spare PPI channels. Edit: I changed to use Set/Clear, was originally using toggle
#define PIN_RADIO_TEST 26 // Any spare pin eg P0.26
#define RADIO_GPIOTE_CH 0
#define BLAH_BLAH_PPI_CH_SET 0
#define BLAH_BLAH_PPI_CH_CLEAR 1
// Up to three tasks can be used in each GPIOTE channel for performing write operations to a pin, two
// are fixed (SET and CLR), and one (OUT) configurable to perform Set, Clear or Toggle
// - "HiToLo" Task mode: Clear pin from OUT[n] task
NRF_GPIOTE->CONFIG[RADIO_GPIOTE_CH] = GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos |
GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos |
PIN_RADIO_TEST << GPIOTE_CONFIG_PSEL_Pos |
GPIOTE_CONFIG_OUTINIT_Low << GPIOTE_CONFIG_OUTINIT_Pos;
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_READY; // RADIO has ramped up and is ready to be started
NRF_PPI->CH[BLAH_BLAH_PPI_CH_SET ].EEP = (uint32_t)&NRF_RADIO->EVENTS_ADDRESS; // Address sent or received
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_PAYLOAD; // Packet payload sent or received
NRF_PPI->CH[BLAH_BLAH_PPI_CH_CLEAR].EEP = (uint32_t)&NRF_RADIO->EVENTS_END; // Packet sent or received
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_DISABLED; // RADIO has been disabled
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_DEVMATCH; // A device address match occurred on the last received packet
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_DEVMISS; // No device address match occurred on the last received packet
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_RSSIEND; // Sampling of receive signal strength complete.
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_BCMATCH; // Bit counter reached bit count value.
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_CRCOK; // Packet received with CRC ok
// NRF_PPI->CH[BLAH_BLAH_PPI_CH .EEP = (uint32_t)&NRF_RADIO->EVENTS_CRCERROR; // Packet received with CRC error
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[MOTOR_GPIOTE_CH];
NRF_PPI->CHENSET = ((1UL << BLAH_BLAH_PPI_CH_SET) | (1UL << BLAH_BLAH_PPI_CH_CLEAR));Try this; let me know if it works as I haven't tested it yet. Choose any one of the events, or multiple events if you have spare io pins and spare PPI channels. Edit: I changed to use Set/Clear, was originally using toggle
#define PIN_RADIO_TEST 26 // Any spare pin eg P0.26
#define RADIO_GPIOTE_CH 0
#define BLAH_BLAH_PPI_CH_SET 0
#define BLAH_BLAH_PPI_CH_CLEAR 1
// Up to three tasks can be used in each GPIOTE channel for performing write operations to a pin, two
// are fixed (SET and CLR), and one (OUT) configurable to perform Set, Clear or Toggle
// - "HiToLo" Task mode: Clear pin from OUT[n] task
NRF_GPIOTE->CONFIG[RADIO_GPIOTE_CH] = GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos |
GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos |
PIN_RADIO_TEST << GPIOTE_CONFIG_PSEL_Pos |
GPIOTE_CONFIG_OUTINIT_Low << GPIOTE_CONFIG_OUTINIT_Pos;
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_READY; // RADIO has ramped up and is ready to be started
NRF_PPI->CH[BLAH_BLAH_PPI_CH_SET ].EEP = (uint32_t)&NRF_RADIO->EVENTS_ADDRESS; // Address sent or received
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_PAYLOAD; // Packet payload sent or received
NRF_PPI->CH[BLAH_BLAH_PPI_CH_CLEAR].EEP = (uint32_t)&NRF_RADIO->EVENTS_END; // Packet sent or received
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_DISABLED; // RADIO has been disabled
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_DEVMATCH; // A device address match occurred on the last received packet
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_DEVMISS; // No device address match occurred on the last received packet
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_RSSIEND; // Sampling of receive signal strength complete.
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_BCMATCH; // Bit counter reached bit count value.
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].EEP = (uint32_t)&NRF_RADIO->EVENTS_CRCOK; // Packet received with CRC ok
// NRF_PPI->CH[BLAH_BLAH_PPI_CH .EEP = (uint32_t)&NRF_RADIO->EVENTS_CRCERROR; // Packet received with CRC error
// NRF_PPI->CH[BLAH_BLAH_PPI_CH ].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[MOTOR_GPIOTE_CH];
NRF_PPI->CHENSET = ((1UL << BLAH_BLAH_PPI_CH_SET) | (1UL << BLAH_BLAH_PPI_CH_CLEAR));