adafruit / seesaw

I2C friend to expand capabilities of other chips.
Other
80 stars 34 forks source link

setPWMFreq() unresponsive. #4

Closed wa1tnr closed 6 years ago

wa1tnr commented 6 years ago

setPWMFreq()

Seesaw Breakout http://adafru.it/3657

Unresponsive to setPWMFreq() input, under Arduino IDE.

Looking to run Pin 5 or Pin 6 PWM at 50 Hz for a servo motor. Seems to want to stay on ~490 or 980Hz or so (judging by ear with piezo transducer connected to either Pin 5 or Pin 6). Well above the 50/60Hz buzzband. ;)

No problem with Fade.ino sketch, and the buzzer seems to annunciate different pulse width modulations. Just the base (carrier) frequency is fixed (unresponsive to input). This remains problematic. ;)

testbed:

https://github.com/wa1tnr/seesaw_m0

https://github.com/wa1tnr/seesaw_m0/blob/512dfde1b30b5f93f5db222a3c5139c78e9b0f3f/m0_timer_ainsuForth/src/periph/seesaw/seesaw.cpp#L179

CircuitPython and CPython (RPi platform) do not have hooks for setPWMFreq(). CPython (RPi) is preferred platform.

Seesaw module recently shipped from Adafruit.

refs. https://github.com/adafruit/seesaw/blob/master/seesaw/source/Delegate.cpp#L540 https://github.com/adafruit/seesaw/blob/master/seesaw/bsp/bsp_timer.cpp#L44 https://github.com/adafruit/seesaw/blob/master/seesaw/qp/extras/event.h#L304

Thanx! --nis

deanm1278 commented 6 years ago

hi @wa1tnr, PWM on the seesaw was updated to 16 bit and the ability to set the carrier frequency was added after the SAMD09 breakout was made. Please try your code again after updating to this firmware:

seesaw_new_firmware.zip

Sorry for the inconvenience!

wa1tnr commented 6 years ago

Thank you, deanm1278 -- I appreciate the fast response! No worries -- Adafruit moves at lightspeed.

I will close this issue, though I cannot test the firmware (or don't know how, at this point) I'm sure it's right.

Thanks again. 73 de wa1tnr

deanm1278 commented 6 years ago

@wa1tnr it can be programmed using the swclk, swdio, and reset pins. The easiest way to program is with a j-link or other SWD programmer, but if you don't have that we have a library that lets you use a cortex M0 arduino like a feather M0 or metro M0 to program another cortex chip (samd09 in your case).

https://learn.adafruit.com/programming-an-m0-using-an-arduino/overview

wa1tnr commented 6 years ago

@deanm1278 - was able to follow your programming guide, no problem (used an Adalogger and an SD card, and the firware linked in this Issue). Seesaw Breakout now definitely responsive to setting of PWM frequency (as annunciated by a piezo buzzer, that revealed an obvious by-ear change in frequency -- and as demonstrated using a servo motor). Thank you! -wa1tnr