jimmie
Junior Member
Posts: 86
|
Post by jimmie on Aug 15, 2019 12:36:41 GMT
I have the following Adafruit Ethernet Shield (W5500). I tried the ShieldBuddy mainSD example but it dd not work.
I tested the shield on an Arduino Mega using the link below and it works fine.
I have tried with the ShieldBuddy but no luck. BTW, the Ethernet port works fine. Here ist he code I am using for the SB:
#include <SD.h> #include <SPI.h> #include <Ethernet.h>
void startSD { pinMode(53, OUTPUT); digitalWrite(53, HIGH);
if (!SD.begin(4)) { SerialASC.println("initialization failed!"); SDFail = true; ////return; } else { SerialASC.println("SD initialization D O N E."); } delay(1000); }
Can the community share a library and example code to get the card to work?
Thanks in advance.
|
|
|
Post by Admin on Aug 15, 2019 13:53:50 GMT
This works OK on our rig. It could be a problem with the SD card.
|
|
jimmie
Junior Member
Posts: 86
|
Post by jimmie on Aug 15, 2019 13:58:52 GMT
Thank you, but I tried multiple cards 2GB, 8GB and 32GB.
I have a suspicion. There is an SD library in and Arduino also C:\Hitex\AURduinoIDE\Eclipse\AurduinoMulticoreUser\aurix\libraries.
How does the compiler pick which one to use?
Thanks in advance.
|
|
|
Post by Admin on Aug 15, 2019 14:33:04 GMT
If you are using the Eclipse IDE then there is a potential problem when using the Ethernet2 shield. To use the W5500 driver for the Ethernet and SD card you need to delete the contents of the existing C:\Hitex\AURduinoIDE\Eclipse\AurduinoMulticoreUser\aurix\libraries\Ethernet and replace them with the Ethernet2. The Ethernet2 library used by the Arduino IDE is usually in:
C:\Users\YOURNAME\Documents\Arduino\libraries\Ethernet2.
Delete the contents of C:\Hitex\AURduinoIDE\Eclipse\AurduinoMulticoreUser\aurix\libraries\Ethernet and copy the contents of C:\Users\YOURNAME\Documents\Arduino\libraries\Ethernet2 into this directory.
The program will then build using the W5500 driver and the SD card now works.
One of the problems when using the Eclipse IDE is that libraries for shields are not installed automatically. You have to copy them into the C:\Hitex\AURduinoIDE\Eclipse\AurduinoMulticoreUser\aurix\libraries and then add them to the include path in the Eclipse compiler configuration.
|
|
jimmie
Junior Member
Posts: 86
|
Post by jimmie on Aug 15, 2019 14:38:41 GMT
Thank you but I have never used the Eclipse IDE.
How do I do this with the Arduino compiler?
Thanks again.
|
|
|
Post by Admin on Aug 15, 2019 14:43:15 GMT
The problem does not occur with the Arduino IDE as it makes sure that the correct libraries are installed. Make sure you have #include "Ethernet2.h" otherwise you will still be using the W5100 driver.
|
|
jimmie
Junior Member
Posts: 86
|
Post by jimmie on Aug 15, 2019 15:04:43 GMT
The problem does not occur with the Arduino IDE as it makes sure that the correct libraries are installed. Make sure you have #include "Ethernet2.h" otherwise you will still be using the W5100 driver. I am definitely using #include "Ethernet2.h" but the SD card is not recognized on that shield.
Also, which SD library does the Arduino pick if the disk has two libraries with the same name?
======================================================== Update:
There is something buggy with the Ethernet2 implementation on the ShieldBuddy.
Here is my experience after wasting days on this:
1) With a W5100 shield - Use Ethernet 1.1.2 library - In this case, SD and Ethernet work.
2) With a W5500 shield - Need to use Ethernet2 library - in this case, Ethernet works (most of the time) and SD does not work (most of the time).
Several emails to Hitex have gone unanswered. Can Hitex save us the frustration of telling us what to use?
I would like to thank the forum Administrator who has helped me a lot.
|
|