Using P2 with Ethernet Featherwing / Wiznet W5500

Hi, I am trying to get my P2 setup to work with the Featherwing board. I have tried to replicate the Argon connectivity by connecting the P2 as follows.

P2 to Featherwing pins

S2 / D17 SPI (SCK)
S0 / D15 SPI (MOSI)
S1 / D16 SPI (MISO)
S3 / D18 SPI (SS)
D3 (nETH_RESET)
D4 (nETH_INT)

This is not currently working for me. I would be grateful if someone can confirm if this connectivity correct or help advise what I need to do ?

Thanks in advance.

Those look like the correct pins. Did you enable:

System.enableFeature(FEATURE_ETHERNET_DETECTION);

It’s recommended to add this in setup(), however you should also enable SYSTEM_THREAD(ENABLED).

Also make sure you’re using Device OS 5.1.0. Ethernet won’t work properly in older versions of Device OS.

4 Likes

Hi, is this statement applicable to P2 only, or should we worry about Argons as well using previous versions of DeviceOS?

1 Like

Only the P2 requires Device OS 5.1.0 to operate correctly with Ethernet. There were two different bugs that were fixed in the 5.x line of P2 firmware, which do not affect the Argon (or any other device).

2 Likes

Hi thanks for the replies. I was using the latest 5.1.0 Device OS. I actually managed to get it working by changing the SPI Select to D4 (the same as used on the Argon). All other pins were kept the same. I was a bit surprised by this as I was using the default SPI port rather than SPI1 and the chip select I had originally connected should have been the correct Select for SPI. D4 is specified as the P2 pin to use for chip select when using SPI1.

Is is possible to change the SPI chip select in the code ? Ideally I would use the Chip Select on S3/D18 as this is what I have routed on the PCB and it would avoid a wire modification.

Sorry, I missed that. D5 must be the CS pin for Ethernet. It has no relation to the default SS pin for the SPI interface.

Any GPIO can be used for a chip select/CS/SS pin. You don’t have to use D4 for SPI1, you can use any available GPIO. However, you also can’t use SPI1 when you’re using Ethernet because the pins conflict, so it really doesn’t matter.

Thank for the quick reply @rickkas7. Has it been hardcoded in the firmware to use D5 ? Is there no way to override to use S3/D18 as the Ethernet SPI CS instead ? I am only using one SPI bus (SPI not SPI1) and it connects to the Wiznet W5500 only. I can fix the issue with a wire mod but it is a bit fiddly and there will be no conflict in my application if I was able to change it in the code.

It’s hardcoded to D5 in Device OS. There may be a feature in the future to allow the three control signals (CS, INT, and RESET) to be reassigned to other pins, but there is no way to do it now except by modifying Device OS itself.

1 Like

We expect a change in deviceOS 5.3 that will allow you to change the pins for the second SPI port, so you can use both ports at once.
(Due somewhere in Q1 2023)

1 Like

@no1089 This means that the only Ethernet Adaptor supported (without re-wiring) is the Particle Ethernet Featherwing until this planned change?

I’m not sure I completely understand the question. For the P2 is there is no existing Ethernet solution as there was none for the P1. However you could put a W5500 on your base board and use as long as you wire it the same way as the Particle Ethernet FeatherWing.

One side note: While it’s easy to mount a P2 on a custom M.2 SoM module board, it doesn’t work with Ethernet on the Particle M.2 eval board. The reason is that the pin definitions for Ethernet are different on the B Series SoM than Feather devices, and the P2 boots up using the Feather pin definitions. Once the pin are reprogrammable this should be less of an issue.

@rickkas7 I am thinking that rather than putting a W5500 on the motherboard for just a proportion of products that demand Ethernet it would be more economic to allow for the connectors for a Featherwing and plug in one when needed.This then requires the same use of pins which is where I thought the Adafruit Ethernet Featherwing (as an example) uses different pins than the Particle Ethernet board. Maybe I am wrong - but the Adafruit Ethernet featherwing I have does not work with the P2 evaluation board.

Got it. The Adafruit FeatherWing does work, but it does not connect all of the pins through, so you need to jumper those to the correct pins. Even if the pins were reassignable, you’d still need to solder those jumpers to some pins.

You need to connect the reset and interrupt pins as described here.

Personally, if I were to do that I would use the Mikroe Eth Wiz Click instead of the Adafruit Ethernet FeatherWing because the Wiz Click brings out all of the necessary signals to the header pins, no soldering of jumpers would be necessary.

2 Likes

RST and IRQ only as I believe CS is D5 by default. The trouble is that whilst that is workable it is not a production solution - like drop in an off the shelf component/module.

At the moment, I am still struggling to get Ethernet to connect, it just stays flashing green rapidly i.e. Ethernet.ready() is never true.

Quick question about Ethernet connection - it isn’t at all predictable as I was expecting, sometimes the LAN connection takes 1-2 seconds, sometimes maybe 30 seconds and sometimes it never connects. Is this an expression of an issue with the router providing an IP address for the device or something else?

Mikroe Ethernet Wiz Click! - I will check that out thanks.

2 Likes

hi chris, what is the status of this? can we bet on being able to change D3,4,5 with ethernet? (i like to be able to use an extra uart/serial2). cheers, frank

oh, and to which pins will we be able to change eth’s nInt and cscn?

You should be able to use any available GPIO for INT, CS, and RESET once configurable. You probably will not be able to select a different SPI interface.

nice!