Hi,
In trying to take the PPI example code from nRF5_SDK_17.1.0_ddde560 and adapt it to use RTC for an event-end-point, I get the following error:
Error[Pe020]: identifier "NRFX_RTC0_INST_IDX" is undefined main.c 45
on the following line in my main.c:
static const nrfx_rtc_t m_rtc0 = NRFX_RTC_INSTANCE(0);
I've looked at NRFX_RTC0_INST_IDX - Nordic Q&A - Nordic DevZone - Nordic DevZone and sdk_config confusion - Nordic Q&A - Nordic DevZone - Nordic DevZone, and ensured that the RTC driver and its instances are enabled in sdk_config.h, yet I still get this error:
// <e> NRFX_RTC_ENABLED - nrfx_rtc - RTC peripheral driver
//==========================================================
#ifndef NRFX_RTC_ENABLED
#define NRFX_RTC_ENABLED 1
#endif
// <q> NRFX_RTC0_ENABLED - Enable RTC0 instance
#ifndef NRFX_RTC0_ENABLED
#define NRFX_RTC0_ENABLED 1
#endif
// <q> NRFX_RTC1_ENABLED - Enable RTC1 instance
#ifndef NRFX_RTC1_ENABLED
#define NRFX_RTC1_ENABLED 1
#endif
// <q> NRFX_RTC2_ENABLED - Enable RTC2 instance
#ifndef NRFX_RTC2_ENABLED
#define NRFX_RTC2_ENABLED 1
#endif
I presume that config\nrf52832\config\sdk_config.h is the correct place to be looking for the enable defines, rather than in nrfx_config\.h, for the version nRF5_SDK_17.1.0_ddde560 that I'm using?
----------------------------------------
For additional info, this is the first 52 lines of the file (minus a section of GPIO #defines irrelevant to this problem):
#include "nrf52.h"
#include "system_nrf52.h"
...
#include <stdint.h>
#include "sdk_config.h"
//#include "nrf_delay.h"
#include "app_error.h"
#include "nrf_drv_gpiote.h"
#include "nrf_drv_ppi.h"
//#include "nrf_rtc.h"
#include "nrfx_rtc.h"
//#include "nrf_drv_rtc.h"
#include "nrf_drv_rtc.h"
#include "nrf_drv_timer.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#define PPI_EXAMPLE_TIMERS_PHASE_SHIFT_DELAY (10) // 1s = 10 * 100ms (Timer 0 interrupt)
#define PPI_EXAMPLE_TIMER0_INTERVAL (100) // Timer interval in milliseconds
#define PPI_EXAMPLE_TIMER1_INTERVAL (2000) // Timer interval in milliseconds
#define PPI_EXAMPLE_TIMER2_INTERVAL (2000) // Timer interval in milliseconds
// static const nrf_drv_rtc_t m_rtc0 = NRF_DRV_RTC_INSTANCE(0);
static const nrfx_rtc_t m_rtc0 = NRFX_RTC_INSTANCE(0); // <= line 45
static const nrf_drv_timer_t m_timer0 = NRF_DRV_TIMER_INSTANCE(0);
static const nrf_drv_timer_t m_timer1 = NRF_DRV_TIMER_INSTANCE(1);
static const nrf_drv_timer_t m_timer2 = NRF_DRV_TIMER_INSTANCE(2);
static nrf_ppi_channel_t m_ppi_channel1;
static nrf_ppi_channel_t m_ppi_channel2;