How to communicat and program firmware between several T4.1?

was-ja

Well-known member
Hello,

I am planning to develop a device with two Teensy 4.1 boards and need your kind suggestions how to proceed.

The first board (#1) will be connected to the external world over the Ethernet. The second board (#2) should be connected with the first one. I would like to have no other connections, so, USB will be unusable.

The device will be closed, user cannot open it.

1. I need a possibility to upload new firmware for both boards.

2. I need to decide how to connect boards to each other. The board #2 will be fully occupied with all pins, only SDCARD will be free, or, probably I can have one ordinary pin left free. The board #2 run very intensive computations, and have only very small slot of time for communication, about 1ms each one second. This board #2 should send ca. 10kbytes of data to the board #1, and the board #1 should answer with ca. 20-30 bytes.

Am I correct that I can connect QSPI from SDCARD of #2 to other alternative QSPI of #1, who should be the master, and can I achieve 80MBits/s of data transfer rate? I need a SDCARD on the board #1, and both #1 and #2 will be fully occupied with 2 psram chips.

How about uploading new firmware? Please, suggest me can I somehow send new firmware from #1 to #2 by SPI, locally store it in psram, and update it by calling appropriate function, or there are other alternatives to do updates?

Thank you!
 
1. I need a possibility to upload new firmware for both boards.

See the thread below for a method/code to update firmware. It has been tested with Serial (USB and UART) and SD card, but it could be adapted to Ethernet, SPI, I2C, etc.

https://forum.pjrc.com/threads/4316...dates-changes-for-flashing-Teensy-3-5-amp-3-6

2. I need to decide how to connect boards to each other. The board #2 will be fully occupied with all pins, only SDCARD will be free, or, probably I can have one ordinary pin left free. The board #2 run very intensive computations, and have only very small slot of time for communication, about 1ms each one second. This board #2 should send ca. 10kbytes of data to the board #1, and the board #1 should answer with ca. 20-30 bytes.

Am I correct that I can connect QSPI from SDCARD of #2 to other alternative QSPI of #1, who should be the master, and can I achieve 80MBits/s of data transfer rate? I need a SDCARD on the board #1, and both #1 and #2 will be fully occupied with 2 psram chips.

I don't know about using the SD card interface for Teensy-Teensy communication. Are the USB connectors available? Seems like that would be a lot more straightforward, and very fast. You will need a way to pause the intensive computation on board #2 to update its firmware.
 
Thank you very much, joepasquariello, for your kind answer!


exactly what I have searched for, thank you very much!

Are the USB connectors available? Seems like that would be a lot more straightforward, and very fast.
Yes, they are free. I am trying to search web, but did not clearly understand what kind of module should I use for Teensy4.1-Teensy4.1 connection over USB? Should I use USB hub between them, or I can connect D+ -> D+ and D- -> D- directly?

Would you please, help me to find appropriate info.

Thank you!
 
but did not clearly understand what kind of module should I use for Teensy4.1-Teensy4.1 connection over USB? Should I use USB hub between them, or I can connect D+ -> D+ and D- -> D- directly?

To connect more than 2, you'll definitely need a USB hub.

The critically important info is understanding USB host vs device. In a USB bus, there must be exactly 1 host. Normally the host is a PC and normally the devices are peripherals like keyboard, mouse, touch screen, musical instruments, etc. You can connect many devices. Communication only happens between the host and each device. The devices can't talk to each other. You can't connect another host. The main thing to remember is you must have exactly 1 host which can (theoretically) communicate with up to 127 devices, if you have enough hubs.

Hubs let you connect lots of devices. Each "downstream" port on the hub can connect to either 1 device, or to the upstream port on another hub. But you can't connect more than 1 device to each downstream hub port. Simply connecting the D+ wires together on more than 1 device absolutely will not work. Each downstream hub port can connect only 1 device (or the upstream port of another hub).

Teensy 4.1 has 2 USB ports. The micro-B connector acts as a USB device. The 5 pins in the PCB act as a USB host.

To make this work, you'll need to choose one Teensy 4.1 to be the USB host. All the others need to work as USB devices. You would plug all the devices into a USB hub (or a tree of hubs if yo need a large number of devices), and then connect the hub to the one Teensy 4.1 which acts as the host.
 
@PaulStoffregen, thanks for this good info. I was (naively?) thinking he could somehow connect them back to back and use them as USB serial ports. He originally asked about the possibility of using the SD card pins on his board #2. Can you comment on that?
 
Oh, super! Thank you very much, PaulStoffregen, for detailed info regarding USB communications!

Finally, let me shortly asking the difference in the speed and latency between
USB-USB and SDCARD-SDCARD communications between 2 teensy4.1 and possibility to do this at least for one board in DMA mode. Actually it may be very important for me to make final decision.

Thank you very much!
 
Back
Top