winchymatt
Member
Hi,
I've been using the Teensy 4 with the WIZ820io Ehternet adapter for the last week or so and having great success at 30Mhz, that is until I added an SPIO SD card. Now I have issues getting the Ethernet adapter to initialize correctly. If an SD card is plugged in the WIZ820 either doesn't initialize or the IP address is wrong after initialization. I've read various posts that seem to be on this issue but they all seem fairly old and it seems that the issue was resolved, which leads me to believe its my breadboard prototype that is the issue!
With this in mind I decided to re-wire the prototype with shorter leads and I have now made things worse! Now with no SD card inserted, the WIZ820 wont initialize at all if the SCK cable is also attached to the SD card adapter, unless I set up SPI mode at 14Mhz. Also added 10K pull-up resistors to both CS lines but made no difference.
So I guess my question is am I simply chasing problems that I'm not going to solve with this setup? I have ordered a SD/WIZ adapter to clean things up a bit in hope that this is the issue. I've also ordered a Teensy 4.1, but I was hooping to use the smaller format 4.0 and my own SD socket on a custom PCB.
( I always seem to get the "Ethernet cable is not connected" message even when the WIZ820 is working without SD card interference )
My test code:
Output with no SD card and SD card SCK wire disconnected:
Output with no SD card and SD card SCK wire connected:
Output with SD card inserted and SD card SCK wire connected:
I've been using the Teensy 4 with the WIZ820io Ehternet adapter for the last week or so and having great success at 30Mhz, that is until I added an SPIO SD card. Now I have issues getting the Ethernet adapter to initialize correctly. If an SD card is plugged in the WIZ820 either doesn't initialize or the IP address is wrong after initialization. I've read various posts that seem to be on this issue but they all seem fairly old and it seems that the issue was resolved, which leads me to believe its my breadboard prototype that is the issue!
With this in mind I decided to re-wire the prototype with shorter leads and I have now made things worse! Now with no SD card inserted, the WIZ820 wont initialize at all if the SCK cable is also attached to the SD card adapter, unless I set up SPI mode at 14Mhz. Also added 10K pull-up resistors to both CS lines but made no difference.
So I guess my question is am I simply chasing problems that I'm not going to solve with this setup? I have ordered a SD/WIZ adapter to clean things up a bit in hope that this is the issue. I've also ordered a Teensy 4.1, but I was hooping to use the smaller format 4.0 and my own SD socket on a custom PCB.
( I always seem to get the "Ethernet cable is not connected" message even when the WIZ820 is working without SD card interference )
My test code:
Code:
// Quick hardware test for SPI card access.
//
#include <SPI.h>
#include "SdFat.h"
#include "sdios.h"
#include <Ethernet.h>
#define SPI_SPEED SD_SCK_MHZ(4)
SdFat sd;
#define ETHCS_PIN 10 // set in Ethernet library, see above
#define WIZ820_RST 9
#define SDCS_PIN 6
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress myIp(10, 0, 0, 2);
void setup()
{
Serial.begin(115200);
// Wait for USB Serial
while (!Serial)
{
SysCall::yield();
}
Serial.println("Start.");
pinMode(WIZ820_RST, OUTPUT);
digitalWrite(WIZ820_RST, LOW); // begin reset the WIZ820io
pinMode(ETHCS_PIN, OUTPUT);
digitalWrite(ETHCS_PIN, HIGH); // de-select WIZ820io
pinMode(SDCS_PIN, OUTPUT);
digitalWrite(SDCS_PIN, HIGH); // de-select the SD Card
delay(100);
digitalWrite(WIZ820_RST, HIGH); // end reset pulse
delay(500);
Serial.println("Init ETH.");
Ethernet.init(ETHCS_PIN); // Most Arduino shields CS pin
Ethernet.begin(mac,myIp);
IPAddress ip = Ethernet.localIP();
Serial.print("My IP Address = ");
Serial.println(ip);
if (Ethernet.hardwareStatus() == EthernetNoHardware) Serial.println("Ethernet shield was not found");
if (Ethernet.linkStatus() == LinkOFF) Serial.println("Ethernet cable is not connected");
Serial.println("Init SD.");
if (!sd.begin(SDCS_PIN, SPI_SPEED))
{
if (sd.card()->errorCode())
{
Serial.print("SD Card initialisation failed! Error: ");
Serial.println(sd.card()->errorCode());
}
}
else
{
Serial.println("SD Card initialised OK");
uint32_t size = sd.card()->cardSize();
uint32_t sizeMB = 0.000512 * size + 0.5;
if( size == 0 ) Serial.println("Can't determine the card size.");
else
{
Serial.print("Size = ");
Serial.print(sizeMB);
Serial.println(" MB");
}
}
Serial.println("Done.");
}
void loop() {
}
Output with no SD card and SD card SCK wire disconnected:
Code:
Start.
Init ETH.
My IP Address = [B][COLOR="#0000FF"]10.0.0.2[/COLOR][/B]
Ethernet cable is not connected
Init SD.
SD Card initialisation failed! Error: 32
Done.
Output with no SD card and SD card SCK wire connected:
Code:
Start.
Init ETH.
My IP Address = [B][COLOR="#FF0000"]0.0.0.0[/COLOR][/B]
Ethernet cable is not connected
Init SD.
SD Card initialisation failed! Error: 32
Done.
Output with SD card inserted and SD card SCK wire connected:
Code:
Start.
Init ETH.
My IP Address = [B][COLOR="#FF0000"]0.0.0.0[/COLOR][/B]
Ethernet cable is not connected
Init SD.
SD Card initialised OK
Size = 32034 MB
Done.