Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years ago.
Serial Communication with Ubunthu and Minicom
Hi,
I'm new to using Linux. I am trying to setup a terminal that can display data from the Comm port from a Nucleo-L432KC.
I have made the following progress:
1. I have established that the virtual comm port is created and it is called ttyACM0. 2. I have given access to the comm port. 3. I have installed MiniCom. 4. I have setup MiniCom to have the following settings:
I use the following command to initialise the serial communication on the Nucleo:
Serial pc(SERIAL_TX, SERIAL_RX); // pc comunication pc.baud(9600);
When the Minicom Window shows the information from the Comm Port it just displays diamond characters:
Can someone please tell me what I'm doing wrong?
************* I have managed to get some data via GNU Screen. The output is however not stable and the screen freezes after a short while. Please see below two images. The first shows my program displaying perfectly in TereTerm on a Windows machine. And the second shows the result in GNU Screen with the errors:
Kind regards
Koos van der Wat
1 Answer
6 years ago.
Hello Russel,
This looks very much like a synchronization issue. Make sure that your minicom is not sending some AT reset commands at the beginning of your session. It has been a very long time since I used minicom, but a little bit of searching and you should find a menu of command strings to send at different events. For connection to the board, you either want them all empty, or you need tell the terminal program not to send them.
Good luck and keep us posted, Earl, team Mbed
Dear Earl,
Thanks for your answer. I'm now using Putty and I seem to get better results. Unfortunately the problem is not completely solved. I sometimes plug and unplug my board from the usb port during testing. What I see now is the following:
1. When I run the program for the first time everything works as expected. 2. When I unplug the USB port and re-plug the USB port to run the program again then the information received gets scrambled. 3. It seems that Linux does not close the virtual com port after the USB plug has been removed. When the board is re-plugged then the received bits are corrupted possibly by bits that was partly received when the board was unplugged. My next steps will be to research how to tell the operating system to clear the virtual com ports before I re-connect.
Kind regards
Koos
posted by 17 Aug 2018
Have you tried turning hardware flow control off in minicom?
posted by Russell Bateman 10 Aug 2018Hi Russel, I just tried that but id did not work. Kind regards
posted by Koos van der Wat 11 Aug 2018Okay. I don't think the serial-over-USB supports hardware flow control so leave it off anyway. How are you sending data? Are you calling printf() or pc.printf() (or something else)?
posted by Russell Bateman 11 Aug 2018Hi Russel,
Thanks again for your assistance. I'm using the following code:
Hi Russel, I have managed to get some data by using GNU screen. The communication is still not stable as the terminal is losing a lot of characters and it freezes after a while. I have included in my original posting pictures of my device communicating on a Windows Machine using TeraTerm and also a screen print of the data output on GNU Screen. Currently I think it could be a Linus Ubunthu setup issue? What do you think?
posted by Koos van der Wat 11 Aug 2018Hi Koos, to be honest I have had some similar issues with minicom (with other hardware). For my development on Windows I usually use TeraTerm (as you have posted!), for my Linux setup (Xubuntu) I use Putty as a serial console. This has worked fine for me on the Nucleo F411RE. Another thing you could try is 'cat' the '/dev' node of the device. That way you can dump the buffer contents direct to the terminal, or a file to analyse the bytes sent.
posted by Russell Bateman 11 Aug 2018Dear Russel, Thank you very much. I will start investigating on how to use Putty... Have a great weekend.
posted by Koos van der Wat 11 Aug 2018You've also checked to make sure you are using the correct baud rate? Mbed OS defaults to a baud rate of 9600 with the
Serial
API.- Jenny, team Mbed
posted by Jenny Plunkett 13 Aug 2018Dear Jenny, yes we are using 9600. Thank you very much.
posted by Koos van der Wat 17 Aug 2018