Write to serial device from uboot prompt - serial-port

Is it possible to send a message to a serial device from the u-boot prompt? Like I would do in a linux terminal with echo "Hello" > /dev/tty2
Thanks

Yes, its possible to send data/write data in Serial port via Uboot. Loading Linux images over UART is possible in that case its possible to do write data to the serial device.
set line /dev/ttyUSB0
set speed 115200
send "hello"
You can just try to use echo or send from the U-boot terminal.
Right now I don't have access to U-boot from my device. This is what I did several times to just handshake serial device from U-boot.

Related

How should i test if UART port is working?

I wanted to test if my UART(ttyMT1) is working on my custom board (android project). I have 2 UARTs on my board- ttyMT0 & ttyMT1. UART ttymt0 is my debug port. I have microcom on my board as well.
Test1:
I connected Tx and Rx of ttyMT1 with a female to female jumper wire. Then, on my ADB, i opened microcom for ttyMT1 using the below command:
microcom -s 115200 /dev/ttyMT1
On my debug port (using minicom), ttyMT0, I transmitted to ttyMT1 using echo as shown :
echo -ne 'Hello' > /dev/ttyMT1
and i was able to get the transmitted data print (HELLO) on ttyMT1.
What i wanted to know was, is this enough to verify that my UART ttyMT1 is working fine or do i need to try something else?
Test2:
What i tried again was to connect ttyMT0 to my PC's usb port and ttyMT1 to another USB port of my PC using 2 separate USB to UART connectors. Then i opened 2 minicom, one for each and tried to transmit the same Hello from ttyMT0 to ttyMT1 (ttyMT0 shows as ttyUSB0 on my PC and ttyMT1 as ttyUSB1). But i didn't receive any print on ttyMT1. Why is that?.
p.s. I'm unable to type anything on ttyMT1. I probed ttyMT1 on Oscilloscope and i got the Tx signal but I didn't get anything on my scope when I probed on Rx.
I think you need to have SELinux permission to access serial port in android. However check this code here to read serial port : https://programmer.help/blogs/serial-port-operation-with-jni-method-under-android.html. It will require you JNI.

How to send command through serial same way it does with PuTTy in a python script

I have a HPLC pump connected via serial port to the computer. By using PuTTy I can send commands to it such as REMOTE to control it from PC (the display will change on the pump to show that it is indeed in remote mode. However when I use the same command from python the device does not respond.
import serial
pump = serial.Serial(port='COM2', baudrate=19200)
I have tried
pump.write('REMOTE\n'.encode())
and
pump.write(b'REMOTE\n')
and
pump.write(b'REMOTE')
I resolved the issue.
I needed to use
pump.write(b'REMOTE\r')
not
\n

ESP8266 Wifi Module - prints "ready" but not responding to AT commands

Just received my first ESP8266 wifi module with some excitement. However I've been unable to fully communicate with it. I have connected the module to my computer via a usb to serial cable and I'm power the module via a separate power supply (3.3v).
After powering the module up I receive the following information (via PuTTY or and Arduino serial monitor window):
[Vendor:www.ai-thinker.com Version:0.9.2.4]
ready
I have tried sending various AT commands e.g.
AT+RST
But I get no response. Using ctrl+m and ctrl+j in putty didn't help either.
Please see my youtube video if its helpful:
https://www.youtube.com/watch?v=RvasOuHuWDc
To get AT OK .
1.AT + PRESS ENTER + THEN CTRL +J WILL GIVE OK
2.Then Enter commands to execute
eg AT+GMR ->presss enter then ctrl+j
to get firmware
repeat step 1 for each command.
Make sure that you have putty or the Arduino serial console configured to send both a newline \n and a carriage return \r character. So AT+RST actually ends up being AT+RST\r\n. This took me a bit when I first received my ESP8266 modules. On the Arduino serial console this option is at the bottom of the window. I can see in your video you have it set to no line ending. Hopefully that does it for you.

Serial port shown in device manager but unable to access/found?

I've installed the Arduino virtual USB serial port driver, it's appeared as COM4 on my device manager. I double checked by listing all available serial ports in powershell
> [System.IO.Ports.SerialPort]::getportnames()
COM1
COM4
However, when I try to do an echo to the serial port, it says it does not exist
> echo helloworld > COM4
The system cannot find the file specified.
I am trying to upload some firmware in to my arduino, but I kept getting denied by the port. Trying a different USB gives me the same result. I wrote a small program to test the serial port and I get the error:
The serial port "COM4" does not exist.
The device name of a serial port on Windows is \\.\COMn where n is the port number. A device driver can emulate the DOS device name, like "COM4" if it chooses to do so, very simple to do in the device driver code. But that's an increasingly rare thing to do, especially for port numbers larger than 2 and extra especially for port numbers larger than 4. So seeing your echo command fail is not unusual.
A serial port cannot be shared, it can only be opened once by a process and everybody else that tries to open it will get the fail-whale ERROR_ACCESS_DENIED error code. Necessarily so, serial ports sit at the very bottom layer of the OSI model, there is no protocol that arbitrates access to the port. Or to put it another way, the operating system has no guidance on who should get the data that the port receives. There can be only one candidate, the process that opened the port first. So the error message you got is not unusual, you have to make sure that nobody else is using the port. Including the Arduino serial port monitor.

Is is possible to simultaneously use Arduino serial monitor while receiving data from Processing?

I am attempting to send some data from Processing to my Arduino over the serial connection so that the Arduino can control an LED strip. Could I view the serial monitor while this transfer was taking place?
It is irking me that I cannot use any Serial.println statements (for debugging) while Processing is communicating with the Arduino. Everytime I try I get
Serial port 'COM3' already in use. Try quitting any programs that may be using it.
Is there a way for this serial communication to take place while I view the serial monitor at the same time?
The fact that the error message mentions COM3 suggests you are running on Windows. Unfortunately Windows doesn't allow multiple processes to simultaneously connect to the same serial port. This is different from Unix-based systems which do allow simultaneous serial port connections.
Using a Linux host, I have used a Python script send commands whilst monitoring results on the serial monitor. I seem to recall I had to open the serial monitor first and then run the other program.
Unfortunately, I can't help you with how to achieve that in Processing.
There is an application called Portmon that will allow you to monitor the serial communications on your PC.
Try 2 Serial communication,
Imagine you have already given USB as COM3 have a bluetooth device connected to your arduino Tx & Rx port, Let that be COM8. Now view COM3 in Arduino and COM8 in Processing.I could do this.

Resources