Hello,
I am using a Mkr Zero with the Ethernet shield to answer pings on a network. To connect to this network, I need to set Ethernet as 100MB Full Duplex without auto negociation.
Based on the W5500 documentation, I know it is possible to set it both via hardware and software. As I don't want to try anything risky on the board itself, I am trying to do it via software.

Hence my first question : is it possible to use the Ethernet library while also changing registers without interferences ? I guess so, as my code isn't complicated :
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x59, 0x67 };
byte ip[] = { 192, 168, 100, 10};
void setup()
{
Ethernet.init(5);
Ethernet.begin(mac, ip);
}
void loop()
{
}
My second, more challenging question, is : how do you actually write a piece of code that changes registers via SPI ?
I checked many websites, but they are either not precise enough or are using functions not supported on SAMD boards.
I also tried to replicate what is done in the Ethernet.h library, but functions are used and I can't find their definition anywhere else (for example, the readPSTATUS_W5200() function there : Ethernet/src/utility/w5100.cpp at master · arduino-libraries/Ethernet · GitHub).
For now I'm pretty sure that is the way to start :
#include <SPI.h>
#define DATAOUT 8
#define DATAIN 10
#define CLK 9
#define CS 5
void setup() {
Serial.begin(9600);
pinMode(DATAOUT, OUTPUT);
pinMode(DATAIN, INPUT);
pinMode(CLK, OUTPUT);
pinMode(CS, OUTPUT);
digitalWrite(CS, HIGH);
SPI.beginTransaction(SPISettings(80000000, MSBFIRST, SPI_MODE0));
}
void loop() {
}