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

Need workaround for tessel.port['GPIO'].pwm[0] for TM02 #77

Open
natevw opened this issue Aug 29, 2014 · 6 comments
Open

Need workaround for tessel.port['GPIO'].pwm[0] for TM02 #77

natevw opened this issue Aug 29, 2014 · 6 comments

Comments

@natevw
Copy link
Contributor

natevw commented Aug 29, 2014

I'm having trouble outputting PWM on my TM-00-002 board:

var port = require('tessel').port.GPIO,
    pin = port.pwm[0];
port.pwmFrequency(50);
console.log(pin);
pin.pwmDutyCycle(0.6);

Outputs:

{ pin: 37, isPWM: true, interrupts: {} }
Error: PWM is not suported on this pin

@natevw
Copy link
Contributor Author

natevw commented Aug 29, 2014

Looks like the variant table for V2 (and V1) does not have the proper flag for PWM: https://github.com/tessel/firmware/blob/e4ddfe70baa22f3cbdb8a9e9ca59e30891c29863/src/variants/lpc18xx/variant.c#L200

Is that an oversight, or does the hardware really not support it?

@kevinmehall
Copy link
Member

Only pin G3 supports PWM on those hardware versions. (which is not one of the PWM pins on 03/04 hardware).

@natevw
Copy link
Contributor Author

natevw commented Aug 29, 2014

Can the JS side be updated so that the correct pin is in the pwm array then? Right now this code doesn't work either:

var tessel = require('tessel'),
    port = tessel.port.GPIO,
    pin = port.digital[2];
port.pwmFrequency(50);
pin.pwmDutyCycle(0.6);

Outputs:

/app/t_pwm.js:6: attempt to call method 'pwmDutyCycle' (a nil value)

@natevw
Copy link
Contributor Author

natevw commented Aug 29, 2014

workaround:

var tessel = require('tessel'),
    port = tessel.port.GPIO,
    pin = port.pin['G3'];
pin.__proto__ = port.pwm[0].__proto__;
port.pwmFrequency(50);
pin.pwmDutyCycle(0.6);

@jiahuang
Copy link
Contributor

Are you on a Tessel V2 or a V4?

@jiahuang
Copy link
Contributor

derp, nevermind read your opening post

@jiahuang jiahuang changed the title PWM not supported on tessel.port['GPIO'].pwm[0]? Need workaround for tessel.port['GPIO'].pwm[0] for TM02 Aug 29, 2014
@jiahuang jiahuang reopened this Aug 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants