Another #include <SdFatUtil.h> issue

Having been an video games assembly language programmer in the 80's and 90's, and recently learned C++ C VB, everything thing I have played with so far in Arduino makes perfect sense and I was making superb progress. That was until our local radio ham repeater keeper asked me to build a temperature monitor which could speak.

I had an AT2560 based card so I bought into a cheap Greetech VS1053 mp3 shield thinking that I could record each word and play back to create the temperature (from a thermistor) speech while the cpu checks that the repeater isn't in use and holds the Transmitter line high. The CPU also will drive a four line display and thermistor which I have successfully coded for. I used the Greetech because it was cheap everything else is five times the price and since this is a charity job I don't intend on changing the electronics at this stage. Had I known that Arduino kit goes out of date so quickly I might have avoided it to be honest.

But anyway...

Then I started to prototype the MP3 player control using examples to start and hit this brick wall...

-fatal error: SdFatUtil.h: No such file or directory #include <SdFatUtil.h>

It seems that this is a really common issue, with lots of issues with it, but none helped me much. Mostly caused by bad questions and a few which I didn't understand the answers to.

I found the include in #include <SFEMP3Shield.h> It's calling SdFat.h which in turn contains
SdFatUtil.h

So I decided to locate and remove the call from SFEMP3Shield.h the result was:

-Library can't use both 'src' and 'utility' folders. Double check C:\Program Files (x86)\Arduino\libraries\SdFat

So I read up on this and it appears that its caused by an inheritance error to do with a utility(Public) and a private include. I have no idea how to fix that, nor do I think it will help since I created this error by removing the include from the mp3 encoder include.

There seems to be lots of information on this SdFatUtil issue but after researching for two days straight, I don't seem to be getting anywhere. All I want to do is get this code working. I know its simple but all I need is to play the files with the words in sequence like "Two" + "Five"+"Degrees" according to the output form the Thermistor.

#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h> 
#include <SFEMP3Shield.h>
 
SdFat sd;
SFEMP3Shield MP3player;
 
void setup() 
{
  Serial.begin(9600);
  Serial.println("setup");
 
  //start the shield
  sd.begin(SD_SEL, SPI_HALF_SPEED);
  MP3player.begin();
 
  MP3player.playTrack(1); // play track 1 for 5 seconds
  delay(5000);
 
  MP3player.stopTrack();
  MP3player.playTrack(2); // play track 2 for 2 seconds
  delay(2000);
 
  MP3player.stopTrack();
  MP3player.playMP3("track001.mp3"); // play track by file name.
}
 
