Hello guys. I'm beginner in Nordic Devices.
I'm working in project that sends Acceleration Data from KX220 sensor over LoRa network or if there is a BLE device connected, my nRF52 (SDK 14.2) should stream the data over BLE.
The acceleration data is currently collected by TIMER1 + SAADC + PPI, but I want collect the acelleration sampling 5KHz with LFXTAL due the low power consuption.
For LoRa network, I'm using this port:
https://github.com/gluedig/nrf52-lora
I built a Custom Board with my peripherals, LoRa Radio, Accelerometer KX220 and the nRF52832 is my main CPU. So, the nrf52-lora uses RTC2 to control the LoRaMAC timer. Soft Device uses the RTC0 and app_timer uses RTC1.
In the current scenario i want to keep my device sleeping for a long period, like 30 minutes for example. But I dont known exactly how can I count these 30 minutes sleeping, because RTC0, RTC1 and RTC2 have been used for other purpourse.
My first idea is using the app_timer lib to create a new task event but I'm note sure how could I do this.
I followed this tutorial:
I started to work with the ble_app_uart, this example uses the app_timer but this code doesnt follow the above steps for app_timer, I didn't understand very well how to use the app_timer with soft device. In the ble_app_uart we just see the following code:
// Initialize. err_code = app_timer_init();
In the ble_app_uart example there is not a app_timer callback like the tutorial, see the example bellow.
/**@brief Create timers. */ static void create_timers() { ret_code_t err_code; // Create timers err_code = app_timer_create(&m_repeated_timer_id, APP_TIMER_MODE_REPEATED, repeated_timer_handler); APP_ERROR_CHECK(err_code); }
So I want to use app_timer to create tasks to wake up my device after sleep minutes and control a sampling process. Can i do this with app_timer ? Do I need to use the scheduler ? Which is the best strategy for this case ?