unable to change pwm resolution on metro M4

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
marklb
 
Posts: 16
Joined: Mon Jun 24, 2019 3:49 pm

unable to change pwm resolution on metro M4

Post by marklb »

Mac Ventura 13.2, Apple Silicon
Arduino IDE: 2.1.0
Adafruit Metro M4 Express/Samd51

Hello,
I am unable to set PWM resolution for a samd51 device. The Adafruit code does support the analogWriteResolution function and maps 8, 12 and 16 bit accordingly but the analogWrite() function value is apparently truncates to 8 bit for the SAMd-51. Arduino reference says the analogWriteResolution function is for the Zero, Due and MKR family, Does this not also apply for the samd family?

.../Library/Arduino15/packages/adafruit/hardware/samd/1.7.11/cores/arduino/writing_analog.c

Thanks
Mark

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: unable to change pwm resolution on metro M4

Post by mikeysklar »

Mark,

Take a look at the Adafruit ZeroTimer library. It supports the M4 and is mostly used internally.

User avatar
marklb
 
Posts: 16
Joined: Mon Jun 24, 2019 3:49 pm

Re: unable to change pwm resolution on metro M4

Post by marklb »

Yep that looks like it will work for my needs. Thanks for the tip.

Mark

Locked
Please be positive and constructive with your questions and comments.

Return to “Metro, Metro Express, and Grand Central Boards”