//do something else now
void loop() 
{
 
  Serial.println("Kendro!");
  delay(2000);

Had I known that Arduino kit goes out of date so quickly I might have avoided it to be honest.

This is nonsense. The hardware I bought 10 years ago still works with the same code I wrote 5 years ago.

I used the Greetech because it was cheap everything else is five times the price

At 5 times the "next to nothing" cost of a decent SD reader/writer, it baffles me why you want to be penny-wise and pound-foolish.

-fatal error: SdFatUtil.h: No such file or directory #include <SdFatUtil.h>

Is there ANYTHING about this message that is even slightly mysterious?

Post links to ALL libraries you are using, if you really want help.

Get the latest ZIP file from GitHub.

I'm not sure where stuff is stored on the Windows version of the Arduino IDE, but you want to unpack the ZIP file and put the SdFat folder and the SFEMP3Shield folder in your personal Arduino libraries folder.

Remove #include <SdFatUtil.h> from your sketch since SdFatUtil.h has moved/doesn't exist any more.

Note that the Arduino IDE comes with the SD library which is also contains a version of SdFat. Hopefully there is no risk of collision...

Ok I updated the libs in the arduino directory as instructed.

C:\Users\admin_manager\Documents\Arduino\mp3play2\mp3play2.ino: In function 'void setup()':

C:\Users\admin_manager\Documents\Arduino\mp3play2\mp3play2.ino:26:35: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

MP3player.playMP3("track001.mp3"); // play track by file name.

The depreciated code compiles now but the compiled code running in the Atmel reports ...

"setup
If you get this error, you likely do not have a sd.begin in the main sketch, See Trouble Shooting Guide!
http://mpflaga.github.com/Sparkfun-MP3-Player-Shield-Arduino-Library/#Troubleshooting
"

But is is there ...

#include <SPI.h>
#include <SdFat.h>
//#include <SdFatUtil.h> 
#include <SFEMP3Shield.h>

SdFat sd;
SFEMP3Shield MP3player;
 
void setup() 
{
  Serial.begin(9600);
  Serial.println("setup");
 
  //start the shield


//****************************** Here is the required begin code******
sd.begin(SD_SEL, SPI_HALF_SPEED);





  MP3player.begin();
 
  MP3player.playTrack(1); // play track 1 for 5 seconds
  delay(5000);
 
  MP3player.stopTrack();
  MP3player.playTrack(2); // play track 2 for 2 seconds
  delay(2000);
 
  MP3player.stopTrack();
  MP3player.playMP3("track001.mp3"); // play track by file name.
}
 
//do something else now
void loop() 
{
 
  Serial.println("Kendro!");
  delay(2000);
 
}

Check the return code of sd.begin() to make sure the call is successful.

You can probably get rid of the "deprecated" warning with a cast:

MP3player.playMP3((char *)"track001.mp3");

The return code is Null so I would assume that the call is running ok.
from code

void setup() 
{
  Serial.begin(9600);
  Serial.println("setup");
 
  //start the shield

boolean running = false;

running = sd.begin(SD_SEL, SPI_HALF_SPEED);
   if (running) Serial.println("True");
   else 
   
  Serial.println("Null");

    
  MP3player.begin();
 
  MP3player.playTrack(1); // play track 1 for 5 seconds
  delay(5000);
 
  MP3player.stopTrack();
  MP3player.playTrack(2); // play track 2 for 2 seconds
  delay(2000);
 
  MP3player.stopTrack();
  MP3player.playMP3("track001.mp3"); // play track by file name.
}
 
//do something else now
void loop() 
{
 
  Serial.println("Running");
  delay(2000);
 
}

Microblitz:
The return code is Null so I would assume that the call is running ok.

REALLY BAD assumption. Check the source code for the SD library.

The return value is bool, so not "Null" (NULL would only really make sense regarding pointers).

As already mentioned, you would be wrong to assume 0 is success - it represents false and does indicate an error for this function call.

Make sure the SD card you are using is either plain SD or SDHC.
Make sure that it is formatted with FAT16 or FAT32.
Maybe try tweaking the speed value in the begin() to see if that makes a difference.

The direct call to the pointer does indeed clear the depreciated code message thanks.

MP3player.playMP3((char *)"track001.mp3");

I'm not sure how to further test the library to see if the library is returning an error other than the method I've used. It does not return anything other than a Boolean. If you can give an example or assistance on working this through id appreciate it.

The audio output is making background white noise so I think something is working.
The memory card is a Sandisk SDHC 16gb.

Microblitz:
I'm not sure how to further test the library to see if the library is returning an error other than the method I've used. It does not return anything other than a Boolean. If you can give an example or assistance on working this through id appreciate it.

You can print out the values of sd.cardErrorCode() and sd.cardErrorData(), but from previous experience, they are problematic to interpret. Try them anyway.

Is this the "shield" that you are using? Seems to be a breakout board. You should post a picture of how you have things wired up.

sd.cardErrorCode = 37
sd.cardErrorData = 0

When the play command is called it never returns so it never gets to the stop mp3 command.
I checked up on that SD card error code and cant find an Arduino specific list of them. THe only reference is Microsoft drivers which suggests that the card reader is not being initialised.

This is the board

http://www.geeetech.com/wiki/index.php/Arduino_MP3_shield_board_with_TF_card

PaulS:
This is nonsense. The hardware I bought 10 years ago still works with the same code I wrote 5 years ago.

Good for you! It means that you have been coding this hardware for ten years, congratulations.

Shame you're not particularly tolerant of people with less experience than you!

PaulS:
At 5 times the "next to nothing" cost of a decent SD reader/writer, it baffles me why you want to be penny-wise and pound-foolish.

I'm sorry, this is a charity job and I'm currently unemployed. I'd like to spend a few hundred pounds on this job but I prefer to feed my children and have a roof over my head thanks.

PaulS:
Is there ANYTHING about this message that is even slightly mysterious?

Oh... no mystery to the man with ten years experience of coding arduino. Well so far I've had about three days, so there's lots of mystery.

But I'm sorry, I thought the header on the forum said something like "Learn Arduino code", not make your first post and have someone make you feel unwelcome.

Perhaps I ought to go elsewhere, where there are less with your attitude. But before I do, do you mind if I quote you for our magazine. I always like to highlight technical people of your type,it makes for good reading.

PaulS:
Post links to ALL libraries you are using, if you really want help.

I posted all the code.

Oh, I see. I saw that shield first, but the TF card bit threw me. Ok, TF == TransFlash == MicroSD.

Error code 37 corresponds with SD_CARD_ERROR_CMD8. This happens in SdSpiCard.cpp in the begin() function. It happens when a timeout occurs after CMD8; so the card has not responded in time or maybe in the correct way. Prior to this, CMD0 must have been successful; so something worked.

From the SD Host Controller Simplified Specification :

(2) New CMD8 shall be issued after CMD0 to
support High Capacity SD Memory Card.
(3) Voltage check command enables the Hosts to suppor
t future low voltage specification. However,
at this time, only one voltage is
defined. Legacy cards and Not SD cards do not respond to CMD8.
In this case, set F8 to 0 (F8 is
CMD8 valid flag used in step (11)) and go to Step (5). Only Version
2.00 or higher cards can respond to CMD8. Th
e host needs to check whether CRC of the
response is valid and whether VHS and check pa
ttern in the argument are equal to VCA and
check pattern in the response. Passing all thes
e checks results in CMD8 response OK. In this
case, set F8 to 1 and go to step (5). If one
of the checks is failed, go to step (4).

I think at this stage I would suggest trying a different (non-SanDisk) memory card if you have one.

Ok Thanks Ill look into it. I dont have one available at the moment.

Thanks arduarn for your help.

Unfortunately due to an issue with another user unresolved by the admin. I have decided to delete this account.
Thanks again for your considered replies and good bye.

Regards Chris.

Microblitz:
I posted all the code.

You were asked to post links to the code you're using.

You can't delete your account - you'd have to contact a moderator or an administrator to ask them to do that for you.

Microblitz:
Unfortunately due to an issue with another user unresolved by the admin. I have decided to delete this account.
Thanks again for your considered replies and good bye.

I'm sorry to hear that. Naturally I don't know what has been going on in personal messages, but I don't see any reason to delete your account. If you take everything you read on the internet personally it is one of the quickest ways to madness. But it is of course your choice.