-
-
Notifications
You must be signed in to change notification settings - Fork 792
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
Serial Monitor only allows ASCII characters #4732
Comments
Does it work with pio device monitor --raw? |
No. I get the following error:
|
Ahh.. You the issue related with You can also provide a pull request, see code https://github.com/pyserial/pyserial/blob/master/serial/tools/miniterm.py |
Hexlify is not the problem, it's simply a stock PIO tool that very easily demonstrates the problem originating within the PlatformIO DeviceMonitorFilterBase extension. |
@ivankravets Full disclosure I'm the "accomplished buddy" mentioned above-
I also struggle to understand what issue it is you think we should be passing on to pyserial / miniterm, and even if there's a case there, why this issue can be closed as "done" until that upstream work is finished. This manifests as behavior in PIO regardless of where the source is- I would normally assume an issue like this stays open and gets linked to the pyserial issue, tracking it until patched and your version of pyserial is updated. |
Sorry, I've just reopened this issue. If you have any ideas on how to fix it, please provide PR to this repository or https://github.com/platformio/platformio-docs |
First, the documentation PR: What I'm unsure of is why |
I think |
Indeed, the Could try |
I commented out all "monitor" configs in the "platformio.ini" file with the exception of "monitor_speed = 19200", and ran the above command in the PIO terminal:
|
The issue is linked to PySerial module which we use for the Nevertheless, we extended our API, and |
Thanks @ivankravets . Is platformio/platformio-docs#317 no longer necessary / obsolete with this change? |
I updated that docs page (fixed URL). Thanks! |
What kind of issue is this?
If you’ve found a bug, please provide an information below.
Configuration
Operating system: Ubuntu 22.04 LTS x64
PlatformIO Version (
platformio --version
): PlatformIO Core, version 6.1.11a2Description of problem
Characters >127 cannot be used with the Serial Monitor. This is a full-stop problem for any sort of custom filters requiring use of the full byte range (0-255) of characters.
After banging my head into this issue for several hours, I have concluded that the issue is upstream of the filter extensibility (i.e. in DeviceMonitorFilterBase), as the actual raw serial characters >127 are all replaced with U+FFFD (Unicode Replacement Character), making it totally impossible to write a custom filter for these usecases.
Steps to Reproduce
In my case, I used this effective pseudocode in the MCU:
Actual Results
Only characters 0-127 can be used.
Expected Results
The complete serial 0-255 byte range is usable.
Additional info
Only took about 4 hours of time + help from an accomplished buddy to eventually figure out how to get the desired result: If I specify "monitor-encoding: latin1", I can for the first time in my life actually get unaltered serial data into the filter.
Worth noting that "monitor-encoding: hexlify" is worse than "monitor-encoding: utf8", as the "invalid" characters get discarded before getting to the filter in the first place.
In view of not breaking existing filters, I would suggest adding "rx_byte" and "tx_byte" extensibilities to DeviceMonitorFilterBase , where data can be passed to a custom filter via bytearray (without any encoding nonsense), instead of utilizing the Python string type. This would completely eliminate all of the headbanging around trying to simply get the monitor to pass the actual serial data to the custom filter, it would also not affect any existing filters, and it would also make writing custom filters much easier.
The text was updated successfully, but these errors were encountered: