UART Transmit Rs232 to USB - serial-port

I have A UART transmitter written in VHDL and want to transmit data from FPGA Rs232 to a PC that only has a USB.
My question is, is it fundamentally a correct assumption that USB can receive serial data? I'm basically treating the USB as an Rs232 receiver.
If this is correct, what program can allow me to monitor the USB incoming data?
Thanks in advance

USB port includes 1 differential data line + 2 power line, that makes 4 cable(I mean version <= usb2.0).
RS232 is full duplex data transmission protocol which you can't do it with USB2.0(USB3.0 is full-duplex). And it has additional control lines. It doesn't include power line. It has variable voltage levels(up to +-25V).
Simply, yes you need a converter.
USB
RS232

Related

HC-05 Module sending data problem (Mater + Slave)

I've been working with a Siemens PLC to send data using RS232. The communication itself is working perfectly, I can monitor it if I connect the PLC to my PC (via a serial comm port).
Now, I wanted to make this communication wireless. I found out about the HC-05 modules and decided to get a few. I set 2 of them up with my arduino (one as master, one as slave, both paired and using the UART 9600,1,0 which is the same that my PLC uses).
I made the following connections:
PC Connection (with a serial comm adapter)
PLC Connection
Let's say I want to send this string:
<SoH>1RZ<CR>
If I check my serial monitor, I get weird stuff. Like:
##NULL©#NUL
The weird thing is that if I just remove the bluetooth modules and connect the PLC's Rx and Tx to the PC's Tx and Rx, respectively, the data is sent flawlessly. So I know that I have everything sorted out on the PLC/PC side.
Has anyone been through this, or does anyone have a suggestion that I can try?
RS232 typically uses ±12V. Negative voltages between -3V and -15V is logic high and positive voltages +3V till +15V is logic low.
Your bluetooth module on the other hand uses TTL logic. With a voltage range of 0-5V.
0-0.8V is low, 2-5V is high.
So
a) you cannot create the necessary voltage levels
b) you risk to destroy your 5V hardware by connecting it to ±12V.
c) you might run into problems as RS232 also has optional mechanisms for flow control. So Rx and Tx might not be enough.
You'll at least need a TTL-> RS232 level shifter for the PLC side and a USB to TTL serial adapter for the PC

Uart to RS-232 convension

I am working on a project and I use several PIC18F26K83's for this project. For communication between PIC's I use UART. Now I also need to send data with RS232 to the user. As I have understood the main difference between UART and RS-232 is voltage levels. And with PIC I cannot supply proper voltage level that is required for RS232. Because of that UART to RS232 converter's look like a must. (i.e. MAX232) I have two questions.
1) Using UART to RS232 chips is the only option in this case? Are there any alternative ways?
2) I am planning to send UART data directly to the Uart to RS232 converter chip. I do not know how they work, codewise do I need to change anything? Can I directly put UART tx data to the receive pin of these chips? Thanks beforehand.
Using UART to RS232 chips is the only option in this case? Are there
any alternative ways?
For converting from UART to RS-232, using RS-232 level-converter IC like MAX232 is the most economical, reliable and convenient approach. You can build the respective RS-232 line drivers and line receivers using discrete parts but that's not recommended for above mentioned reasons (economical, reliable and convenience).
I am planning to send UART data directly to the Uart to RS232
converter chip. I do not know how they work, codewise do I need to
change anything?
Coding wise nothing will change. Just verify taht the baud rate of your UART is supported by RS-232. Most MAX232 will operates up to 120 kbit/s and MAX3232 operates up to 250 kbit/s.
For typical connection where baud rate is generally 9600 either of IC will suffice.
Can I directly put UART tx data to the receive pin of these chips?
Your UART TX needs to connect to Logic Data Input pin of MAX232 (T1IN (Pin Number - 11) or T2IN (Pin Number - 10)).
Your UART RX needs to connect to Logic Data Output pin of MAX232 (R1OUT (Pin Number - 12) or R2OUT (Pin Number - 9)).
If you connect you UART TX to T1IN (Pin Number - 11) then you will get your RS-232 TX signal on T1OUT (Pin Number - 14) else if you connect you UART TX to T2IN (Pin Number - 10) then you will get your RS-232 TX signal on T2OUT (Pin Number - 7).
Similarly,
If you connect you UART RX to R1OUT (Pin Number - 12) then you have incoming RS-232 data/signal line should be connected to R1IN (Pin Number - 13) RS232 line data input(from remote RS232 system) or if you connect you UART RX to R2OUT (Pin Number - 9) then you have incoming RS-232 data/signal line should be connected to R2IN (Pin Number - 8) RS232 line data input(from remote RS232 system).

