w5500 with teensy4.1

davidchen

Member
I'm using Teensy4.1 plus w5500 module. And use Artnet Library to control ws2812, but when I receive more than 7 universes, it will start to delay later, I would like to ask if there is a solution. Thanks!
 
Have you considered using the Ethernet Kit to use Teensy 4.1’s built-in Ethernet PHY? The QNEthernet library, for example, lets you change a number of settings and sizes. I’ve personally successfully used dozens of universes on a Teensy 4.1.
 
As a first quick and easy thing to try, edit w5100.h inside the Ethernet library. Look for this:

Code:
// Safe for all chips
#define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)

// Safe for W5200 and W5500, but too fast for W5100
// Uncomment this if you know you'll never need W5100 support.
//  Higher SPI clock only results in faster transfer to hosts on a LAN
//  or with very low packet latency.  With ordinary internet latency,
//  the TCP window size & packet loss determine your overall speed.
//#define SPI_ETHERNET_SETTINGS SPISettings(30000000, MSBFIRST, SPI_MODE0)

Especially if you're receiving fairly large UDP packets, faster SPI clock might help.

I hope you'll let us know how many more LEDs using faster SPI clock lets you receive. I'm pretty sure double the clock speed will give less than 2X because the W5500 chip has overhead for each transfer.
 
As a first quick and easy thing to try, edit w5100.h inside the Ethernet library. Look for this:

Code:
// Safe for all chips
#define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)

// Safe for W5200 and W5500, but too fast for W5100
// Uncomment this if you know you'll never need W5100 support.
//  Higher SPI clock only results in faster transfer to hosts on a LAN
//  or with very low packet latency.  With ordinary internet latency,
//  the TCP window size & packet loss determine your overall speed.
//#define SPI_ETHERNET_SETTINGS SPISettings(30000000, MSBFIRST, SPI_MODE0)

Especially if you're receiving fairly large UDP packets, faster SPI clock might help.

I hope you'll let us know how many more LEDs using faster SPI clock lets you receive. I'm pretty sure double the clock speed will give less than 2X because the W5500 chip has overhead for each transfer.


I edit the w5100.h


Code:
// Safe for all chips
//define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)

// Safe for W5200 and W5500, but too fast for W5100
// Uncomment this if you know you'll never need W5100 support.
//  Higher SPI clock only results in faster transfer to hosts on a LAN
//  or with very low packet latency.  With ordinary internet latency,
//  the TCP window size & packet loss determine your overall speed.
#define SPI_ETHERNET_SETTINGS SPISettings(60000000, MSBFIRST, SPI_MODE0)

I modify the SPI clock and reburn the code .
But all led still lag after over 7 universe.
 
Have you considered using the Ethernet Kit to use Teensy 4.1’s built-in Ethernet PHY? The QNEthernet library, for example, lets you change a number of settings and sizes. I’ve personally successfully used dozens of universes on a Teensy 4.1.

Can I use my w5500 module toUse QNEthernet library?
I will try it first btw how much universes can use after you try. thx!
Are you using one pin or multiple controls?
 
As a first quick and easy thing to try, edit w5100.h inside the Ethernet library. Look for this:

Code:
// Safe for all chips
#define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)

// Safe for W5200 and W5500, but too fast for W5100
// Uncomment this if you know you'll never need W5100 support.
//  Higher SPI clock only results in faster transfer to hosts on a LAN
//  or with very low packet latency.  With ordinary internet latency,
//  the TCP window size & packet loss determine your overall speed.
//#define SPI_ETHERNET_SETTINGS SPISettings(30000000, MSBFIRST, SPI_MODE0)

Especially if you're receiving fairly large UDP packets, faster SPI clock might help.

I hope you'll let us know how many more LEDs using faster SPI clock lets you receive. I'm pretty sure double the clock speed will give less than 2X because the W5500 chip has overhead for each transfer.

After I modified the library at Arduino>libraries>Ethernet>src>utility>"w5100.h" file many times.
Code:
// Safe for all chips
//#define SPI_ETHERNET_SETTINGS SPISettings(14000000, MSBFIRST, SPI_MODE0)

// Safe for W5200 and W5500, but too fast for W5100
// Uncomment this if you know you'll never need W5100 support.
//  Higher SPI clock only results in faster transfer to hosts on a LAN
//  or with very low packet latency.  With ordinary internet latency,
//  the TCP window size & packet loss determine your overall speed.
#define SPI_ETHERNET_SETTINGS SPISettings(30000000, MSBFIRST, SPI_MODE0)

