tone(), noTone()

Post your cool example code here.
Nutsy
Posts: 241
Joined: Sun Jul 24, 2016 4:26 pm

Re: tone(), noTone()

Post by Nutsy » Wed Dec 07, 2016 4:24 pm

Heh hacked the 5v line onto it... Much better :D Still not perfect but better. I can only guess then that 12v was just over loading the gain signal :p

aramperez
Posts: 11
Joined: Thu May 12, 2016 1:34 am

Re: tone(), noTone()

Post by aramperez » Tue Aug 08, 2017 2:30 am

I'm using PA0 to connect to a piezo buzzer and PA1 as a PWM signal to control a motor (via an L9110S chip). Whenever I use tone(PA0, xxx);, it messes up the PWM on PA1. Anyone know why this is the case?

Thanks,
Aram

victor_pv
Posts: 1741
Joined: Mon Apr 27, 2015 12:12 pm

Re: tone(), noTone()

Post by victor_pv » Tue Aug 08, 2017 4:01 am

aramperez wrote:
Tue Aug 08, 2017 2:30 am
I'm using PA0 to connect to a piezo buzzer and PA1 as a PWM signal to control a motor (via an L9110S chip). Whenever I use tone(PA0, xxx);, it messes up the PWM on PA1. Anyone know why this is the case?

Thanks,
Aram
Please check the datasheet, and the libmaple documentation on PWM for details, but basically is due to both pins having channels from the same Timer device.

User avatar
RogerClark
Posts: 7447
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: tone(), noTone()

Post by RogerClark » Tue Aug 08, 2017 4:51 am

There are only 4 timers in the F103C, these are shared across groups of pins.

If you look in the Maple mini documentation you can see which timers are shared across which pins

http://docs.leaflabs.com/static.leaflab ... -mini.html

(I'm sure the same information is in the reference manual for the STM32F103 (all 1000+ pages of it), if you want to read definitive reference

aramperez
Posts: 11
Joined: Thu May 12, 2016 1:34 am

Re: tone(), noTone()

Post by aramperez » Tue Aug 08, 2017 6:04 pm

Thanks Victor and Roger, I'll look at the documentation and move one of the signals.

/Aram

Post Reply