Wio Terminal Servo example error

Hi,

I am using servo example as shown in Wio Terminal Wiki. I get following error upon complilation. Could you please tell me what is wrong?

Thanks

`

/* Sweep
by BARRAGAN http://barraganstudio.com
This example code is in the public domain.

modified 8 Nov 2013
by Scott Fitzgerald
https://arduino.cc/en/Tutorial/Sweep
*/

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0; // variable to store the servo position

void setup() {
myservo.attach(5); // attaches the servo on pin 5 to the servo object
}

void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}

`

Blockquote

c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp: In function 'void Servo_Handler(timer16_Sequence_t, Tc*, uint8_t, uint8_t)':
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:64:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:81:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:84:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:91:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:99:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp: In function 'void resetTC(Tc*)':
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:112:5: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
     WAIT_TC16_REGS_SYNC(TCx)
     ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:116:5: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
     WAIT_TC16_REGS_SYNC(TCx)
     ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp: In function 'void _initISR(Tc*, uint8_t, uint32_t, IRQn_Type, uint8_t, uint8_t)':
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:11: error: 'struct Gclk' has no member named 'CLKCTRL'; did you mean 'GENCTRL'?
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
           ^~~~~~~
           GENCTRL
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:37: error: 'GCLK_CLKCTRL_CLKEN' was not declared in this scope
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                     ^~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:37: note: suggested alternative: 'GCLK_CLKCTRL_IDs'
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                     ^~~~~~~~~~~~~~~~~~
                                     GCLK_CLKCTRL_IDs
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:58: error: 'GCLK_CLKCTRL_GEN_GCLK0' was not declared in this scope
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                                          ^~~~~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:58: note: suggested alternative: 'GCLK_PCHCTRL_GEN_GCLK0'
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                                          ^~~~~~~~~~~~~~~~~~~~~~
                                                          GCLK_PCHCTRL_GEN_GCLK0
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:83: error: 'GCLK_CLKCTRL_ID' was not declared in this scope
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                                                                   ^~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:83: note: suggested alternative: 'GCLK_CLKCTRL_IDs'
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                                                                   ^~~~~~~~~~~~~~~
                                                                                   GCLK_CLKCTRL_IDs
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:124:18: error: 'struct Gclk' has no member named 'STATUS'
     while (GCLK->STATUS.bit.SYNCBUSY);
                  ^~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:134:30: error: 'TC_CTRLA_WAVEGEN_NPWM' was not declared in this scope
     tc->COUNT16.CTRLA.reg |= TC_CTRLA_WAVEGEN_NPWM;
                              ^~~~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:134:30: note: suggested alternative: 'TC_WAVE_WAVEGEN_NPWM'
     tc->COUNT16.CTRLA.reg |= TC_CTRLA_WAVEGEN_NPWM;
                              ^~~~~~~~~~~~~~~~~~~~~
                              TC_WAVE_WAVEGEN_NPWM
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:141:5: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
     WAIT_TC16_REGS_SYNC(tc)
     ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:145:5: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
     WAIT_TC16_REGS_SYNC(tc)
     ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:159:5: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
     WAIT_TC16_REGS_SYNC(tc)
     ^~~~~~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

Hello, you can refer to this post: "Error compiling for board seeduino wio terminal"?

Hi Jay,

I saw that article before but am unable to understand the solution. That post talks about “Multiple libraries found for” error which I am not getting. Can you please elaborate what WAIT_TC16_REGS_SYNC error mean and how to fix it?

Thanks again,
Jay

Sorry for the inconvenience, I have confirmed the issue and we will send it back to R&D for resolution, please wait.

Until then you can try this code

Hi,

I am new to Arduino and Github. Can you please explain where should I get the servo.h library and should I save it in Arduino library folder?

Thanks

After our attempts, we found that its Servo library is also not available. We are sorry, but you may still need to wait for our R&D department to follow up on the solution.

Thank you very much Citric. Please note I bought 24 Wio terminals just for a project to deal with servos.If the servo implementation can be expedited that will be highly appreciated. Thanks!

It has now been fed back and is awaiting a solution from R&D. I’ll let you know if there’s any new news

They told me there is a solution, you need to move all the libraries under your Arduino directory first, leaving only the servo library, and that will work.

That sounds like a good news. Can you please elaborate a bit more? Move what libraries from what location to where (paths will be helpful)? Thanks!

The Arduino libraries for Windows computers should be placed under document/Arduino/libraries, and you need to move all the library libraries in that directory to a safe place first. (I’m sure you don’t want to delete all the libraries either.) Then add only the servo libraries in there and try to compile the program.
The R&D department says that this error should be sent because you have other servo libraries in the Arduino library directory that are affecting the compilation of the program. After that you can put back library by library, and if a compile error occurs after putting back a certain library, it means that this library is causing a conflict with the servo library.

Hi Citric,

I followed your directions and moved all lib folders from document/Arduino/libraries to a safe place. Then I copied back only servo folder but I am getting the same error after compilation.

