-
• #2
Hello Rob,
Are getting the kind of output below?
>reset(); =undefined _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v72 Copyright 2014 G.Williams >analogWrite(B12,0.5); =undefined >analogWrite(B15,0.5); ERROR: Pin B15 is not capable of PWM Output Suitable pins are: A0 A1 A2 A3 A5 A6 A7 A8 A9 A10 A11 A15 B0 B1 B3 B4 B5 B6 B7 B8 B9 B10 B12 B13 B14 C6 C7 C8 C9 Or pins with DAC output are: =undefined >analogWrite(B15,0.5,{freq: 5}); ERROR: Pin B15 is not capable of PWM Output Suitable pins are: A0 A1 A2 A3 A5 A6 A7 A8 A9 A10 A11 A15 B0 B1 B3 B4 B5 B6 B7 B8 B9 B10 B12 B13 B14 C6 C7 C8 C9 Or pins with DAC output are: =undefined >
Meanwhile for B12 this code doesn't show any thing special about it.
However the doc doesn't show B12 as a PWM capable pin.
I did not wired anything to it so far.
Do you have an element/clue about what doesn't work with B12?>analogWrite(B12, 0.5, { freq : 5 }); =undefined >
Clearly, the specs of STM32F401RE shows that it should work with B15 pin, it's not a matter of hardware.
Actually, Espruino's doc page you mentioned is right. The utilities that generated it are correctly using the pins definitions which are themselves correct too.
However, there seem to be a problem in the source/compiled version of Espruino itself.
To be investigated further I think. -
• #3
Thanks - I'll look further into this. It sure seems like it should work - even the generated pin declarations file seems to be correct, so it's something in the interpreter that is failing to work properly (right at the top of the
jshPinAnalogOutput
function - although I can't see how this could actually fail). -
• #4
Ok, this'll be fixed in 1v72.
In fact it was to do with pin names. Any pin past
B10
is currently wrong on the Nucleo boards - so that would have broken a whole bunch of stuff :)
According to the reference: http://www.espruino.com/ReferenceNUCLEOF401RE
Pin B15 should output PWM, but analogWrite(B15,...) gives an error:
Error: Pin B15 is not capable of PWM output...
The error also says pin B12 is a PWM output (which doesn't seem to work).
I think there is a mismatch somewhere.
Cheers,
Rob