Skip to content

Pulseio not working properly on RAspberry Pi Pico M2040 #4506

@luceec

Description

@luceec

Test Case:
Want to measure duty cycle and convert to RGB values

Test Setup:
PWM input from RGB LED conroller connected to pin 18 on Pico (used a level converter to bring 5V down to 3.3V)
Using this version on the Pico "Adafruit CircuitPython 6.2.0-beta.4-116-g010232574 on 2021-03-27; Raspberry Pi Pico with rp2040"
Square wave is a 7.83 KHz

Test program:
import board, import pulseio
pulses = pulseio.PulseIn(board.GP18, maxlen=2, idle_state=True)
print(len(pulses))

Error:
REPL becomes unresponsive.

ERROR thonny.plugins.micropython.backend: PROBLEM WITH THONNY'S BACK-END:
Traceback (most recent call last):
File "C:\Users\lucee\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 340, in _handle_normal_command
response = handler(cmd)
File "C:\Users\lucee\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 636, in _cmd_get_globals
"{name : (thonny_helper.repr(value), id(value)) for (name, value) in globals().items() if not name.startswith('')}"
File "C:\Users\lucee\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 549, in _evaluate
out, err = self._execute(script, capture_output=True)
File "C:\Users\lucee\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 505, in _execute
self._execute_with_consumer(script, consume_output)
File "C:\Users\lucee\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\bare_metal_backend.py", line 708, in _execute_with_consumer
self._submit_code(script)
File "C:\Users\lucee\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\bare_metal_backend.py", line 572, in _submit_code
self._submit_code_via_raw_mode(to_be_sent)
File "C:\Users\lucee\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\bare_metal_backend.py", line 622, in _submit_code_via_raw_mode
self._write(block)
File "C:\Users\lucee\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\bare_metal_backend.py", line 517, in _write
self._connection.write(data)
File "C:\Users\lucee\AppData\Local\Programs\Thonny\lib\site-packages\thonny\plugins\micropython\serial_connection.py", line 85, in write
assert size == len(data)
AssertionError

Backend terminated or disconnected. Use 'Stop/Restart' to restart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions