1
\$\begingroup\$

Need help with sending ASYNC data between two Arduino UNO R3 micro-controllers.

System design follows:

RS232 modem 19,200,8,N,1 --> UNO-1 D0=(rx), D1=(tx). RS232 parameters cannot be changed because the device is hardcoded. UNO-1 runs sketch sending AT commands and parsing data received. Parsed data must be sent to another RS232 modem but unfortunately this device is hardcoded for 9,600, 7,E,2. There is only one USART o the UNO.

My idea is to take advantage of a 2nd UNO R3 to convert the data to 9,600, 7,E,2.

So.. 19,200,8,N,1 modem --> UNO-1 -->SPI INTERFACE (mstr) --> UNO-2 --> software serial port --> Device 9600, 7, E, 2.

I've tried reconfiguring the USART on the UNO before sending data to each ASYNC device. Problem showed up that unsolicited and important data is received form the 19,200 modem while the UNO is sending data to the other ASYNC device at 9600,7 ,E, 2.

The SPI interface seems to be my only option. Can any one help?

\$\endgroup\$
  • 1
    \$\begingroup\$ Wouldn't it be simpler to use software serial on the first Uno? A tight character-by-character loop should be able to keep up. Or get an MCU with multiple hardware serial ports? \$\endgroup\$ – Chris Stratton May 6 '13 at 17:59
  • 1
    \$\begingroup\$ ... but SPI is synchronous, it uses a clock signal with no standard start, stop, or synchronizing bits. You can't force the hardware to do something it wasn't designed to do. I think @ChrisStratton is right - you will need a software solution. Although, I still don't understand what problems you are actually having with the hardware UART. Your description is kind of all over the place. \$\endgroup\$ – Kurt E. Clothier May 6 '13 at 19:02
  • \$\begingroup\$ @KurtE.Clothier - I think the proposal was that the first board do Asynch Serial to SPI, and the second do SPI to Asynch Serial, but that's rather overcomplicated. \$\endgroup\$ – Chris Stratton May 6 '13 at 19:04
  • \$\begingroup\$ @ChrisStratton - That's what I thought he meant, but it seemed such a strange idea that I couldn't be for sure. People need to learn how to make block diagrams. \$\endgroup\$ – Kurt E. Clothier May 6 '13 at 19:05
2
\$\begingroup\$

You can use Bill Porter's Easy Transfer Library to transfer packets back and forth between two Arduino's, over the I2C or VirtualWire. Note the SPI has a master/slave relationship, so the master side is always polling when idle to recieve. The above ET is async.

I agree @Chris Stratton. I believe a single UNO with one Hard UART at 19200 and one Soft UART at 9600 would do the job.

Regardless, You may find the 19200 side will require the ability to Flow Off the Modem(or Host), likely using either output pin as CTS or XON/XOFF commands. Note that when you assert the CTS the host will not send the next buffer, but will finish its current buffer. Hence the Arduino's rx buffer needs to be large enough, to get one packet and send the next packet. The ATmega328 only has 2K. So your maximum packet would need to be 512 (aka 1/4) or less, minus operating room. etc...

That all said, most modem's (that are less than 15 years old) should support AT&Q5 turning on auto reliable mode with speed buffering. Allowing it to auto detect the baud rate of the DTE.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.