arduino-libraries / Servo

Servo Library for Arduino
http://arduino.cc/
GNU Lesser General Public License v2.1
233 stars 251 forks source link

PWM signal sporadically inverted on Portenta H7 #98

Closed PJansky closed 2 years ago

PJansky commented 2 years ago

Sometimes the Servo PWM signal is inverted aka instead of 1.5 ms HI it is 1.5 ms LO. It only happens ~1 in 4 times after reset. I'm able to reproduce it with the supplied sketch. It is possible that the problem lies by the mbed guys, but since your Library is affected, I thought to post it here first.

Steps to reproduce:

  1. Upload sketch to Portenta H7
  2. Measure PWM output with oscilloscope
  3. Press reset button a few times, should be able to see, the signal is sometimes inverted

Libraries used:

Servo.zip

PJansky commented 2 years ago

After some further investigation, it seems the bug lies entirely with the mbed guys. The problem seems to be correlated with the time the reset button is held down, generally the longer it's held down the lower the likelihood of the bug occurring. My hunch is that something on the mbed side isn't getting set correctly if the reset pulse is "too short". Feel free to close this issue if you also think it's not an issue on your part. On the other hand it might me useful for other people encountering this behavior.

PJansky commented 2 years ago

No longer happens since I replaced the affected board and is no longer reproducible