This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can't use Timer 2 for PWM. Error "''NRFX_TIMER2_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_TIMER1_INST_IDX'?

I am using DSK 15.3, SES 4.30 with SD 132.  The base example I am using is the ble_app_uart_c and I am adding the PWM function to drive a simple piezo buzzer.

The pwm_library example works fine running stand alone using timer 1 but when I modify the pwm_library example to use timer 2 and incorporate into my code I get this error: 'NRFX_TIMER2_INST_IDX' undeclared here (not in a function); did you mean 'NRFX_TIMER1_INST_IDX'? 

I have enabled the timer in the sdk_config.h file.  See attached screen shot.

However, nrfx_timer.h shows that timer 2 isn't enabled.  See attached picture.

I've tried cleaning the project as well as adding the enable Timer 2 at the top of my main.c code:  (Shown here as commented out since it didn't work.)

// #define NRFX_TIMER1_ENABLED TIMER1_ENABLED
// #define NRFX_TIMER2_ENABLED TIMER2_ENABLED
// NRFX_TIMER2_INST_IDX;
// #define TIMER2_ENABLED 1

What to do?

Parents Reply Children
No Data
Related