I've been working with Arduino R3 for a long time, but I'm running into some issues with the new R4 Wifi.
My software works just fine when powered via USB-C (from my phone leader USB-C).
My solution uses the SD from a SEEED Studio Ethernet shield (v2) to read data.
However, when I power my R4 Wifi via the barrel jack (6 , 9 and 12 volt), the SD will not work.
If I use an Arduino R3 in combination with regular SD.H there is no issue at all.
I've already had issues getting the SD to work on R4.
Normal SD.H does not work, so I use and also have set pin 10 High ?:
Hi, thx for the reply.
Although i find it weird that I do not have to explicitly set pin 10 high when using the <sd.h> sample on an R3 ?
using sd. sample on the R4 i must add :
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
if (!SD.begin(4)) {
Serial.println("initialization failed!");
while (1);
}
But it does not explain why the initialization fails when i power the R4 via the barrel jack ?
Hi,
Just an update, today ran the same on a brand new R4 Wifi.
Issue is the same
Only when powered by USB-C the SD initialization works and data is read. But when powered via the Barrel Jack (DC) it fails..
Anyone ?
Arduino Ethernet Shield 2 (which is similar to your SEEED Studio Ethernet shield (v2)) work fine with UNO R3 and UNO R4 Minima without any changes to the IDE's SD library examples. But for UNO R4 Wifi, you need to add sufficient delay, say "delay(2000) after Serial.begin() " for the examples to work. So for your issue (as long as your sketch does not depend on the serial monitor being open to run when the powered is powered by DC jack, you need to use appropriate dalay in the right place in your sketch for it to work).
You can test with the SD examples in the IDE with your board to check if they work as suggested.
It seems the issue was the SdFat.h that somehow requires serial ??
I altered the code to SD.h and used below in setup:
(CS Pin 10 Must be set high or else it will not work on this board and extra delay does not seem to have any impact)
pinMode(DISABLE_CS_PIN, OUTPUT);
digitalWrite(DISABLE_CS_PIN, HIGH);
// Initialize the SD card.
if (!SD.begin(4)) {
while(1);
}