I've been developing an application using the NRF52 DK and everything has been going as planned. I then made my own PCB which would take these modules by Rigado. The BMD-300 is the nRF52832 chip with all the supporting circuitry and antenna design.
Now, I made one board which worked as expected although I made a mistake thinking I could use pins 0 and 1 to drive an output while using the low frequency clock.
So I made another board which didn't have the same mistake, but now the same code running on the new board will eventually lock up (at least the logging stops). If I run the NRF52 DK and my BMD-300 board side-by-side, the BMD-300 has noticibly faster log outputs which doesn't make sense as they should both be using the same time intervals.
I did follow the instructions here to set up the internal oscillator.
Could excessive heat cause the internal oscillator to fail, or act out of specification? I need to spend some more time tinkering with it, but I was hoping that someone could point out something obvious?
Running this code below will consistently count to 137 before 'crashing' on the BMD-300 but carries on on the NRF52 DK.
extern "C" {
#include <stdio.h>
#include "boards.h"
#include "app_util_platform.h"
#include "nrf_drv_rtc.h"
#include "nrf_drv_clock.h"
#include "bsp.h"
#include "app_error.h"
#include "app_timer.h"
#include "app_twi.h"
#include "nrf_delay.h"
#include "compiler_abstraction.h"
#define NRF_LOG_MODULE_NAME "APP"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
}
uint8_t volatile ticks = 0;
static nrf_drv_rtc_t const m_rtc NRF_DRV_RTC_INSTANCE(0);
static void lfclk_config(void) {
NRF_LOG_INFO("Configuring low frequency clock\r\n");
uint32_t err_code;
err_code = nrf_drv_clock_init();
APP_ERROR_CHECK(err_code);
nrf_drv_clock_lfclk_request(NULL);
}
static void rtc_handler(nrf_drv_rtc_int_type_t int_type) {
if (int_type == NRF_DRV_RTC_INT_TICK) {
NRF_LOG_INFO("Ticks: %i\r\n", ticks);
ticks++;
}
}
static void rtc_config(void) {
NRF_LOG_INFO("Configuring RTC\r\n");
uint32_t err_code;
// Initialize RTC instance with default configuration.
nrf_drv_rtc_config_t config = NRF_DRV_RTC_DEFAULT_CONFIG;
config.prescaler = RTC_FREQ_TO_PRESCALER(32); //Set RTC frequency to 32Hz
err_code = nrf_drv_rtc_init(&m_rtc, &config, rtc_handler);
APP_ERROR_CHECK(err_code);
// Enable tick event and interrupt.
nrf_drv_rtc_tick_enable(&m_rtc, true);
// Power on RTC instance.
nrf_drv_rtc_enable(&m_rtc);
}
int main(void) {
APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
NRF_LOG_INFO("\r\n\r\nStart\r\n");
NRF_LOG_FLUSH();
lfclk_config();
rtc_config();
while (true) {
__WFI();
NRF_LOG_FLUSH();
}
}