Multiple SD card

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
mboroff
 
Posts: 96
Joined: Sat Feb 22, 2014 7:45 pm

Multiple SD card

Post by mboroff »

I'm not able to read the wave files on the wave shield when the ethernet card is stacked in.

I've read the information about the conflict of multiple sd cards between the wave shield and the ethernet shield including the faq in the tutorial which says to change the PORTD pin definitions. I just can't seem to find the file that contains the PORTD pin definitions.

I also looked at the example TWO Cards in the SDFAT library which indicated I should do the following modification:
/*
* Example use of two SD cards.
*/
#include <SdFat.h>
#include <SdFatUtil.h>
#if !USE_MULTIPLE_CARDS
#error You must set USE_MULTIPLE_CARDS nonzero in SdFatConfig.h
#endif

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Multiple SD card

Post by adafruit_support_rick »

Which ethernet shield? The Arduino Ethernet Shield? If I recall correctly, that uses Pin 4 as a chip select for the SD card, and Pin 10 as chip select for the ethernet chip.

In our suggested wiring for the wave shield, we use Pin 10 for the SD chip select, and pin 4 as data in to the DAC. You will have to move those two jumper wires to unused pins, and then change the pin definitions in the code accordingly.

Do you need to use both SD cards, or will you only use the waveshield SD?

I would suggest moving the DI jumper wire from pin 4 to pin 6, and the CCS jumper wire from pin 10 to pin 7.

IN the WaveHC library, edit file ArduinoPins.h. Find the following section and change the SS_PIN definition to match the pin you selected for CCS (for example, pin 7):

Code: Select all

#else // defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
// 168 and 328 Arduinos

// Two Wire (aka I2C) ports
#define SDA_PIN 18
#define SCL_PIN 19

// SPI port
#define SS_PIN 7                //make this the number of the pin you jumpered to CCS
#define MOSI_PIN 11
#define MISO_PIN 12
#define SCK_PIN 13
Then, edit file WavePinDefs.h and find the section where pin 4 is configured as the DAC serial data in. Change references to pin 4 to match the pin jumpered to DI. (for example, pin 6)

Code: Select all

// pin 6 is DAC serial data in

/** Data direction register for DAC serial in. */
#define MCP_DAC_SDI_DDR  PIN6_DDRREG
/** Port register for DAC clock. */
#define MCP_DAC_SDI_PORT PIN6_PORTREG
/** Port bit number for DAC clock. */
#define MCP_DAC_SDI_BIT  PIN6_BITNUM

User avatar
mboroff
 
Posts: 96
Joined: Sat Feb 22, 2014 7:45 pm

Re: Multiple SD card

Post by mboroff »

Well I tried your suggestion. After making the changes, I can read the sd card with cardinfo from the sdfat examples when I change select to pin 7. However, every example in the wavehc library hangs. i.e. dphac spits out the free memory.

Also, when I add my ethernet shield it fails to make a connection either ethernet client or udp client. The shield is a HANRUN HR911105A. Seems to function as it should as a server or udp client or ethernet client.

The reason I am attempting to add the wave shield is because I wrote and clock application, currently using and lcd screen. It gets the time from a UDP connection and it gets current weather conditions from and ethernet client scanning JSON return stream. Well I wanted to add Big Ben chimes on the hour, during certain times of the day, hoping I have enough memory on the uno r3 to do it.

Just curious, if there is a way to disable the sd card on the wave shield and read from the ethernet shield, that might solve the problem, don't you think. Although I spent almost 40 years programming everything from IBM mainframes with 256K, IBM midrange systems, and PCs, I fell upon the arduino the end of December last year. I hadn't coded anything since I retired in 2006 but this device has brought back all my C experience. And coupled with the limited memory, it reminds me of when I started and we wrote really tight code that did a lot of work in 26k. Sorry, probably TMI.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Multiple SD card

Post by adafruit_support_rick »

You can certainly use the SD on the Ethernet shield. The whole thing is a question of chip selects.
I can't imagine why daphc would hang. At worst, it should simply fail to initialize.

Do you know what pins your ethernet shield uses? I think HANRUN HR911105A is just the RJ45 jack. There must be some other identification on the board. Where did you get it? Did it come with any sample applications? Maybe those will identify which pins it uses.
mboroff wrote: And coupled with the limited memory, it reminds me of when I started and we wrote really tight code that did a lot of work in 26k. Sorry, probably TMI.
Oh, I've been there. I'm an old LSI/11-PDP/11 assembly language hacker myself. I know what you can do in a measly 28K. And you're right - this stuff is a lot like that. But if you really want to make these things sing, you move on from the Arduino IDE and start working in Atmel Studio with a JTAG pod. I finished up a project last year on an ATmega32U4 target, and I still have a hard time believing just how much I was able to pack into it.

User avatar
mboroff
 
Posts: 96
Joined: Sat Feb 22, 2014 7:45 pm

Re: Multiple SD card

Post by mboroff »

The chip on the board says WIznet , Ethernet w5100, pfh89-010,130. The sticker says HsanRun HR911105A. Markings on the board say MEGA compatible. It hasan RJ45. Got it on Ebay http://www.ebay.com/itm/360719255220?ss ... 1497.l2649

An interesting experiment I tried. Since I have Arduino headers on the shield, I jumpered 6 to 10 and 5 to 40 and set pins 5 an6 low, and put the .h files back to their original values. Put the board on another UNO I got on Amazon and DPHAC runs to the extent it can read the SD card and it's data but I got no sound out of it with either headphone or an external amp.

