When using Thonny(4.1.7) with picocalc, such error occures.
PROBLEM IN THONNY'S BACK-END: Internal error (thonny.plugins.micropython.mp_back.ProtocolError: Unexpected read during raw paste).
This issue is caused by os.dupterm() in boot.py
Workaround:
Check USB connected or not before calling os.dupterm()
SIE_STATUS_REG = 0x50110000 + 0x50
SIE_CONNECTED = 1 << 16
SIE_SUSPENDED = 1 << 4
usbConnected = (machine.mem32[SIE_STATUS_REG] & (SIE_CONNECTED | SIE_SUSPENDED)) == SIE_CONNECTED
if not usbConnected:
os.dupterm(pc_terminal)
Check here