Is it possible to use Arduino 2560's serial/USB communication without Arduino bootloader?

I have an Arduino 2560 and would like to send serial data to my PC. However, I am currently not using the Arduino Bootloader because I wanted to use a program that I wrote for an Atmega644 before (as far as I understood, one has to use the Arduino language when using the Bootloader?).
Does anyone know if what I am trying to do is possible with reasonable effort?
Connection to PC via 2560's serial0 does not depend on bootloader (if you plan connection when main program is running). You need 16u2 running to bridge 5V serial UART to USB or you can of course use any other option (e.g. MAX232 or so) to convert 5V UART to USB or RS232. But in case of RS232 double check baud rate error because of 16MHz crystal for particular baudrate.
2560 bootloader just implements firmware flash.

What happen when use rs232 instead of usb in arduino?

I just start a project which is very basic actually. But I need an information. It is about arduino serial communication. Here is the question.
If I connect arduino to computer using TTL to RS232 converter without USB cable then can I still use serial monitor to get some data or what happens ? Assume arduino is programmed before using usb cable, and it is powered externally when usb is not used.
for instance the code just
Serial.println("It is working");
delay(1000);
Thansk a lot.
you will fry it. Standard RS232 use a +-12V level, while arduino use TTL level (0-5V), so you still need a RS232 -> RS232TTL converter. If you use it, then using virtual serial over USB or real hardware serial is exactly the same, except that hardware serial port never appear/disappear when you plug in the arduino (there is not something like plug'n'play in rs232, it is always plugged)

How do I wire a 9 pin serial connection to an Arduino?

My question is pretty straightforward. I've got a big old machine that has an RS-485 connection on the back and I've got a converter from RS-485 to 9 pin serial.
The device I'm connecting to sends out an ACK signal to see if anything is connected. How do I wire up my Arduino (Uno) to the 9 pin serial connector so that I can read the ACK (and in future write back) and display the ACK signal in the Serial Monitor?
I would first check the voltage of the data lines coming from the RS-485 converter. The arduino ports are expecting 0 to 5 volts. Also, look-up the standard for RS-485 to determine what should be on the lines from the RS-485.
Notice, the arduino does NOT directly implement an RS-232 port. Rather, it has a USB port for connecting to a PC. I know that the RS-232 connection does NOT use TTL or 0 to 5V signals, and would question what signal levels are produced by an RS-485.
If the RS-485 does NOT generate 0 to 5 volts, then you will need to get an arduino RS-485 shield.
Finally, in fact, this is what you need to do. I just searched on "RS-485 Arduino" and found multiple hits.
Now, this is the good news, because once you have installed a RS-485 shield then you connect the shield to pins 1&2 on the Arduino and you have a serial connection!!
In most cases you need to wire only RX, TX and Ground signals (RX of Arduino to TX of RS-232 and vice versa). But it really depends on your RS-485 converter, if you need any additional lines. If this converter is half-duplex, may be you will also need to control it with DTR signal. You can use any digital IO on UNO then, and control it in software. Also you need to know the speed of serial port of this old machine, and configure UNO serial port accordingly.

Resources