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

How to control a servo motor from nrf52832 with angle precision?

I am using the Hackable Kit from Electronut labs and using their Bumpy , black magic probe alternative for programming. I would like to control a servo motor precisely at given angle from a mobile app over bluetooth. I have tried the PWM library and driver examples from the SDK 15 examples.

When i run them independently they work well and good. But when i integrate it with any of the Ble_peripheral example it doesn't work. Either i get a SIGSEGU interrupt error, or, when servo motor runs BLE service is disconnected or vice versa happens as if like they both are sharing same resources. But i made sure by tracing their dependencies that they are not sharing any common TIMER or PPI Channel. Yet the problem persists. However even when the servo motor is working i couldn't control its angle the way i wanted it. 

I would like to know whether PWM is the right way to control a servo motor for precision angles. If it is is there any sample code that i can refer to. But please not the SDK examples as they are not helpful. I am Using SEGGER and GBD for codding and loading code into the hardware as I don't own a J-Link. 

Parents Reply
  • Ok. I will use the pwm_library example, then.

    I assume that you tried to add the pwm_library to one of the ble_examples.

    The pwm_library example uses TIMER1, as it says in the comment of the initialization of the PWM_INSTANCE:

    APP_PWM_INSTANCE(PWM1,1);                   // Create the instance "PWM1" using TIMER1.

     

    Have you enabled TIMER1 in sdk_config.h of the project you are trying to merge with the PWM project?

     

    BR,

    Edvin

Children
Related