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

Controlling a microservo from nRF51822 when BLE is activated

I am trying to control a servo motor from nRF51822 when BLE is activated. I am using mbed development framework and libraries. My servo example works flowlessly if BLE/SoftDevice S110 is not used. However, when I use BLE for advertising or to establish a connection to a central device, my servo starts glitching/bumping. I have seen this example that shows how to use PWM together with SoftDevice

github.com/.../nrf51-pwm-library

However I have not been able to make it work with my servo. Is there any simple servo example?

Thanks!

Parents Reply
  • The basic Servo routine that I am using in mbed relies on the "core" mbed class PwmOut. I will check if they are using Timer0 there. Trying to reuse the Nordic PWM example, this is the init method that I have created to use PIN 15 as PWM control of the servo. Is this correct?

    void pwm_init()
    {
        nrf_pwm_config_t pwm_config = PWM_DEFAULT_CONFIG;
        
        pwm_config.mode             = PWM_MODE_MTR_100;
        pwm_config.num_channels     = 1;
        pwm_config.gpio_num[0]      = P0_15;
        
        // Initialize the PWM library
        nrf_pwm_init(&pwm_config);    
    }
    
Children
No Data
Related