8000 pulseio.PWMOuts share duty cycle values when many of them are created · Issue #1106 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

pulseio.PWMOuts share duty cycle values when many of them are created #1106

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

Closed
deshipu opened this issue Aug 10, 2018 · 4 comments
Closed

pulseio.PWMOuts share duty cycle values when many of them are created #1106

deshipu opened this issue Aug 10, 2018 · 4 comments

Comments

@deshipu
Copy link
deshipu commented Aug 10, 2018

I tested it with the following code on my custom board:

=== ROWS = (
===     pulseio.PWMOut(board.R8, frequency=200000),
===     pulseio.PWMOut(board.R7, frequency=200000),
===     pulseio.PWMOut(board.R6, frequency=200000),
===     pulseio.PWMOut(board.R5, frequency=200000),
===     pulseio.PWMOut(board.R4, frequency=200000),
===     pulseio.PWMOut(board.R3, frequency=200000),
===     pulseio.PWMOut(board.R2, frequency=200000),
===     pulseio.PWMOut(board.R1, frequency=200000),
=== )
=== 
>>> ROWS[4].duty_cycle
0
>>> ROWS[6].duty_cycle
0
>>> ROWS[6].duty_cycle = 500
>>> ROWS[6].duty_cycle
274
>>> ROWS[4].duty_cycle
274

Where the pins are:

    { MP_ROM_QSTR(MP_QSTR_R1),  MP_ROM_PTR(&pin_PA14) },
    { MP_ROM_QSTR(MP_QSTR_R2),  MP_ROM_PTR(&pin_PA19) },
    { MP_ROM_QSTR(MP_QSTR_R3),  MP_ROM_PTR(&pin_PA05) },
    { MP_ROM_QSTR(MP_QSTR_R4),  MP_ROM_PTR(&pin_PA17) },
    { MP_ROM_QSTR(MP_QSTR_R5),  MP_ROM_PTR(&pin_PA11) },
    { MP_ROM_QSTR(MP_QSTR_R6),  MP_ROM_PTR(&pin_PA04) },
    { MP_ROM_QSTR(MP_QSTR_R7),  MP_ROM_PTR(&pin_PA10) },
    { MP_ROM_QSTR(MP_QSTR_R8),  MP_ROM_PTR(&pin_PA00) },
@dhalbert
Copy link
Collaborator
dhalbert commented Sep 4, 2018

Is it just the return value that's wrong, or are the channels actually sharing the same value when used but shouldn't be sharing? Tnx.

@deshipu
Copy link
Author
deshipu commented Sep 4, 2018

Unfortunately it's the latter: all those pins share the duty cycle value, changing one makes the output of all the linked pins change.

@dhalbert
Copy link
Collaborator

Fixed by #1184.

@deshipu
Copy link
Author
deshipu commented Sep 12, 2018

Awesome, thank you!

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

3 participants
0