Ethernet Shield 2 and DIN Mount not working.

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
fatdollar
 
Posts: 2
Joined: Wed Oct 26, 2022 2:05 pm

Ethernet Shield 2 and DIN Mount not working.

Post by fatdollar »

I have an Arduino Mega 2560 Rev 3 and an Ethernet Shield 2 that I'm developing into an industrial controller with and HMI (via HTML/AJAX).

The program works just fine when I've got the shield nested on top of the Mega. I'm able to data log and update my HMI even send control commands via the web interface to start/stop the process.

The problem comes when I attach them to the DIN Rail mounts for mounting inside the Panel enclosure of the environment. My SPI or something seems to not work and so the SD card isn't initializing and I can't log or send my webpage over the ethernet.

I am using https://www.adafruit.com/product/4555 for the Mega and https://www.adafruit.com/product/4556 for the shield, as shown here: https://photos.app.goo.gl/zVRqjRfzkd7zS97i6

After this set up didn't work, I have run wire from every single pin on each DIN mount and still the SD card is not accessible.

As you can see every single pin is connect on the Shield. The output of my program is:
09:55:27.035 -> Initializing SD card...
09:55:29.707 -> ERROR - SD card initialization failed!
09:55:30.694 -> ERROR - Can't write to log.csv
09:55:30.726 -> ERROR - Can't write to log.csv
For reference my SD initialization code is this:

Code: Select all

void init_fs(void)
{
  // initialize SD card
  Serial.println("Initializing SD card...");
  if (!SD.begin(4))
  {
    Serial.println("ERROR - SD card initialization failed!");
    //TODO: Print Error message in HTML...Error LEDs/Codes -- blink Built-in
    return;    // init failed
  }
  Serial.println("SD card initialized.");

  // check for index.htm file
  if (!SD.exists(MAIN_FILE))
  {
    Serial.print("ERROR - Can't find ");
    Serial.println(MAIN_FILE);
    //TODO: Print Error message in HTML...Error LEDs/Codes -- blink Built-in
    return;  // can't find index file
  }
  Serial.println("index file present");
}
After this failed, I immediately took both boards out of the DIN mounts and stacked them. My code's output is as follows:
10:04:12.331 -> Initializing SD card...
10:04:12.363 -> SD card initialized.
10:04:12.407 -> index file present
I'm not sure what else to try because I have a pin for pin connection on both of them. This somehow leads me to think its an ICSP problem but I've traced that out too.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Ethernet Shield 2 and DIN Mount not working.

Post by adafruit_support_mike »

The most effective thing you can do is find access to an oscilloscope and check each of the SPI signals at both ends of the wiring to see if the signals are getting through properly.

Without knowing what the signals are doing at the board level, any other methods are literally blind guesswork.

User avatar
fatdollar
 
Posts: 2
Joined: Wed Oct 26, 2022 2:05 pm

Re: Ethernet Shield 2 and DIN Mount not working.

Post by fatdollar »

Excellent idea. I'll have to do that. I guess I was just hoping maybe someone had an obvious thing that I was doing wrong. I'll have a look at the pins on my O-Scope. Thanks.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”