c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp: In function 'void Servo_Handler(timer16_Sequence_t, Tc*, uint8_t, uint8_t)':
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:64:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:81:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:84:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:91:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:99:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp: In function 'void resetTC(Tc*)':
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:112:5: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
     WAIT_TC16_REGS_SYNC(TCx)
     ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:116:5: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
     WAIT_TC16_REGS_SYNC(TCx)
     ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp: In function 'void _initISR(Tc*, uint8_t, uint32_t, IRQn_Type, uint8_t, uint8_t)':
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:11: error: 'struct Gclk' has no member named 'CLKCTRL'; did you mean 'GENCTRL'?
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
           ^~~~~~~
           GENCTRL
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:37: error: 'GCLK_CLKCTRL_CLKEN' was not declared in this scope
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                     ^~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:37: note: suggested alternative: 'GCLK_CLKCTRL_IDs'
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                     ^~~~~~~~~~~~~~~~~~
                                     GCLK_CLKCTRL_IDs
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:58: error: 'GCLK_CLKCTRL_GEN_GCLK0' was not declared in this scope
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                                          ^~~~~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:58: note: suggested alternative: 'GCLK_PCHCTRL_GEN_GCLK0'
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                                          ^~~~~~~~~~~~~~~~~~~~~~
                                                          GCLK_PCHCTRL_GEN_GCLK0
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:83: error: 'GCLK_CLKCTRL_ID' was not declared in this scope
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                                                                   ^~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:123:83: note: suggested alternative: 'GCLK_CLKCTRL_IDs'
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
                                                                                   ^~~~~~~~~~~~~~~
                                                                                   GCLK_CLKCTRL_IDs
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:124:18: error: 'struct Gclk' has no member named 'STATUS'
     while (GCLK->STATUS.bit.SYNCBUSY);
                  ^~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:134:30: error: 'TC_CTRLA_WAVEGEN_NPWM' was not declared in this scope
     tc->COUNT16.CTRLA.reg |= TC_CTRLA_WAVEGEN_NPWM;
                              ^~~~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:134:30: note: suggested alternative: 'TC_WAVE_WAVEGEN_NPWM'
     tc->COUNT16.CTRLA.reg |= TC_CTRLA_WAVEGEN_NPWM;
                              ^~~~~~~~~~~~~~~~~~~~~
                              TC_WAVE_WAVEGEN_NPWM
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:141:5: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
     WAIT_TC16_REGS_SYNC(tc)
     ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:145:5: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
     WAIT_TC16_REGS_SYNC(tc)
     ^~~~~~~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<unnamed>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
c:\Users\admin\Documents\Arduino\libraries\Servo\src\samd\Servo.cpp:159:5: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
     WAIT_TC16_REGS_SYNC(tc)
     ^~~~~~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

Hi, can you try this library and tell me how is it going? GitHub - PaintYourDragon/Servo: Servo Library for Arduino

1 Like

Hi Citric,;

Thanks for your help. After installing this lib and compiling the sweep example I get below error. Are you able to compile this lib on your side?

Thanks!

Error:
grpc: error while marshaling: proto: Marshal called with nil
Compilation error: grpc: error while marshaling: proto: Marshal called with nil

Some work has been done in the Arduino Servo library to make it function with the SAMD51 chip used in the WIO terminal (and some other non-Seeed SAMD51 boards).

This has, apparently, not been incorporated into the main Servo library that you download with the Arduino library manager (Version 1.1.8).

[/Begin Disclaimer]
I haven’t tested (very much) but I can at least get it to compile by doing the following. My purpose is to use standard stuff as much as possible, making minimal number of changes. It may just happen that future library updates will work and if we haven’t made any unnecessary changes nothing will get broken.
[/End Disclaimer]

First of all, move any Servo library you have been experimenting with out of the way (Some place not under your sketchbook or sketchbook\libraries folder)

Then, use the Arduino Libraries Manager to install the “official” Arduino Servo library. (This is probably what you started with.)

Now there are two files under your sketchbook\libraries folder that we will change:

libraries\Servo\src\samd\Servo.cpp
libraries\Servo\src\samd\ServoTimers.h

For now, rename those so that they can be restored. (Just in case my suggestion doesn’t work, you can restore the library to its original state.)

For example, rename Servo.cpp to Servo.cpp.original and rename ServoTimers.h to ServoTimers.h.original
[/BeginEDIT]
Go to my next post to see where I got replacement Servo.cpp and ServoTimers.h.

Download Servo.cpp and copy it into your libraries\Servo\src\samd directory.
Download ServoTimers.h and copy it into that directory.
[/End EDIT]
(Or: You can get them by unzipping the attachment below.)

Compile your test program and let us know how it goes.

Regards,

Dave

Apologies for my previous not-so-good advice.
It turns out that the files I got from the “fixed” branch don’t really meet requirements.
It gave PWM OK, but the period was something like34.8 ms, not 20 ms that we usually expect for analog servos.
Worse than that: The pulse width varied from about 15.5 ms to about 17.3 ms. Certainly wouldn’t work, since the servos will work with pulse widths on the order of one or two milliseconds.

Real bottom line: Tested

Follow the steps I enumerated in my previous post, but:

Get Servo.cpp and ServoTimers.h from the site recommended by Citric and copy those to your libraries\Servo\src\samd directory. I zipped them and attached them in this post. (I deleted the unfortunate zip file from my previous post.)

With these files, I changed the Sweep example to use pin D0 and got the following:
Period is 20 ms
Pulse width varies from about 0.5 ms (500 us) to about 2.44 ms (2400 us).
My servo is rated to operate at 5 Volts, but it actually moved from stop to stop with the 3.3V from the Wio Terminal.

Again, I apologize for my previous bad advice. (I did say that I hadn’t tested very much, but I just got so excited at having it compile OK and observing a square wave on D0, that I didn’t notice its improper timing.) Sorry. I shouldn’t have posted until I did some relevant testing.

Anyhow, the files from PaintYourDragon seem to work.

Regards,

Dave

Servox.zip (5.0 KB)

1 Like