My Serial writes are garbled when sent out to TeraTerm terminal program but Ok when viewed on the Serial monitor. Characters get dropped. This is quite useless as I want my class to receive the data in Python on the PC. I get this in both micro:bit Python editor and MS Makecode. I have used different micro:bits on different PCs, same result. I might just go back to installing micropython and download the script with ampy.
Is TeraTerm doing serial over USB or are you using external pins for serial? Have you confirmed that you have the correct baud (115200)?
Serial via USB, about 10% of characters dropped or changed so I doubt any Serial port settings. I use ESPXXX and Pi Pico like this all the time.
I just tried MU Editor 1.2 and data is coming through with no errors.
Oh, that’s interesting. I wonder if it’s just a flaw in TeraTerm (not enough buffer space or not polling fast enough?).
I don’t know that this would really help…but I have a JavaScript library (https://github.com/bsiever/microbit-webusb) that has an example webpage you could also try: https://bsiever.github.io/microbit-webusb/ .
I use TeraTerm in the same mode with ESP and Pi Pico with no such issues. I also wrote python to read the serial and got the same dropped characters. It’s interesting how the Mu Editor produces code that works fine. I thought that Makecode might be running background event handling loops that were interfering with serial. Are you getting good comms with the microbit and Makecode?
The JavaScript library had been dropping characters when it wasn’t polling the serial port fast enough, but currently I don’t have any significant problems with either MakeCode or the JavaScript library.
Can you share an example of the code you’re using to send data (an example that demonstrates the dropped/garbled data)? And what version of micro:bits are you using?
Finally the solution:
Thanks for contacting the Micro:bit Educational Foundation.
When a WebUSB connection is used to send a program directly to micro:bit, MakeCode and the Python Editor stay connected and ready for incoming serial data.
With a serial terminal program connected, for some reason an occasional character still finds it’s way to WebUSB.
​
Use the three dots menu on the Download/send to micro:bit button to Disconnect, or close the WebUSB connected browser tab.
​
I have found this easy to forget. It’s taken a while, but I finally now do think “shut MakeCode” when serial is misbehaving!
For the same reason, having more than one tab with MakeCode or the Python Editor open can lead to errors.