• Expected hardware limitation - they both use TIM3.

    Stay away from PWM on B4/B5 those pins are TIM3 channel 1 and 2. You get 3 choices with TIM3 - it can be on A6A7B0B1, or it can be on B4 and B5 (and the other two channels aren't available - on versions of the chip with more pins, I think they are), or on C6-9 (but C6-9 have better alternatives for PWM, so TIM3 shouldn't get used for them)

    A while ago, this was much worse, but Gordon cleaned it up, so I don't think any pairs of PWM pins fight anymore, except B4/B5, which conflict with A6-B1.

    Now I think what Espruino uses is:

    TIM1 is on A8/9/10 - but IIRC you need to do something to shove the serial off A9/10 to use it on those pins, because it defaults to having Serial1 there so you can use bluetooth with it.
    TIM1 is also used for B13/14/15 (using the negated channels) - so you can't do PWM on A8/9/10 and B13/14/15 at the same time.

    TIM2 is on B10/B11
    TIM3 is on A67,B01 (and it fights with B4/5 - these pins also have other really messy options for PWM, but they all conflict even worse than TIM3, so they're not used)
    TIM4 is on B6~9
    TIM5 is on A0-3
    TIM6 and 7 can only drive internal interrupts - they don't have any output compare pins.
    TIM8 is on C6-9 (these ca also use TIM3, but we don't want them to)

    One could argue that Espruino should try to fish around for a better PWM channel if possible (ie you try to do analogWrite(B4); analogWrite(B0), but had nothing on TIM1 or TIM8 to use a negated channel, it'd use that) - but I think this would make the conflicts that still occurred much, much harder to debug.

    i don't understand the specific behavior you're seeing where they're somehow both on, though.

About

Avatar for DrAzzy @DrAzzy started