Serial communication using USB - serial-port

I am trying to connect ATmega128 uart to PC using USB-to-RS232 converter so that PC can receive and transmit data from microcontroller using hyper terminal. I set the correct stop bits and baud rate in hyper terminal. It doesn't seem to work.
Can any one tell me if this is possible by USB-to-RS232 converter and if not what other options are there for serial communication between PC and microcontroller ?

You should be able to do this without any issues. I'd suggest putting your USB-to-RS232 cable in loopback mode first (if possible) to ensure you can communicate, then connect it back up to your MCU.
If you aren't seeing what you expect the first thing to look at are the settings, specifically the baud rate. Since your USB-to-RS232 cable is from a third party vendor I'd assume that your settings on the host side are OK. So you should look in to your MCU code to ensure that all your clocks are running at the proper speed and you have indeed performed the correct calculations to achieve your desired baud rate. Debugging here to ensure you are transmitting data out of the device is important.
Additionally, there are tools that can help you debug. Portmon is a tool from Microsoft that lets you look at the serial data path on the host side. I'd also recommend a USB analyzer, such as an Ellisys, that will allow you to view data going across the line from your MCU to the host.

Related

Selecting the right USB - RS232 for some old hardware

So I'm trying to revive an old (late 90's) noise logger (Acoustic Research Labs EL-215 for those familiar) and I've been looking into USB-RS232 connectors. I have port settings from the original documentation which are as follows:
EIA RS-232-C
1200 - 19200 Baud
8 Data Bits
2 Stop Bits
Hardware Flow Control
(note: parity isn't specified)
I have an old Belkin F5U109 adapter, which hasn't worked so far - so I'm trying to work out how the Belkin is different to other USB-RS232 adapters. I also read that Prolific PL2303 and FTDI seem to be the leading USB-RS232 chipsets that nearly all modern USB-RS232 adapters seems to use.
What features should I look for in an adapter to give me the best chance of making it work with my hardware? Whats the main difference between the Prolific and FTDI chipsets?
I don't care which operating system I need to use as I'm proficient in Linux and can easily spin up a VM with VirtualBox or qemu if need be. Hardware uses DOS software, so could also run dosbox if required. Worst case I can reverse engineer the whole thing and write my own program to communicate with the EL-215, but I'd rather avoid that!
Any help much appreciated!
Edit: Here's what I've tried so far
That link seems to suggest that software flow control (XON/XOFF) doesn't work. I've investigated the device in trying to connect to and found that DTR and DSR are not connected, but RTS and CTS are. When I run the DOS software (through Windows XP on a VirtualBox VM, Belkin drivers installed, COM1 8,2, hardware flow control, no parity) which is supposed to connect with the device, I get connection error - it times out waiting for response from device.
I put the multimeter on the pins of the Belkin while using the DOS software. DTR goes from -9v to +3v momentarily, as does RTS. Obviously DTR is ignored by the device because its not connected, so RTS going high should trigger a CTS response from the device but it doesn't.
So I thought that the Belkin is perhaps waiting for DSR to go high before doing anything, so I bridged DTR to DSR, but still no response. I found it strange that DTR only momentarily goes high as if properly implemented it should stay high for the entire duration of the connection.
It's either the Belkin logic levels are not high enough (I think RS232 needs >3v to trigger) or it incorrectly implements hardware flow control. Belkin information about the adapter refers to connecting a PDA so maybe its a specific implementation for those devices...?
I have ordered FTDI and Prolific PL2303 adapters in the hopes that they might work better. Backup plan is to build a circuit to control RS232 pins individually with like an Arduino or something.

Serial communications over stlink with stm32f4discovery, is it possible?

I have the following: STM32F407G-DISC1. My goal is to communicate (sending strings back and forth) between my pc and the mcu over serial and I currently am able to do so using the micro-usb (otg) port, while powering separately using the mini-usb st-link port (so using two cables).
Is it possible to use the mini-usb port for serial communications? (eliminating one of the cables)
I have read the user manual and my interpretation is that this is not possible without physical modifications. But I am a beginner and would like to verify I am correct in this interpretation. I have researched thoroughly however most sources seem to not refer to this specific board and it is my understanding with the newer version of st-link it uses this should be achievable.
It is possible - just send the messages via the USART2
You need to solder those two wires as they screw up the design.

How to send data from 8051 input ports to esp8266?

Please pardon me if this question comes as a little too basic but I have tried searching almost everywhere but haven't found a clue.
I am using the esp8266 module and have uploaded the firmware in it. I have also set it as "Access point" so that other modules are able to connect with it. My problem is that I want to control it pro-grammatically through an 8051 micro-controller. I have searched online and there is a lot of documentation on how it program it through arduino, but that doesn't solve it for me. I want to use assembly language to build a serial protocol that communicates the data from 8051 to esp8266 and then to the connected modules (such as Android device).
My question really is, "would it be possible to just connect TX/RX of 8051 to RX/TX of esp8266 and write a code in assembly that transfers data as I desire to esp8266? Or, do I have to do something else?".
At the moment the only documented way for a host controller (the 8051 in your case) to talk to the ESP8266 is to use the serial port (there is a slave SPI port but the mechanism for driving it isn't known yet). So you will have to make up a little protocol to send and receive commands and data (assuming that the standard support for an enhanced AT command set isn't sufficient for you).
The baud rate can go a lot higher than the default 115200bps, if you need it to (although I'm not sure if the 8051 could keep up).

Programming Arduino's from a centralized location

I have 16 Arduinos that are in very tight spaces and hard to get to when I need to reprogram them with my FTDI cable. I would like to have or create some sort of centralized place where I can connect my FTDI cable, make some sort of selection (switch of some sort), which will then connect the pins my cable is on to the selected arduino.
Does anyone have any thoughts on how this can be accomplished? I've toyed with transistors, but that takes a lot of them and didn't quite work.
Are there any premade solutions that are out there that I have yet to find?
Thanks very much!
Here is a thought! TCP to Serial.
Sound complicated.
Not really.
Note from AVRDUDE's manual the following
For programmers that attach to a serial port using some kind of higher
level protocol (as opposed to bit-bang style programmers), port can be
specified as net:host:port. In this case, instead of trying to open a
local device, a TCP network connection to (TCP) port on host is
established. The remote endpoint is assumed to be a terminal or
console server that connects the network stream to a local serial port
where the actual programmer has been attached to. The port is assumed
to be properly configured, for example using a transparent 8-bit data
connection without parity at 115200 Baud for a STK500.
With this, One could place your Arduino's behind your choice of TCP to Serial Server. Which is available in several forms. Cisco has a gang TS (but that is expensive, unless used). lantronix (and others have single end point devices. But then for Linux, there is "Net2Ser" which can serve up all your ttyS (aka Serial/COM ports).
With the later you could use a raspberry or TP-Link TL-WR703N (
In the latest IDE 1.5.6r2 add one entry for each TCP-to-Serial Port to ./Arduino/hardware/arduino/avr/programmers.txt file. While replacing the IP and Port with corresponding values.
TCP2001.name=TCP 2001
TCP2001.communication=serial
TCP2001.protocol=stk500v1
TCP2001.program.protocol=stk500v1
TCP2001.program.tool=avrdude
TCP2001.program.extra_params=-Pnet:192.168.1.100:2001
TCP2002.name=TCP 2002
TCP2002.communication=serial
TCP2002.protocol=stk500v1
TCP2002.program.protocol=stk500v1
TCP2002.program.tool=avrdude
TCP2002.program.extra_params=-Pnet:192.168.1.100:2002
...
Additionally change "protocol" to "upload.protocol" the following line in ./Arduino/hardware/arduino/avr/platform.txt
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
to
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{upload.protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
With this you can use "Upload Using Programmer" with the selected programmer to send over TCP, rather then use the Upload.
That all said, it will only work on Linux.
avrdude: ser_open(): network connects are currently notimplemented for Win32 environments

Check for Serial Port GSM Modem Connection status

I have a GSM ModeM connected to a serial port, and I use it so send SMS upon certain events.
Since it is not Plug-and-Play, I am confused as to how I'll detect its connection status. Win APIs like GetCommState will obviously not work.
I could periodically send packets of data and check whether the data is being consumed or not, but I'm wary about the risks of polling over performance and clogging up the buffers which might be in use.
So, is there any other method, or some interrupt based thing, which I could use to check whether is still connected, via a serial port, to my system?
I'd be grateful for any help on this.
Thanks.
From Windows 7 onwards, use Windows Mobile Broadband API to get information about a GSM modem.
Serial ports are very primitive communication devices, they date from the very early days of computing. It is what you plugged your ASR-33 teletype into to start banging in your Fortran program. The only reason they are still around is because they are simple, hardware vendors like them because they don't have to spend money developing and supporting a custom api to use their device.
Still, even back in the sixties did a computer have a need to find out if a teletype was attached. Which is done through the hardware handshake signals. The DSR signal, Data Set Ready, is turned on by the device when it is powered up. If you use the .NET SerialPort class then you can check that signal with the SerialPort.DsrHolding property. If you use the winapi then use GetCommModemStatus(), MS_DSR_ON flag.
That still only tells you that some device is attached. If you want to find out that it is the modem that you wrote your program for then you can interrogate it with AT commands, a protocol that's specific to modems. No vendor implements this exactly the same way but you can usually count on an identification from the modem with the ATI command. Check the programming manual for the modem for details.

Resources