I also modify the library at Arduino>libraries>Ethernet>src>"Ethernet.h" .
Code:
// Configure the maximum number of sockets to support.  W5100 chips can have
// up to 4 sockets.  W5200 & W5500 can have up to 8 sockets.  Several bytes
// of RAM are used for each socket.  Reducing the maximum can save RAM, but
// you are limited to fewer simultaneous connections.
#if defined(RAMEND) && defined(RAMSTART) && ((RAMEND - RAMSTART) <= 2048)
#define MAX_SOCK_NUM 1
#else
#define MAX_SOCK_NUM 1
#endif

Now,I try to received 10 universes and control 1536Led via two Pins . (1Pins for 768). It look like smoothly. thx !
I will try to control more than 10 universe.

If anyone know the maximum universes via W5500 to teensy4.1 . We can discuss it!
 
Which library are you using to control the LEDs?

A non-blocking library like WS2812Serial or OctoWS2811 will allow better performance. Blocking libraries like Adafruit NeoPixel or FastLED's default WS2812 driver will hog the CPU, which reduces your ability to receive data.
 
I use Adafruit Neopixel to control ws2812.
I have a question, if I simply use Adafruit NeoPixel to control the light strip (without using the network) to control the same number of light points, it seems to be able to control it very smoothly. But after using the network to receive Artnet control, it will freeze, which makes me think it's just a network problem

Or as you said, is it because of using the Adafruit Neopixel library that causes the CPU to drop and thus cause the network reception to freeze?
Thank you very much for your reply!
 
Switch to WS2812Serial. It will very likely make a huge improvement. (curious to hear how much...)

Sorry, don't have time to write a long message about the tech details. Blocking vs non-blocking LEDs have been discussed many times. You can probably find those messages by search if you really want to deep dive into how it works.

WS2812Serial has similar functions to Adafruit Neopixel. But only certain pins are supported. Look at any of the examples in File > Examples > WS2812Serial for details. As long as you use a supported pin, it should be easy to replace Adafruit Neopixel.
 
Sorry, I would like to ask for advice, I switched to WS2812Serial to control, although it is a little smoother, but I found that my Artnet reception will start to freeze after the 8th universe.
I want to ask if there is a solution on the Internet.
I am now using w5500 module and Artnet library and modified the parameters in w5100.h. I would like to know whether switching to QNEthernet or NativeEthernet can improve network performance
 
Those two Ethernet libraries you mention don’t work with the W5500 hardware. They work with the built-in PHY and the Ethernet Kit. Having said that, maybe you were planning on using the Ethernet Kit?

I can tell you that I have personal experience running the lighting for some professional shows using a Teensy 4.1 and QNEthernet. What you need to do for higher frame rates without dropping packets is to utilize the UDP buffering feature. (See https://github.com/ssilverman/QNEthernet/blob/master/README.md#udp-receive-buffering.)
 
but I found that my Artnet reception will start to freeze after the 8th universe.
....
I am now using w5500 module and Artnet library and modified the parameters in w5100.h.

Can you be specific about the settings you're using?

In msg #4 you indicated editing the SPI clock to 60 MHz! That's twice the rated speed of the W5500 chip, and twice the rated speed of the SPI port on Teensy 4.1. Both are officially rated for only 30 MHz. While 60 MHz can probably work much of the time, iit's effectively overclocking by 100%, which is bound to have problems.
 
Yes, I originally set the SPI clock to 60Mhz, but after testing, I found that 60MHZ would be problematic, so I changed the SPI clock to 40-45Mhz. Only in this way can it run, otherwise Teensy will keep restarting.

I currently use Unity to send Artnet information and receive it through W5500 Module.
In Teensy, I used Artnet.h, WS2812Serial.h and modified SPI clock.
I declared three WS2812Serial pins. The three pins control 768Led, 768Led, and 384Led respectively.
And use the received 12 universes to control.
The above configuration will cause lag.
 
Thanks for your reply!
I will try the built-in PHY Ethernet kit to receive Artnet and try OctoWs2811 control Led .
I think I'm stuck now for two reasons.
One is because I'm not using the built-in Ethernet kit.
The second is because I am not using the Octows2811 module to control the lights.

Caused my network to be stuck and CPU to be stuck.

I don't know if i'm thinking right
 
Back
Top