choice of communication method - two Teensy 3.6

Status
Not open for further replies.

matoi

Member
Hello!

I have a project that I want to move from Arduino Uno to Teensy 3.6 because of faster floating point math and some other things. While I'm waiting for the boards to arrive, I'd like to use the time to educate myself on several things where I'm lacking, one of which is the method for communication between two boards. As I'm a beginner in these things, I'd like some help in choosing the option that I should spend time on. The parameters are these:

- two teensy boards need to communicate over a cable and distance of up to 30m
- the communication is primarily in one direction: the "sender" board sends sensor data to the "receiver" board which than does further work
- the data is 8 - 10 bytes, at a rate of 8000 readings per second, so I think it's about 64 - 80 kilobytes/sec = 512 - 640 kilobits/sec
- latency in the communication process should be as minimal as possible (it's a music controller)
- ease of implementation is much welcome, however it's less critical than performance

On the Arduino I've been successfully using I2C (with bus extenders), but that was with lesser amount of data, over a shorter distance, and my testing has shown it to be too slow for further use. So, the "research" has guided me towards CAN bus.

So, do you think CAN bus would be the right choice or is there something better for this situation?

Many thanks,

Mato
 
With CAN bus, you are close to the 1MBit limit, once you factor in overhead.

For a point-to-point connection, I would use a UART in full duplex mode with RS485 transceivers. With a CAT5 cable, >5MBit should be doable. Teensy 3.6 has 2 UARTs with 8-byte FIFOs, so hardware flow control shouldn't be necessary.
 
If hardware flowcontroll is necessary depends on the speed of the code, not if there is a fifo or not :eek:
But its onlytwo wires more so why bother?
With flowcontrol youre on the safe side. without -you dont know.
 
If hardware flowcontroll is necessary depends on the speed of the code, not if there is a fifo or not :eek:
I was thinking of hardware flow control to prevent FIFO overflow, if interrupts are disabled too long. If they aren't, Teensy 3.6 has enough memory for a practically unlimited serial buffer.

But its onlytwo wires more so why bother?
Bi-directional, with RS485 transceivers it's 4. With a CAT5 cable, you have 8 wires. If you use 2 + 2 for RX/TX and 1 for ground, you don't have enough left for the flow control signals.
 
Thanks for the comments!

Please forgive me for one more beginners question - the page:

https://www.pjrc.com/teensy/td_uart.html

under the section "Usable Baud Rates" mentions 115200 as the highest possiblity.

Are higher speeds actually available on Teensy 3.6 by just specifying a higher value in Serial.begin,
or does that require some special operations?
 
Last edited:
You can use a lot higher baud rates. For example I have use 2mbits between teensy and Odroid or UP board and can go higher.

But as mentioned, it is best to use Serial1 or Serial2 as these have a hardware queue so it is more likely to keep up with fewer interrupts necessary. And as also mentioned the need for flow control is more an issue of how fast the side receiving it can deal with it.
 
Based on my experience I would not assume a cheap RS485 module works the way you expect. Specifically I got a few "JBtek" USB-RS485 devices https://www.amazon.com/gp/product/B00NKAJGZM
As I wrote in my Amazon review: "A pair of these worked between a Win7 laptop and Raspberry Pi 2 USB port using a 4-foot cable at 230400, 460800 and 500000 bps. It does not work at 576000 bps or any higher rate on the R-Pi. Between two Win7 ports, it did work at 921600." When I looked at the actual waveforms on a scope, it was OK for lower speeds but the signal looked very dodgy above 500kbps and I would not want to rely on it at any higher speed.

After that I got some FTDI USB-RS485 adaptors from DigiKey http://www.digikey.com/product-deta...tional-ltd/USB-RS485-PCBA/768-1043-ND/2179734 which was quite a bit more expensive at $25 but the waveforms looked perfectly clean; clearly it is a different and better device.

I understand you're looking for a simple UART->RS485 module, not a USB adaptor but just wanted to point out something to watch for.
 
Last edited:
Status
Not open for further replies.
Back
Top