Pages: [1]   Go Down
Author Topic: Serial comm without a UART?  (Read 1092 times)
0 Members and 1 Guest are viewing this topic.
Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 3
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

 
Logged

SF Bay Area
Offline Offline
Edison Member
*
Karma: 11
Posts: 1244
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2855
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 3
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

SF Bay Area
Offline Offline
Edison Member
*
Karma: 11
Posts: 1244
Arduino Ninja
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 3
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Pages: [1]   Go Up
Jump to: