Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Edison Arduino] Illegal arguments for construction of _exports_Pwm on IO 10/11 (PWM swizzler) #52

Closed
rwaldron opened this issue Dec 2, 2014 · 10 comments

Comments

@rwaldron
Copy link
Contributor

rwaldron commented Dec 2, 2014

Environment:

root@blurr:~# cat /etc/version && node -e 'console.log(require("mraa").getVersion());' && node -v
edison-rel1-maint-weekly_build_16_2014-10-14_14-56-19
v0.5.4-2-gffdd828
v0.10.28

Error:

root@blurr:~# node
> var m = require("mraa")
undefined
> var p = new m.Pwm(11)
Error: Illegal arguments for construction of _exports_Pwm
    at repl:1:9
    at REPLServer.self.eval (repl.js:110:21)
    at repl.js:249:20
    at REPLServer.self.eval (repl.js:122:7)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
    at Interface._ttyWrite (readline.js:760:14)
    at ReadStream.onkeypress (readline.js:99:10)

(blurr => edison)

@arfoll
Copy link
Contributor

arfoll commented Dec 2, 2014

According to our platform config that's not a valid pwm pin. See: https://github.com/intel-iot-devkit/mraa/blob/master/src/intel_edison_fab_c.c#L1118

@rwaldron
Copy link
Contributor Author

rwaldron commented Dec 3, 2014

Ok, I'm confused now: there is a PWM ~ printed next to 11 on the board and 11 is always a PWM pin on the Arduino UNO (I'm using the Edison Arduino Breakout)

@tingleby
Copy link
Member

tingleby commented Dec 3, 2014

Yes but the edison has limited PWM channels. You have to mess with the PWM swizzler jumpers, to change the PWM signal from one of the other pins to the one without.
Mraa doesn't support this behavior.

@rwaldron
Copy link
Contributor Author

rwaldron commented Dec 3, 2014

Ok, so you're saying that the board shouldn't have been printed with this indicator?

@rwaldron
Copy link
Contributor Author

rwaldron commented Dec 3, 2014

Sorry, I feel like a only half understand what you're trying to say. It's going to be very frustrating to explain to users that 11 just doesn't do PWM on the Edison.

@arfoll
Copy link
Contributor

arfoll commented Dec 3, 2014

The boards are made with jumpers to retain arduino uno compatibility, however there are only 4 PWM channels and they have to be switched using hardware jumpers labelled "swizzler". By defauly 10 & 11 are not active and we feel it's less confusing to just refuse to do PWM in those cases (since we have no way of knowing whether the jumper was switched). Page 9 of this https://www.adafruit.com/datasheets/P2180UserGuide.pdf explains the different configurations the swizzers can be in.

The only thing we could realistically do is make pin10&11 attempt to use PWM2 & PWM3 although that will end up toggling pin6&9 if the board is not configured correctly. If you feel that's more useful behaviour then I'm open to making that change. Note that using pin10&11 this way would require moving the second jumper on J11 to 4-5 and the second jumper on J12 to 4-5.

@arfoll arfoll changed the title [Edison] Illegal arguments for construction of _exports_Pwm [Edison] Illegal arguments for construction of _exports_Pwm on IO 10/11 (PWM swizzler) Dec 3, 2014
@rwaldron
Copy link
Contributor Author

rwaldron commented Dec 3, 2014

The only thing we could realistically do is make pin10&11 attempt to use PWM2 & PWM3 although that will end up toggling pin6&9 if the board is not configured correctly. If you feel that's more useful behaviour then I'm open to making that change.

I don't feel confident in my understanding of the problem space to make this call, so I say leave it as is and I'll figure out some way to make it clear to library code users.

@arfoll arfoll changed the title [Edison] Illegal arguments for construction of _exports_Pwm on IO 10/11 (PWM swizzler) [Edison Arduino] Illegal arguments for construction of _exports_Pwm on IO 10/11 (PWM swizzler) Jan 12, 2015
@alext-mkrs
Copy link
Contributor

FWIW, I would vote for just closing this one - we state clearly in the docs that we only support PWM on default swizzler pins and anything else (e.g. allowing to use 10 and 11) would indeed require something outside of the library control - a user action on swizzler config - which IMHO is more dangerous than beneficial.

Same as right now someone could be confused by not being able to drive PWM on pins 10 and 11, they would be confused by GPIO pins being activated unexpectedly. And as long as the former could only cause frustration (until the documentation is read), the latter could cause some actual damage, that's why I believe the current approach is safer thus better.

@alext-mkrs
Copy link
Contributor

@arfoll, do you think we can close this one, IMHO it's quite straightforward?

@rwaldron, any additonal suggestions on how we could make it clear, now that some time passed (I see just one mention so far, so looks like there weren't too many problems with that)?

@rwaldron
Copy link
Contributor Author

There is nothing to be done in software space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants