DFRobot multimega exapnsion shield and ETHERNET

Did someone try to use the MMES with an ETHERNET shield?

I'm unable to let it work.

As the pins are scattered in the MMES, I renamed the necessary pins (SD card CS and ETHETNET CS).
It works for the SD card, but not for the ETHERNET.

I checked the schematic, and there seems to be no pin used out of these two, save for MOSI/MISO which are provided through the ICSP connector, but this is working as I get the SD card correctly initialized.

Just for info, I used MMES with other shields, and it works correctly provided I re-name correctly the pins.

Any hint?
Thanks.
Gerard.

As the pins are scattered in the MMES, I renamed the necessary pins (SD card CS and ETHETNET CS).
It works for the SD card, but not for the ETHERNET.

You should explain how and where in the code you did this.

Please post a link to the MMS hardware and how they are connected to the Arduino main board, and which Arduino that is.

OK Tim,

May be I've not been precise enough!

MMS expands all MEGA pins in 4 banks, each bank having 4 one raw headers, corresponding to the MEGA lateral headers.

Only the"IOREF, RESET, 3.3V..." header is present on the 4 positions and maps exactly the one of the MEGA. The 3 other headers map different pins of the MEGA.

In the position I use, (pos 1 for info),

  • CD card chip select, normally on pin 4 is to be on pin 24. This pin is changed in the SD card initialization so there is no difficulty and it works!
  • Ethernet chip select (ETH CS) normally on pin 10 is changed to pin 12, which is the pin "aligned" with the pin 10 of the shield. This pin value is changed (10 becomes 12) in the W5100.h (line 15: #define SPI_CS 10), and as far as I could check this is the only place where tis pin is used

When I run one of the ETHERNET example, SD card is working, but not the ETHERNET link (it says IP 255.255.255.255 and it should be 192.168.1.177 as initialized in the sketch.

Everything is running well when I plug the shield directly on the MEGA.

I'm really puzzled!

SPI_CS is the hardware CS pin. The CS pin used by the w5100 is further down that page. You must change the _BV(4) to _BV(6) for D12.

private:
#if defined(ARDUINO_ARCH_AVR)
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  inline static void initSS()    { DDRB  |=  _BV(4); };
  inline static void setSS()     { PORTB &= ~_BV(4); };
  inline static void resetSS()   { PORTB |=  _BV(4); };
#elif defined(__AVR_ATmega32U4__)
  inline static void initSS()    { DDRB  |=  _BV(6); };
  inline static void setSS()     { PORTB &= ~_BV(6); };
  inline static void resetSS()   { PORTB |=  _BV(6); }; 
#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB162__)
  inline static void initSS()    { DDRB  |=  _BV(0); };
  inline static void setSS()     { PORTB &= ~_BV(0); };
  inline static void resetSS()   { PORTB |=  _BV(0); }; 
#else
  inline static void initSS()    { DDRB  |=  _BV(2); };
  inline static void setSS()     { PORTB &= ~_BV(2); };
  inline static void resetSS()   { PORTB |=  _BV(2); };
#endif
#endif // ARDUINO_ARCH_AVR

OK it was not really evident at first sight! I will try it when I have some time.

Thanks and have a good WE.