Hello, everyone.
I use sdk v17 and pca10040.
I put the example 'pwm_library' in the example 'ble_app_uart'.
However, 'NRFX_TIMER_INSTANCE (id)' in 'nrfx_timer.h' will generate an error.

So I modified NRFX_TIMER_ENABLEED from sdk_config.h to 1
.
But it's still the same problem.
//Buzzer(PWM)
APP_PWM_INSTANCE(PWM1,1); // Create the instance "PWM1" using TIMER1.
static volatile bool ready_flag; // A flag indicating PWM status.
void pwm_ready_callback(uint32_t pwm_id) // PWM callback function
{
ready_flag = true;
}
.
.
.
int main(void)
{
bool erase_bonds;
//PWM setting
ret_code_t err_code;
app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_1CH(1500, buzzer_pin); //period_in_us(sound), pin
/* Switch the polarity of the second channel. */
pwm1_cfg.pin_polarity[1] = APP_PWM_POLARITY_ACTIVE_HIGH;
/* Initialize and enable PWM. */
err_code = app_pwm_init(&PWM1,&pwm1_cfg,pwm_ready_callback);
APP_ERROR_CHECK(err_code);
//app_pwm_enable(&PWM1); //pwm start
// 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();
//=================================================================================================================================
//add Initialize
bsp_board_init(BSP_INIT_LEDS); //board led init
//bsp_board_init(BSP_INIT_BUTTONS);
nrf_drv_systick_init(); //systick init
//buttons_init();
// Start execution.
printf("\r\nUART started.\r\n");
NRF_LOG_INFO("Debug logging for UART over RTT started.");
advertising_start();
// Enter main loop.
for (;;)
{
idle_state_handle();
//send data to app (OK)
ble_nus_data_send(&m_nus, data_string1, &length1, m_conn_handle);
//PWM
ready_flag = false;
//wait for callback
while (app_pwm_channel_duty_set(&PWM1, 0, 10) == NRF_ERROR_BUSY); //p_instance, channel, duty cycle(%)
//app_pwm_channel_duty_set(&PWM1, 0, 10);
app_pwm_enable(&PWM1); //start pwm
nrf_delay_ms(1000);
app_pwm_disable(&PWM1); //stop pwm
nrf_delay_ms(1000);
}
}
Thank you in advance.