Page 1 of 1

Cannot interact with REPL over serial connection

Posted: Sun Apr 10, 2016 9:18 pm
by lisper
I apologize for the non-descriptive title but I really couldn't think of a better way to describe what is happening.

I'm running MicroPython v1.6-380-g9c04299 built on an Ubuntu 14.04 machine and also on a custom-built STM board using a STM32F405 processor. I can build Micropython for unix and it works. I can also build it for the STM board and download the code. It will start up and print the MicroPython banner. But then whatever I type at the REPL just gets echoed verbatim rather than evaluated, and it never prints another prompt.

Any suggestions for how to debug this would be much appreciated.

Re: Cannot interact with REPL over serial connection

Posted: Sun Apr 10, 2016 9:28 pm
by platforma
Do you see the REPL in your serial terminal at first? The ">>>".
And after you send you command, the terminal prints in back to you and no actions from REPL are displayed back to you?

Sound like a serial connection issue with you being able to receive what the board prints but not being able to transmit it back. If this is your custom board design, how are you connecting your serial Rx/Tx to it? Is the issue only present in micropython?

Re: Cannot interact with REPL over serial connection

Posted: Sun Apr 17, 2016 5:38 pm
by lisper
> Do you see the REPL in your serial terminal at first? The ">>>".

Yes. I see the full banner and the >>> prompt.

> And after you send you command, the terminal prints in back to you and no actions from REPL are displayed back to you?

That's right.

> Sound like a serial connection issue with you being able to receive what the board prints but not being able to transmit it back. If this is your custom board design, how are you connecting your serial Rx/Tx to it? Is the issue only present in micropython?

It's a USB device that acts as a virtual serial port. The issue is only present with Micropython. Other interactive code works fine.

It could still be a serial issue, but I don't see how it's possible that MicroPython can even echo my input without being able to successfully both read and write to the (virtual) serial port.

Re: Cannot interact with REPL over serial connection

Posted: Sun Apr 17, 2016 6:32 pm
by dhylands
You should also make sure that you only have one program connected to the serial port.

For example, if you use screen, and it gets disconnected, screen can still be running in the background and have the serial port open.

You can use a command like:

Code: Select all

lsof | grep ttyACM
to see which processes might have the serial port open.

Re: Cannot interact with REPL over serial connection

Posted: Mon Apr 18, 2016 8:29 pm
by lisper
Figured it out. It was my terminal program. It was not converting CR to CR-LF.

Re: Cannot interact with REPL over serial connection

Posted: Mon Apr 18, 2016 8:35 pm
by dhylands
It could be flow control related as well then.

Re: Cannot interact with REPL over serial connection

Posted: Mon Apr 18, 2016 8:42 pm
by lisper
Wow, that was a fast response! No, the problem was that it wasn't converting CR to CR-LF.