Pages: [1]   Go Down
Author Topic: SK Pang dmx / sd shield + mega2560  (Read 1413 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 124
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I'm having a strange issue with this sd shield, and have been trying different combinations, using the card info sd example -

Uno + Ethernet Shield - Chip Select(4), pinmode output(10) - working
Uno + SKP dmx/sd shield - Chip Select(10), pinmode output(10) - working
Mega2560 + Ethernet Shield - Chip Select(4), pinmode output(53) - working
Mega2560 + SKP dmx/sd shield - Chip Select(10), pinmode output(53) - NOT working..

With this last combo I've tried many combinations of CS and Pin Output values.  The dmx out of this shield is working fine, as does the sd when used with the Uno. Confusing!

Any ideas?
Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Ethernet shield connects to the SPI bus through the ICSP connector so it will work with a Mega.

The Arduino DMX Shield appears to use pins 10 - 13.  These are not SPI pins on the Mega.

It may be possible to use software SPI on the Mega.

Edit the Sd2Card.h file in the libraries/SD/utility folder.  At about line 42 set MEGA_SOFT_SPI to one like this.
Code:
#define MEGA_SOFT_SPI 1
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 124
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah, interesting.

Changed the line but no joy. 

Anything else to try or do I have to physically link the appropriate pins on the dmx shield to pins 50-53 on the mega?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 124
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Whoa, it is working.

Was being a numpty smiley

Thanks


edit: seems it's way slower to open the file now though. I take it physically connecting to the hardware spi pins will be faster?
« Last Edit: June 08, 2012, 12:14:04 pm by mrboni » Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1604
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hardware SPI will be faster but open time depends a great deal on where the file to be opened is located in the directory.

Hardware SPI is 4 MHz and software SPI is about 1 MHz for SD.h but you will probably get only a factor of two speed-up at most for read/write and even less for open().

You will see almost no improvement if you write to an SD using print.  All the overhead is in formatting numbers, not in transferring data over the SPI bus.
« Last Edit: June 08, 2012, 01:12:47 pm by fat16lib » Logged

Pages: [1]   Go Up
Jump to: