Pico: Why is B15 working against A10 when pwm-ing? #5348
Replies: 1 comment
-
Posted at 2016-04-26 by @gfwilliams I'm afraid there isn't a way to use those two separately - they both use the same hardware, it's just that one is a negated version of the other one. You should hopefully be able to find a set of pins that don't share the same Or... How fast/accurate do you need the PWM to go? You can still use software PWM on pins that are tricky with something like Posted at 2016-04-26 by Marc Thanks for your quick answer. The PWM is just for LED dimming, so it doesn't be very acurate. Posted at 2016-04-26 by Marc And what about pins like B1, that list 2 different PWM channels? Posted at 2016-04-26 by @gfwilliams Ok, perfect - so software PWM would be fine then (you can use it on absolutely any pins, so you could have B15 as software and A10 as hardware and everything would be great). You can even make several software PWM, but the more you have and faster you go, the more CPU is used. By 'tricky', I mean where you have them using the same timer channel. Where more than one channel is listed, you just have to look at the first one. While the hardware can handle multiple channels in that case, Espruino doesn't provide you with a way to specify which one you want to use. Posted at 2016-04-28 by Marc Hey Gordon, thanks, this really works great, I now run 3 pins as software pwm (had to force it). Best regards, Posted at 2016-04-28 by @gfwilliams
Yeah, it would be - unfortunately that's all down to ST who make the chips, not me ;) I think the negated PWM exists for certain things where you want to use exactly the same PWM but get a normal and inverted output of the same thing at the same time. Posted at 2016-04-28 by Marc Ah, I thought pins like B1 can be either TIM1_CH3N or TIM3_CH4. Posted at 2016-04-28 by @gfwilliams Sorry, I misread - yes, that could be done in software where the pins support both. Definitely B1 should be using TIM3_CH4 A7 is more tricky, as if that used TIM3_CH2, it would conflict with B5! So you'll never be able to use B13, A7 and B5 at once - it's just a hardware restriction. Posted at 2016-06-11 by Marc Hey Gordon, I finally did all the coding for my 16 channel PWM, now there are a few hiccups left so solve. Any idea how this may be solved? Or is a freqency of 600 on 3 pins too much for the CPU to handle? Thanks in advance, Posted at 2016-06-11 by @allObjects Regarding inverted PWM: ...how abut having a full H-Bridge? ...driving some steppers could be a use for that... Two of those PWMs with 50% duty cycle and phase shift of 25% makes a perfect driver for two coil micro-steppers. Posted at 2016-06-15 by @gfwilliams I think the problem might be that when you change a software PWM value, it basically cancels the old PWM and then starts a new one - so you can get 'glitches' (the hardware handles this automatically and avoids it). The faster the frequency the less obvious the glitches are, but then the more work Espruino is having to do. As you're doing your interval at 15ms, so 66 fps, you probably wouldn't see flicker if you just pulsed the pins at that rate. How about replacing:
with a set of:
You might find you could use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-04-26 by Marc
Hello,
I need to drive 16 independent pwm outputs + 3 analog inputs with the Pico, so I did a little test-setup, which is mostly working fine, but when sending a value (e.g. 0.1) to pin B15 and then send another value to A10, B15 is turned off. Sending 0 or 1 works as expected.
I now found in the reference, that B15 is TIM1_CH3N and A10 is TIM1_CH3, whatever this means.
Is there any way I can use both pins without interferencing each other?
Thanks in advance.
Marc
Beta Was this translation helpful? Give feedback.
All reactions