DIO toggling in Peripheral_server_sleep

Hello there,

Could you please let me know what should be changed in Peripheral_server_sleep in order to toggle the DIO pin as fast as possible and do not disturb the BLE communication?

Thank you

Hi,
If you want to do LED toggle only when you wake up from sleep, you can reduce the Advertising interval (APP_ADV_INT_MIN) to a minimum or set an RTC alarm.
The Advertising interval has a value between 20 ms and 10.24 secs.
The minimum value of the RTC Alarm that can be set is RTC_ALARM_7P8125MS.
Below is an example of rtcalarm.

void RTC_Init(void)
{
/* Configure RTC as wake-up source using XTAL32kHz
* to alarm & wake-up after a pre-defined duration */
ACS->RTC_CFG = RTC_CNT_START_4294967295;
ACS->RTC_CTRL = RTC_ALARM_7P8125MS | RTC_CLK_SRC_XTAL32K;
ACS_RTC_CTRL->ENABLE_ALIAS = RTC_ENABLE_BITBAND;
}

3 Likes

Hello Ayden Hong,

thank you for your reply.
I don’t need to toggle the DIO between the Advertising.
Actually I’m developing own software protocol, hence I would like to toggle DIO pin as fast as possible for my protocol. This communication will happen between BLE communication.

I have already using the 48 MHz oscillator, but I don’t know exactly what and how should be configured that MCU clock will be MAX as possible.
I did some trials and achieve the MAX DIO toggling speed, but BLE stop doing advertisement.

Best regards,
Yevgeniy

Hi, Yevgeniy,

Refer to the example of peripheral_server_sleep for MCU clock settings.
App.h

#define RFCLK_FREQ 48000000

/* Define clock divider and flash timings depending on RF clock frequency /
#if (RFCLK_FREQ == 8000000)
#define RF_CK_DIV_PRESCALE_VALUE CK_DIV_1_6_PRESCALE_6_BYTE
#define SLOWCLK_PRESCALE_VALUE SLOWCLK_PRESCALE_8
#define BBCLK_PRESCALE_VALUE BBCLK_PRESCALE_1
#define DCCLK_PRESCALE_BYTE_VALUE DCCLK_PRESCALE_2_BYTE
#define FLASH_DELAY_VALUE FLASH_DELAY_FOR_SYSCLK_8MHZ
#define BBCLK_DIVIDER_VALUE BBCLK_DIVIDER_8
#elif (RFCLK_FREQ == 12000000)
#define RF_CK_DIV_PRESCALE_VALUE CK_DIV_1_6_PRESCALE_4_BYTE
#define SLOWCLK_PRESCALE_VALUE SLOWCLK_PRESCALE_12
#define BBCLK_PRESCALE_VALUE BBCLK_PRESCALE_1
#define DCCLK_PRESCALE_BYTE_VALUE DCCLK_PRESCALE_3_BYTE
#define FLASH_DELAY_VALUE FLASH_DELAY_FOR_SYSCLK_12MHZ
#define BBCLK_DIVIDER_VALUE BBCLK_DIVIDER_12
#elif (RFCLK_FREQ == 16000000)
#define RF_CK_DIV_PRESCALE_VALUE CK_DIV_1_6_PRESCALE_3_BYTE
#define SLOWCLK_PRESCALE_VALUE SLOWCLK_PRESCALE_16
#define BBCLK_PRESCALE_VALUE BBCLK_PRESCALE_2
#define DCCLK_PRESCALE_BYTE_VALUE DCCLK_PRESCALE_4_BYTE
#define FLASH_DELAY_VALUE FLASH_DELAY_FOR_SYSCLK_16MHZ
#define BBCLK_DIVIDER_VALUE BBCLK_DIVIDER_8
#elif (RFCLK_FREQ == 24000000)
#define RF_CK_DIV_PRESCALE_VALUE CK_DIV_1_6_PRESCALE_2_BYTE
#define SLOWCLK_PRESCALE_VALUE SLOWCLK_PRESCALE_24
#define BBCLK_PRESCALE_VALUE BBCLK_PRESCALE_3
#define DCCLK_PRESCALE_BYTE_VALUE DCCLK_PRESCALE_6_BYTE
#define FLASH_DELAY_VALUE FLASH_DELAY_FOR_SYSCLK_24MHZ
#define BBCLK_DIVIDER_VALUE BBCLK_DIVIDER_8
#elif (RFCLK_FREQ == 48000000)
#define RF_CK_DIV_PRESCALE_VALUE CK_DIV_1_6_PRESCALE_1_BYTE
#define SLOWCLK_PRESCALE_VALUE SLOWCLK_PRESCALE_48
#define BBCLK_PRESCALE_VALUE BBCLK_PRESCALE_6
#define DCCLK_PRESCALE_BYTE_VALUE DCCLK_PRESCALE_12_BYTE
#define FLASH_DELAY_VALUE FLASH_DELAY_FOR_SYSCLK_48MHZ
#define BBCLK_DIVIDER_VALUE BBCLK_DIVIDER_8
#endif /
if (RFCLK_FREQ == 8000000) */

3 Likes