I've been toying with the idea of using a switched packet network for a robotics project. A switched packet network, as I understand it, is a network where all devices on the network connect to a switch device, and switches themselves may be connected to other switches. Each switch will have ports (just like an ethernet switch). Every device on the network has an address and this address is communicated to the switch so that it knows which address is available on which particular port. The device sends packets to the switch. Each packet contains source and destination addresses and a port number. The switch receives the packet and re-transmits it to the destination. In the device software, there are 'listeners' that listen on a particular port, and they get triggered whenever data is received on that port number.
I was thinking it would be implemented using UARTs (optionally with RS422/485 transceivers for robustness and range). Probably a 1Mb/s baud rate, maybe more. The switches would likely have to use DMA for maximum throughput.
The reason I'm kinda of interesting in doing this is because I don't know of any equivalent alternatives. There's ethernet, but it can be complex and requires special hardware and bulky switches and cables. There's SPI, I2C and whatnot but they are master/slave and don't have the speed or range. There's also CAN, which is awesome, but it's not well suited for high bandwidth data transfers and every packet is received by every node. In a switched network, bandwidth is only used when it needs to be so for the same bit rate you can get better throughput. Say you have devices A, B, C, and D plugged into a switch, if A blasts B with data, it will have little effect on the ability of C and D to communicate. Whereas if that happened on a CAN bus, C and D either wouldn't be able to talk or C would constantly interrupt A & B. I suppose ethernet is the closest equivalent that I know of, so I'm probably imagining something like ethernet 'lite' over UART with teensy switches.
At a higher level, I'm thinking there'd be two kinda modes of operation. There'd be datagrams and streams. Datagrams are limited to the max frame size and are sent without any need for acknowledgement. Like UDP. Streams emulate something like a UART. They are a two way connection between two devices on a particular port. Stream data is guaranteed to be received in order kind of like TCP. I'm thinking addresses would be 8 bits with 0xFF as a broadcast address, so datagrams sent to 0xFF are received by all devices.
The switch could have UARTs on it that function like a normal UARTs, and they could be presented on the network as streams. So one possible use could be expanding your UARTs, or sharing UARTs.
You could also bridge an RS232 from the network to a UDP port on a PC, then have a 'virtual switch' running in software using UDP. Brain melts.
Surely this has been done before? Very interested to hear thoughts.
I was thinking it would be implemented using UARTs (optionally with RS422/485 transceivers for robustness and range). Probably a 1Mb/s baud rate, maybe more. The switches would likely have to use DMA for maximum throughput.
The reason I'm kinda of interesting in doing this is because I don't know of any equivalent alternatives. There's ethernet, but it can be complex and requires special hardware and bulky switches and cables. There's SPI, I2C and whatnot but they are master/slave and don't have the speed or range. There's also CAN, which is awesome, but it's not well suited for high bandwidth data transfers and every packet is received by every node. In a switched network, bandwidth is only used when it needs to be so for the same bit rate you can get better throughput. Say you have devices A, B, C, and D plugged into a switch, if A blasts B with data, it will have little effect on the ability of C and D to communicate. Whereas if that happened on a CAN bus, C and D either wouldn't be able to talk or C would constantly interrupt A & B. I suppose ethernet is the closest equivalent that I know of, so I'm probably imagining something like ethernet 'lite' over UART with teensy switches.
At a higher level, I'm thinking there'd be two kinda modes of operation. There'd be datagrams and streams. Datagrams are limited to the max frame size and are sent without any need for acknowledgement. Like UDP. Streams emulate something like a UART. They are a two way connection between two devices on a particular port. Stream data is guaranteed to be received in order kind of like TCP. I'm thinking addresses would be 8 bits with 0xFF as a broadcast address, so datagrams sent to 0xFF are received by all devices.
The switch could have UARTs on it that function like a normal UARTs, and they could be presented on the network as streams. So one possible use could be expanding your UARTs, or sharing UARTs.
You could also bridge an RS232 from the network to a UDP port on a PC, then have a 'virtual switch' running in software using UDP. Brain melts.
Surely this has been done before? Very interested to hear thoughts.