fluido
Posts: 2
Joined: Tue Nov 22, 2011 2:34 pm

Re: The equivalent of four UARTs

Tue Nov 22, 2011 2:49 pm

Hello there. I have had a sort of pet project buzzing around the cobwebs of my skull for some time, that the appearing of the Raspberry Pi may make a bit more probable. This project would work with a grid, say, of 5X5 units, each communicating to the N, E, S and W neighbour.

In the happy past I used serial ports, and I would happily go on with my planning if the R-Pi had, within its already impressive specs, not one but 4 UARTs.

Do you hardware tinkerers have an idea on whether it will be an easy task to equip the board with three more UARTs? Or, since I know both I2C and SPI are serial buses, would it be possible to connect, say, the rows via I2C and the columns via SPI? Can such buses work on distances of, say, a couple of meters of cable? And can data travel bi-directionally on these busses?

Thanks in advance

eggn1n3
Posts: 106
Joined: Fri Jul 29, 2011 10:36 am

Re: The equivalent of four UARTs

Tue Nov 22, 2011 2:57 pm

You could use USB to RS232 convertors. They cost between $3-20 USD. Try using the convertors with PL2303 chipset as they are real RS232 convertors.
http://www.buyincoins.com/deta.....t-351.html

fluido
Posts: 2
Joined: Tue Nov 22, 2011 2:34 pm

Re: The equivalent of four UARTs

Tue Nov 22, 2011 3:03 pm

mm yes. I'd have to use a USB hub and four converters for each node. May find them cheap. But it's a lot of cables and connectors. I hope somebody comments on the use of those busses - it would be a much more elegant solution.

Thanks!

SRSullivan
Posts: 10
Joined: Mon Nov 14, 2011 2:52 am
Contact: Website

Re: The equivalent of four UARTs

Tue Nov 22, 2011 3:49 pm

Quote from fluido on November 22, 2011, 14:49
Do you hardware tinkerers have an idea on whether it will be an easy task to equip the board with three more UARTs? Or, since I know both I2C and SPI are serial buses, would it be possible to connect, say, the rows via I2C and the columns via SPI?

I suspect, but can't say for certain that you should be able to use the I2C between nodes.

One specific option for getting more Uarts is an I2C UART chip [2] like the one used in the Arduino Multiserial Shield [1].

[1]: http://www.strichlabs.com/prod.....ial-shield
[2]: http://hackstrich.sarahemm.net.....d#Overview

kernelcode
Posts: 16
Joined: Tue Nov 22, 2011 3:47 pm

Re: The equivalent of four UARTs

Tue Nov 22, 2011 3:57 pm

I have no idea how you plan on soliciting the actual communication - but the problem I can see with I2C and SPI is that they are both master-slave buses. (and yes, both are bi-directional).
You could, for instance, have a node surrounded by 4 others (N, E, S, W as you put it), with the centre being the master on SPI. You would then require 4 chip-select lines to select which neighbour you want to communicate with.
Or, if it's possible to set the I2C address of the R-Pi in slave mode, you could have a unique address for each node, but you still need a master to control communication, i.e each node will probably not be able to communicate directly with each other without some elaborate hw/sw tricks.
With regards to cable length, I'm pretty sure you'll be OK if you keep the clock speed low enough. If UART (TTL?) works, then I2C and SPI should too... I think

shiftyphil
Posts: 21
Joined: Thu Nov 17, 2011 12:32 am

Re: The equivalent of four UARTs

Tue Nov 22, 2011 11:01 pm

I doubt you can use the SPI or I2C directly - even if slave mode is supported, wiring up the necessary interrupts and chip selects is likely to make it nearly impossible (or at least very messy).

Using an SPI/I2C UART chip (eg. http://ics.nxp.com/products/bridges/all/) makes more sense - or alternatively, a micro-controller in the same role could even offload some of the communication overhead.

For example, a PIC24FJ64GA306 can connect to the host via SPI, has 4 UARTS and costs less than $4. A more expensive option would be to move up to the dsPIC series to get DMA support, and of course other microcontroller families will have products that could do the same job.

Return to “General discussion”