0

Bluefruit nRF52 Servo Detach
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Bluefruit nRF52 Servo Detach

by NMolargik on Sat Jan 19, 2019 6:30 pm

Hello,
Having some issues with servos on the Bluefruit nRF52 Feather board. Using the standard Arduino Servo.h library, all functions seem to work except servo.detach();. I made sure I am using it in the right syntax, but the servo continues to jitter at the position it was last sent instead of detaching. Tested with an Arduino Uno, the servo detaches fine. Please help.

Thank you!

I have since updated the board to 0.9.3 and the Servo.h library to 1.1.3 and now i get a compiler error and can't even upload my code.
Code: Select all | TOGGLE FULL SIZE
Arduino: 1.8.7 (Windows 10), Board: "Adafruit Bluefruit nRF52832 Feather, 0.2.5 (s132 6.1.1), Level 0 (Release)"

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:24: error: 'NRF_PWM_CHANNEL_COUNT' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                        ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:49: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                 ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:76: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                            ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:103: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                                                       ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:130: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                                                                                  ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:159: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                                                                                                               ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:186: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                                                                                                                                          ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:213: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                                                                                                                                                                     ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:240: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                                                                                                                                                                                                ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:269: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                                                                                                                                                                                                                             ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:296: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                                                                                                                                                                                                                                                        ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:323: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                                                                                                                                                                                                                                                                                   ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:31:350: error: 'NRF_PWM_PIN_NOT_CONNECTED' was not declared in this scope

 uint32_t group_pins[3][NRF_PWM_CHANNEL_COUNT]={{NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}, {NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED, NRF_PWM_PIN_NOT_CONNECTED}};

                                                                                                                                                                                                                                                                                                                                                              ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:32:31: error: 'NRF_PWM_CHANNEL_COUNT' was not declared in this scope

 static uint16_t seq_values[3][NRF_PWM_CHANNEL_COUNT]={{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}};

                               ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp: In member function 'void Servo::writeMicroseconds(int)':

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:92:12: error: 'g_APinDescription' was not declared in this scope

  instance=(g_APinDescription[pin].ulPWMChannel & 0xF0)/16;

            ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:95:2: error: 'group_pins' was not declared in this scope

  group_pins[instance][channel]=g_APinDescription[pin].ulPin;

  ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:98:2: error: 'seq_values' was not declared in this scope

  seq_values[instance][channel]= value | 0x8000;

  ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:99:2: error: 'nrf_pwm_sequence_t' was not declared in this scope

  nrf_pwm_sequence_t const seq={

  ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:105:52: error: 'nrf_pwm_pins_set' was not declared in this scope

  nrf_pwm_pins_set(PWMInstance, group_pins[instance]);

                                                    ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:106:28: error: 'nrf_pwm_enable' was not declared in this scope

  nrf_pwm_enable(PWMInstance);

                            ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:107:33: error: 'NRF_PWM_CLK_125kHz' was not declared in this scope

  nrf_pwm_configure(PWMInstance, NRF_PWM_CLK_125kHz, NRF_PWM_MODE_UP, 2500); // 20ms - 50Hz

                                 ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:107:53: error: 'NRF_PWM_MODE_UP' was not declared in this scope

  nrf_pwm_configure(PWMInstance, NRF_PWM_CLK_125kHz, NRF_PWM_MODE_UP, 2500); // 20ms - 50Hz

                                                     ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:107:74: error: 'nrf_pwm_configure' was not declared in this scope

  nrf_pwm_configure(PWMInstance, NRF_PWM_CLK_125kHz, NRF_PWM_MODE_UP, 2500); // 20ms - 50Hz

                                                                          ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:108:35: error: 'NRF_PWM_LOAD_INDIVIDUAL' was not declared in this scope

  nrf_pwm_decoder_set(PWMInstance, NRF_PWM_LOAD_INDIVIDUAL, NRF_PWM_STEP_AUTO);

                                   ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:108:60: error: 'NRF_PWM_STEP_AUTO' was not declared in this scope

  nrf_pwm_decoder_set(PWMInstance, NRF_PWM_LOAD_INDIVIDUAL, NRF_PWM_STEP_AUTO);

                                                            ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:108:77: error: 'nrf_pwm_decoder_set' was not declared in this scope

  nrf_pwm_decoder_set(PWMInstance, NRF_PWM_LOAD_INDIVIDUAL, NRF_PWM_STEP_AUTO);

                                                                             ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:109:40: error: 'seq' was not declared in this scope

  nrf_pwm_sequence_set(PWMInstance, 0, &seq);

                                        ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:109:43: error: 'nrf_pwm_sequence_set' was not declared in this scope

  nrf_pwm_sequence_set(PWMInstance, 0, &seq);

                                           ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:110:35: error: 'nrf_pwm_loop_set' was not declared in this scope

  nrf_pwm_loop_set(PWMInstance, 0UL);

                                   ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:111:36: error: 'NRF_PWM_TASK_SEQSTART0' was not declared in this scope

  nrf_pwm_task_trigger(PWMInstance, NRF_PWM_TASK_SEQSTART0);

                                    ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:111:58: error: 'nrf_pwm_task_trigger' was not declared in this scope

  nrf_pwm_task_trigger(PWMInstance, NRF_PWM_TASK_SEQSTART0);

                                                          ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp: In member function 'int Servo::readMicroseconds()':

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:123:12: error: 'g_APinDescription' was not declared in this scope

  instance=(g_APinDescription[pin].ulPWMChannel & 0xF0)/16;

            ^

C:\Users\nmola\Documents\Arduino\libraries\Servo\src\nrf52\Servo.cpp:126:9: error: 'seq_values' was not declared in this scope

  return seq_values[instance][channel] & 0x7FFF;

         ^

exit status 1
Error compiling for board Adafruit Bluefruit nRF52832 Feather.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

NMolargik
 
Posts: 4
Joined: Wed Jun 28, 2017 8:32 pm

Re: Bluefruit nRF52 Servo Detach

by hathach on Mon Jan 21, 2019 2:32 am

you are compiling with standard Servo library, BSP come with its own Servo lib. Please remove the one you installed and re-compile again.

Update: We have update the BSP master branch to fix the Servo detach issue
https://github.com/adafruit/Adafruit_nRF52_Arduino

Please clone/download code from github to see if that works for you.

hathach
 
Posts: 938
Joined: Tue Apr 23, 2013 1:02 am

Re: Bluefruit nRF52 Servo Detach

by NMolargik on Mon Jan 21, 2019 3:29 pm

That definitely works! Thank you!

NMolargik
 
Posts: 4
Joined: Wed Jun 28, 2017 8:32 pm

Please be positive and constructive with your questions and comments.