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

nrf_drv_pwm_init error on compile

Hi. Using SDK13, nrf52, and the awful IDE Segger, I keep getting this error no matter what kind of code or project with PWM I use :

Undefined reference to  nrf_drv_pwm_init

I did:

  1. I have added the file nrf_drv_pwm.c
  2. I have added to the preprocessor: ../../../../../../components/drivers_nrf/pwm
  3. I have enabled on the config file : #define PWM_ENABLED 1

Nothing helps, here is the function that causing this ( intrestingly other functions from the driver will NOT CAUSE ERRORS)

#include <stdio.h>
#include <string.h>
#include "nrf_drv_pwm.h"
#include "app_util_platform.h"
#include "app_error.h"
#include "boards.h"
#include "bsp.h"
#include "nrf_drv_clock.h"
#include "nrf_delay.h"


/// MORE STUFF HERE 

static void pwm_init(void)
{
    nrf_drv_pwm_config_t const config0 =
    {
        .output_pins =
        {
            OUTPUT_PIN, // channel 0
            NRF_DRV_PWM_PIN_NOT_USED,             // channel 1
            NRF_DRV_PWM_PIN_NOT_USED,             // channel 2
            NRF_DRV_PWM_PIN_NOT_USED,             // channel 3
        },
        .irq_priority = APP_IRQ_PRIORITY_LOWEST,
        .base_clock   = NRF_PWM_CLK_1MHz,
        .count_mode   = NRF_PWM_MODE_UP,
        .top_value    = 100,
        .load_mode    = NRF_PWM_LOAD_INDIVIDUAL,
        .step_mode    = NRF_PWM_STEP_AUTO
    };
    // ******** ERROR IS ONLY ON THIS CALL , NOT THE PREVIOUS ONE
    APP_ERROR_CHECK(nrf_drv_pwm_init(&m_pwm0, &config0, NULL));   //****ERROR HERE !
 
    
}
Related