Hello everyone,
I've been struggling to use the Bluetooth UART example and the RTC2 module but so far I haven't succeeded.
Either I have Bluetooth, or RTC2, but not both. Here is how I've modified the UART example code:
void RTC2_IRQHandler(void){
if(NRF_RTC2->EVENTS_COMPARE[0]){
NRF_RTC2->EVENTS_COMPARE[0] = 0;
NRF_RTC2->TASKS_CLEAR = 1;
nrf_gpio_pin_toggle(22);
}
}
/**@brief Application main function.
*/
int main(void)
{
bool erase_bonds;
// Initialize.
uart_init();
log_init();
timers_init();
buttons_leds_init(&erase_bonds);
power_management_init();
ble_stack_init();
gap_params_init();
gatt_init();
services_init();
advertising_init();
conn_params_init();
// Start execution.
printf("\r\nUART started.\r\n");
NRF_LOG_INFO("Debug logging for UART over RTT started.");
advertising_start();
nrf_gpio_cfg_output(22);
/* This code alone works, but when added here
it doesn't!
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->LFCLKSRC = 0x00;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0);
NRF_RTC2->PRESCALER = 0xFFF;
NRF_RTC2->EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
NRF_RTC2->INTENSET = RTC_INTENSET_COMPARE0_Msk;
NRF_RTC2->TASKS_CLEAR = 1;
NRF_RTC2->TASKS_START = 1;
NRF_RTC2->CC[0] = 8 * 1;
NVIC_SetPriority(RTC2_IRQn, 3);
NVIC_ClearPendingIRQ(RTC2_IRQn);
NVIC_EnableIRQ(RTC2_IRQn);
*/
// Enter main loop.
for (;;)
{
idle_state_handle();
}
}
I'm using nRF5_SDK_17.0.0_9d13099
Thank you in advance.
L. B.