Raspberry PI 4 using multiple USARTS for different purposes.

Thread Starter

zazas321

Joined Nov 29, 2015
716
Hey. I would like to clarify something regarding the USART on the raspberry pi 4. I have connected a stationary barcode scanner to one of the USB ports and it appeared as ttyACM0 on my raspberry PI. I am able to send serial commands and everything seems to be working as expected. I am assuming that ACM0, 0 at the end means that it is connected to USART0?

I want to connect to a RS485 driver to my raspberry PI and communicate with other modbus slaves. Assuming that USART0 is already occupied by my scanner , I need to connect my RS485 driver to any other USART?

The problem is that I was able to find little to none information on how to implemented and activate USART2, 3, 4 peripherals on Raspberry PI. Have anyone else got any experience on that and would be able to share some information?
 

ronsimpson

Joined Oct 7, 2019
1,017
I am not an expert, Have Pi3 not Pi4.
I think the USB port is appearing as a serial port but is not using a physical (hardware) port. On my PC I have "serial ports" that are USB ports talking to micro-computers. I only have 2 real serial ports in hardware but Windows see all the ports as serial. On the PC there is a driver that turns some USB ports into "com:9" and "com:8" etc.
I think you have not used a USART with the USB port.
Again, not an expert and am often wrong!
 

nsaspook

Joined Aug 27, 2009
7,739
I am not an expert, Have Pi3 not Pi4.
I think the USB port is appearing as a serial port but is not using a physical (hardware) port. On my PC I have "serial ports" that are USB ports talking to micro-computers. I only have 2 real serial ports in hardware but Windows see all the ports as serial. On the PC there is a driver that turns some USB ports into "com:9" and "com:8" etc.
I think you have not used a USART with the USB port.
Again, not an expert and am often wrong!
A proper driver on VM hardware like the rpi would map USB function 'registers' into physical hardware serial port space so the use program would see no difference between 'real' and 'virtual' USART hardware ports.
 

Thread Starter

zazas321

Joined Nov 29, 2015
716
Thanks for the responses. What exactly do you mean by that? I mean I can have multiple USB devices plugged in running at once, but I am not entirely sure if I have all those devices plugged in + I connect physical wires to TX and RX pins of USART. Would that cause any problems?
 

ronsimpson

Joined Oct 7, 2019
1,017
The USB "serial port" has nothing to do with the USART.
You can have many serial ports running at the same time.
If there was no Operating System; you would have to write into the registers in a UART, and learn how to make a USB port work.
Because there is a OS many thing happen with out you needing to know how. From the programmer's point of view writing to a hard drive is just like writing to USB thumb drive and just like a flash card, just like a cloud drive, USB camera, and just like a back up drive on the network. (write to G:/root/mydocs/) You don't need to know the details.
Same thing for writing to a hard ware UART, a software UART, a USB connection that is faking a serial port, and many other devices. (write to com5) which is likely not a com port at all. It just looks like one to make your life easy.
 
Last edited:
Top