So if I disconnect all four leads on the wve shield, couldn't I change the select pin definition to use pin 4 in Arduinopins.h and then use the sd card on the wave shield and the sound processor on the wave shield? Or are use using and of the four leads for sound?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Multiple SD card

Post by adafruit_support_rick »

Ah - those are knock-offs of the Arduino Uno and the Arduino Ethernet Shield.

The WaveShield DAC needs 4 pins. By default, they're set to 2, 3, 4, and 5, but you can go into WavePinDefs.h in the WaveHC library and change them to anything you want.They don't have to be contiguous or anything.

BTW - the 6 "analog" pins can also be used. Those are actually numbered Digital 14 through Digital 19.

User avatar
mboroff
 
Posts: 96
Joined: Sat Feb 22, 2014 7:45 pm

Re: Multiple SD card

Post by mboroff »

Just working with the wave card and a true uno, I seem to be able to get the wave to function with the original pins. Something else must be going on to block the audio when I moved the physical pins. So it's back to the instructed pins.

I had another thought that maybe the wifi cc3000 breakout might solve my design to fetch time and weather from the internet and play a chime wave file at specific time. What do you think? There is no sd card on the breakout.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Multiple SD card

Post by adafruit_support_rick »

So, the waveshield and Uno doesn't work with the re-mapped pins? It should.
Before switching to the CC3000, I'd like to get a handle on what the problem is with the shield you already have.

User avatar
mboroff
 
Posts: 96
Joined: Sat Feb 22, 2014 7:45 pm

Re: Multiple SD card

Post by mboroff »

Rick. I have moved the jumpers again, to C pin 7 and DI to pin 6. I have renamed the arduinopins.h file to arduniopins_orig, renamed the arduinopins_mods.h to arduinopins.h. Did the same with wavePinsdef.h. Seated the wave shield on top of an Uno. Plugged in the usb cable. Brought up a new sketch and selected SDreadtest. After upload it hung after keying in a character. Tried DAPHC which hung. Tried Cardinfo from sd library, change the cards select definition to 7, it ran.

Got any ideas?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Multiple SD card

Post by adafruit_support_rick »

Right. You have persuaded me to do violence to my wave shield. I moved LAT and DI from 5 and 4 to 7 and 6. I changed the definitions in WavePinDefs.h accordingly.

Also, I moved the CCS jumper on the wave shield from 10 to 9, and changed ArduinoPins.h accordingly.

IF you remember the little Arduino bugaboo about setting digital 10 to output, daphc works like a charm.

Next, I dug out my Arduino Ethernet Shield. Checked that out, and it works.

So, I put it all together. It doesn't work. There seems to be a conflict between the Ethernet driver and the waveHC SD driver. I tried the old trick of saving and restoring the hardware SPI status register, and it didn't help.

If I knew more about WaveHC, maybe I could make it work. Maybe not.

I also tried to make WaveHC work with the CC3000 shield. No such luck, either.

I think you'll have better luck with the VS1053:
http://www.adafruit.com/products/1381

User avatar
mboroff
 
Posts: 96
Joined: Sat Feb 22, 2014 7:45 pm

Re: Multiple SD card

Post by mboroff »

Well at least I'm not nuts. I guess I'll put the jumpers back.

As for the VS1053, I noticed it uses pin 10 for CS. Isn't that what seems to be causing all the conflict because the ethernet kind of takes over that pin. Although I suppose since my code is not working as a server and the arduino is not multithreading, I can turn the pin on or off as needed? Right? And there shouldn't be a conflict?

How's the companion amplifier? Does it work ok with small to medium speakers? The new month and budget flip is coming so maybe I will just order the pair.

User avatar
adafruit_support_bill
 
Posts: 88140
Joined: Sat Feb 07, 2009 10:11 am

Re: Multiple SD card

Post by adafruit_support_bill »

As for the VS1053, I noticed it uses pin 10 for CS.
The example code uses pin 10, but yo can specify any pin you want in the library.
How's the companion amplifier?
The class-D amps are not going to shake the walls and have your neighbors calling the police. But they are quite a bit more powerful than the op-amp in the WaveShield. And they are stereo too. All-in-all, the VS1053 will give you much better sound that you will get from the Wave Shield.

User avatar
mboroff
 
Posts: 96
Joined: Sat Feb 22, 2014 7:45 pm

Re: Multiple SD card

Post by mboroff »

Rick the VS1053 works perfectly as a solution. Thanks a bunch.
I did change the CS pin to pin 7. Since it is just a jumper from the breakout board it is not a problem to move it. I have a quest about the statement " // Play another file in the background, REQUIRES interrupts!". Can you explain that, a bit. I also am uploading a test program that interleaves playing a file and accessing the internet for a web page so you can see. I'll check it with the cc3000 and let you know.
Attachments
Ethernet_with_sound.txt
(4.16 KiB) Downloaded 133 times

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Multiple SD card

Post by adafruit_support_rick »

mboroff wrote: I have a quest about the statement " // Play another file in the background, REQUIRES interrupts!". Can you explain that, a bit.
Not sure where you saw that comment. What it means, I think, is that if you want to play a file while the Arduino is doing something else, you need to use interrupts to feed data to the VS1053.

User avatar
mboroff
 
Posts: 96
Joined: Sat Feb 22, 2014 7:45 pm

Re: Multiple SD card

Post by mboroff »

The comments are in the simple player example. When you say it needs interrupts to feed the VS1305, I haven't seen code on how that might work and what kind. Is it like to pause it or stop it? I'll try Googling interrupts on the Arduino and the chip. I know that the ntp example I have used sets an interrupt for provider and when to wake it up to refresh the time.

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

Return to “Arduino Shields from Adafruit”