# Serial write garbled on Terminal program but OK on in-built Serial viewer

**URL:** https://forum.makecode.com/t/serial-write-garbled-on-terminal-program-but-ok-on-in-built-serial-viewer/24541
**Category:** micro:bit extensions
**Created:** [November 25, 2023, 8:11pm UTC](https://forum.makecode.com/t/serial-write-garbled-on-terminal-program-but-ok-on-in-built-serial-viewer/24541 "2023-11-25T20:11:24Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![pmulvey](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@pmulvey](https://forum.makecode.com/u/pmulvey)
#### Post date: [November 25, 2023, 8:11pm UTC](https://forum.makecode.com/t/serial-write-garbled-on-terminal-program-but-ok-on-in-built-serial-viewer/24541/1 "2023-11-25T20:11:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [November 26, 2023, 3:16am UTC](https://forum.makecode.com/t/serial-write-garbled-on-terminal-program-but-ok-on-in-built-serial-viewer/24541/2 "2023-11-26T03:16:07Z")

</div>

Is TeraTerm doing serial over USB or are you using external pins for serial? Have you confirmed that you have the correct baud (115200)?

---

<div class="post-metadata">

### Author: ![pmulvey](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@pmulvey](https://forum.makecode.com/u/pmulvey)
#### Post date: [November 27, 2023, 5:45pm UTC](https://forum.makecode.com/t/serial-write-garbled-on-terminal-program-but-ok-on-in-built-serial-viewer/24541/3 "2023-11-27T17:45:07Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pmulvey](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@pmulvey](https://forum.makecode.com/u/pmulvey)
#### Post date: [November 27, 2023, 6:32pm UTC](https://forum.makecode.com/t/serial-write-garbled-on-terminal-program-but-ok-on-in-built-serial-viewer/24541/4 "2023-11-27T18:32:31Z")

</div>

I just tried MU Editor 1.2 and data is coming through with no errors.

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [November 28, 2023, 6:18pm UTC](https://forum.makecode.com/t/serial-write-garbled-on-terminal-program-but-ok-on-in-built-serial-viewer/24541/5 "2023-11-28T18:18:48Z")

</div>

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](https://github.com/bsiever/microbit-webusb)) that has an example webpage you could also try: [https://bsiever.github.io/microbit-webusb/](https://bsiever.github.io/microbit-webusb/) .

---

<div class="post-metadata">

### Author: ![pmulvey](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@pmulvey](https://forum.makecode.com/u/pmulvey)
#### Post date: [November 28, 2023, 7:18pm UTC](https://forum.makecode.com/t/serial-write-garbled-on-terminal-program-but-ok-on-in-built-serial-viewer/24541/6 "2023-11-28T19:18:43Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [November 29, 2023, 12:40am UTC](https://forum.makecode.com/t/serial-write-garbled-on-terminal-program-but-ok-on-in-built-serial-viewer/24541/7 "2023-11-29T00:40:02Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![pmulvey](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@pmulvey](https://forum.makecode.com/u/pmulvey)
#### Post date: [November 30, 2023, 5:14pm UTC](https://forum.makecode.com/t/serial-write-garbled-on-terminal-program-but-ok-on-in-built-serial-viewer/24541/8 "2023-11-30T17:14:26Z")

</div>

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.
