1

I'm working on a project where I control a large number of RGB led strips with Teensy Arduino boards. I've tested it with a subset of the boards and everything seems to be fine until I connect them all and start sending my Byte arrays to the SerialPort. As a basis I'm using the OctoWS2811 library in the teensy firmware to address the LEDs (https://www.pjrc.com/teensy/td_libs_OctoWS2811.html). And send my byte array data using a C# application.

I've been testing with 2 usb hubs each having 6 Teensy boards. Separately, everything seems to be functional. But as soon as I connect both USB hubs. I keep getting Semaphore timeout exception

System.IO.IOException: The semaphore timeout period has expired.
    at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
    at System.IO.Ports.SerialStream.EndWrite(IAsyncResult asyncResult)
    at System.IO.Ports.SerialStream.Write(Byte[] array, Int32 offset, Int32 count, Int32 timeout)
    at System.IO.Ports.SerialPort.Write(Byte[] buffer, Int32 offset, Int32 count)

At first glance I seem to be able to send a couple of frames successful after it starts throwing these semaphore exceptions on a couple of the Teensy's.

Any advice on what I could try to prevent this.

It seems like reducing the size of the byte array that's being sent to the Teensy's improves the reliability a but, but not by a lot. So this could only be a coincidence.

It does also seem that a couple of frames do manage to be sent, but after a short while everything starts falling apart.

Thank you in advance for your help.

Kind regards

Ben
  • 166
  • 2
  • 19
  • Are you using the 245 buffer chip as recommended? Do you have a scope to do any debugging? – jdweng Oct 07 '20 at 17:05
  • The fact that it seems to depend on the number of usb hubs or boards attached, could point to a power issue. Are you powering all these boards from the Arduino or are you using extra power supplies? – PMF Oct 07 '20 at 18:04
  • @jdweng The buffer chip you're mentioning apears to be needed for the output signal if I'm not mistaken? I was successfully able to send animations to the LEDs by sending them colors directly from the firmware. So it seems like the problem is with what signal is going into the teensy's. There are also a number of teensy's that are functioning fine with the 2 USB hubs. – Ben Oct 08 '20 at 08:48
  • @PMF The USB hubs have their own powersupply. I did just now have success with replacing a USB cable. I had one teensy that always gave me exceptions in the scenario. I replaced the cable and it disappeared. After putting back the original cable, the problem was back. IT is going to order a couple of new cables for me to test with. If I have more success I'll let you know :) – Ben Oct 08 '20 at 08:50
  • I suspected there was a power supply issue and wasn't sure how much current the boards were using. – jdweng Oct 08 '20 at 09:47
  • Hi all, just to get back to you, and anyone who might encounter similar issues. The problem was caused by the USB hubs. Replacing the cables didn't do much good. My guess would be that the USB2.0 didn't have sufficient bandwidth when data transfer peaked. I replaced the usb hubs with USB 3.0 ones and everything was smooth sailing from thereon out. – Ben Oct 20 '20 at 12:10

0 Answers0