Cannot interact with REPL over serial connection

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
lisper
Posts: 4
Joined: Sun Apr 10, 2016 8:44 pm

Cannot interact with REPL over serial connection

Post by lisper » Sun Apr 10, 2016 9:18 pm

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.

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: Cannot interact with REPL over serial connection

Post by platforma » Sun Apr 10, 2016 9:28 pm

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?

lisper
Posts: 4
Joined: Sun Apr 10, 2016 8:44 pm

Re: Cannot interact with REPL over serial connection

Post by lisper » Sun Apr 17, 2016 5:38 pm

> 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.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Cannot interact with REPL over serial connection

Post by dhylands » Sun Apr 17, 2016 6:32 pm

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.

lisper
Posts: 4
Joined: Sun Apr 10, 2016 8:44 pm

Re: Cannot interact with REPL over serial connection

Post by lisper » Mon Apr 18, 2016 8:29 pm

Figured it out. It was my terminal program. It was not converting CR to CR-LF.
Last edited by lisper on Mon Apr 18, 2016 8:41 pm, edited 1 time in total.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Cannot interact with REPL over serial connection

Post by dhylands » Mon Apr 18, 2016 8:35 pm

It could be flow control related as well then.

lisper
Posts: 4
Joined: Sun Apr 10, 2016 8:44 pm

Re: Cannot interact with REPL over serial connection

Post by lisper » Mon Apr 18, 2016 8:42 pm

Wow, that was a fast response! No, the problem was that it wasn't converting CR to CR-LF.

Post Reply