Go Down

Topic: Serial comm without a UART? (Read 1 time) previous topic - next topic

skyjumper

While reading, I noticed that some boards, like the Mega, have one or more UARTs, while other boards, like the Diecimila, have none. Is it true that without a UART there is no hardware buffering? My application is serial communication intensive, although at a low rate of 4800 baud. Still, am I better off selecting a board with a UART to avoid missing data?


macegr

NewSoftSerial works fine.

Even with a UART you cannot depend on always getting data, so your protocol should detect missing data and deal with it anyway.
Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

RuggedCircuits

It very much depends on what else you are doing. If your application does not do anything particularly intensive then a software serial port (SoftwareSerial, NewSoftSerial) will do the job. But it is by no means a replacement for a hardware serial port, especially if your application starts to grow (either expected or unexpected). With interrupts and proper coding a hardware serial port can handle 4800bps with no missed data. I wouldn't put that much faith in a software serial port if the microcontroller is very busy.

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

skyjumper

Thanks, I was just reading about NewSoftSerial. It was not clear to me if it was intended to be used with or without a hardware UART, because even with a hardware UART buffering is desirable. The downside of NewSoftSerial is that it is interrupt driven on receive only. I'll check out SoftwareSerial.

Unfortunately I don't have control over my protocol, but I can look at the data and determine if it is likely corrupted. Of course that just makes the processor that much more busy. I already need to do some lookup and trig against the data, and spit the results back out the same serial port.

I need to use real RS232, and I found a kit with a MAX232 compatible chip. Is there a similar chip that includes some hardware buffering, ideally that is pin for pin compatible with the MAX232?

macegr

External UARTs exist, but honestly controlling them would take more CPU power than just using NewSoftSerial. And NewSoftSerial is way less CPU intensive than SoftwareSerial...hardly anyone really still uses SoftwareSerial. NewSoftSerial also implements buffers. I have done a lot of testing of NewSoftSerial in the process of adding 20MHz support, and would consider it quite reliable especially at the baud rate you're planning to use. Just load it on your Arduino and give it a try.
Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

retrolefty


While reading, I noticed that some boards, like the Mega, have one or more UARTs, while other boards, like the Diecimila, have none. Is it true that without a UART there is no hardware buffering? My application is serial communication intensive, although at a low rate of 4800 baud. Still, am I better off selecting a board with a UART to avoid missing data?




In fact the Diecimila AVR ATmega328 based board has ONE hardware USART. The ATmega1280/2560 based boards have four hardwae USARTs.

Lefty

kg4wsv

Quote
The downside of NewSoftSerial is that it is interrupt driven on receive only. I'll check out SoftwareSerial.

NewSoftSerial is the replacement for SoftwareSerial (hence "New" in the name).  It is far superior to the old SS.

Quote
I need to use real RS232, and I found a kit with a MAX232 compatible chip. Is there a similar chip that includes some hardware buffering, ideally that is pin for pin compatible with the MAX232?


No.  The MAX232 is a level converting transceiver; that's a very different task than a UART.

There are hardware UART peripherals, but I haven't seen any Arduino code for them.

-j

skyjumper

Ah, the world of ever changeing requirements :-( If the baud rate were to go up from 4800 to 19200, would the NewSoftSerial lib still be able to keep up?

Thanks...

Go Up