Electronic – arduino – How to send ASYNC 8,N,1 serial data over an SPI interface using two Arduino Uno boards

arduinocommunicationdatars232spi

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?

Best Answer

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.