You can use Ethernet.init(pin) to configure the CS pin - What should I use

rayjorgensen

New member
This is my first attempt at Ethernet and Teensy 4.1. I'm attempting to use the WebClient program to figure out if I'm setup right. What should I use to configure the CS pin? What is this pin? I might as well learn something as I plod along.

I got the ethernet kit with the teensy 4.1 directly from PJRC.

Thanks
 
Last edited:
Don’t use that function. It’s only there because the Arduino Ethernet API has it, and that API was designed for different hardware with slightly different functionality. Check out the QNEthernet library (accessible via PlatformIO or the Arduino IDE). Note that there’s lots of noise if you do a search for "QNEthernet" because there’s a bunch of libraries that use that word in their description. Look for version 0.17.0 with just "QNEthernet" in the title.

Once you have the library, check out the examples that come included with it — you can find them from the Arduino IDE in the standard place once the library is installed. Also, please check out the README inside the library install (or on GitHub) because it has a bunch of useful notes. The biggest note for a new user who's used to the Arduino-style Ethernet API (eg. from examples found on the web) is that it's "mostly" compatible, but there are some things you don't need to do, or you need to do a little differently. There's also lots more convenience functions and easier ways to do things.

For example, you don't need to define your own MAC address, and it also has the ability to enable a non-blocking style of coding, which is important for more complex software. Another example: while the EthernetClient::stop() function is available (it blocks), you can also execute a non-blocking close() or even abort() or closeOutput() (a half-close) for other ways to close a TCP connection. (These, you may have guessed, aren't in the Arduino-style API.)

The README can be found here, at the root of the GitHub repo: https://github.com/ssilverman/QNEthernet
I tried to make a compete feature list here: https://github.com/ssilverman/QNEthernet#complete-list-of-features

Hopefully that gets you started.
 
Last edited:
Back
Top