generated from michealroberts/astral-uv-python-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't workingtriageRequires triaging from core maintainersRequires triaging from core maintainers
Description
Summary
Hello,
I'm getting a consistent crash trying to read from an STM32F4's USB CDC interface. I made sure screen and pio monitor could handle it OK with my params to make sure it's not misconfigured.
Impact
This bug prevents me from using this lib which otherwise looks really good if you want async and types.
Reproduction Steps
Python (host) side
"""
Issue repro.
"""
import asyncio
from samps import SerialAsyncCommonInterface as Serial
SERIAL_PORT = "/dev/tty.usbmodem3187388E35331"
BAUDRATE = 115200
async def main() -> None:
async with Serial(port=SERIAL_PORT, baudrate=BAUDRATE) as serial:
print(["Serial Port Is Open?", "Yes" if serial.is_open() else "No"])
line = await serial.readline()
print(line.decode("utf-8").strip())
print(["Serial Port Closed"])
if __name__ == "__main__":
asyncio.run(main())STM32F4 side (arduino)
#include <Arduino.h>
void setup()
{
// Initialize serial communication
Serial.begin(115200);
while (!Serial)
{
; // Wait for serial port to be ready
}
delay(2000); // Wait for me to connect !
}
void loop()
{
// Print some bytes out
Serial.println("Hello from STM32 USB CDC !");
delay(1000);
}Expected Behavior
Here's the Platformio Serial Monitor options & output :
* Executing task: platformio device monitor --port /dev/cu.usbmodem3187388E35331
--- Terminal on /dev/cu.usbmodem3187388E35331 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
Hello from STM32 USB CDC !
Hello from STM32 USB CDC !
Hello from STM32 USB CDC !
Hello from STM32 USB CDC !
Hello from STM32 USB CDC !
Hello from STM32 USB CDC !
Hello from STM32 USB CDC !
Hello from STM32 USB CDC !
Hello from STM32 USB CDC !
Hello from STM32 USB CDC !
Actual Behavior
(host) ➜ host git:(master) ✗ python -m app.scripts.samps_repro
['Serial Port Is Open?', 'Yes']
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/mario/git/optical/host/app/scripts/samps_repro.py", line 25, in <module>
asyncio.run(main())
File "/Users/mario/.local/share/uv/python/cpython-3.12.0-macos-aarch64-none/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/mario/.local/share/uv/python/cpython-3.12.0-macos-aarch64-none/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mario/.local/share/uv/python/cpython-3.12.0-macos-aarch64-none/lib/python3.12/asyncio/base_events.py", line 664, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/mario/git/optical/host/app/scripts/samps_repro.py", line 17, in main
line = await serial.readline()
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mario/git/optical/host/.venv/lib/python3.12/site-packages/samps/asynchronous.py", line 452, in readline
raise SerialReadError(
samps.errors.SerialReadError: The device reported readiness to read but returned no data.
Regression Range
No response
Logs & Screenshots
No response
Environment Details
platform = macos 26.2 (M3)
python version = 3.12
package manager = uv
Additional Context
I understand more data may be needed to narrow down the issue but I do not know where to look. Feel free to ask for checks on my side.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtriageRequires triaging from core maintainersRequires triaging from core maintainers