SD card access error

Moderators: lily.li, violet, salmanfarisvp

Post Reply
barba.montrezol
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Wed Dec 10, 2014 9:53 pm

SD card access error

Post by barba.montrezol » Mon Dec 15, 2014 7:17 am

Hello , how are you?
I have problems in Access SD Card, made ​​the selection correctly for switch SPI/SD , created FAT16 and FAT32 partitions , tested examples of LSD library and not work . I made tests with a LAudio library running SD Card Files , Also without success . Fast Can you help me ? Thank you !

User avatar
loovee
Elementary-3
Elementary-3
Posts: 352
Joined: Fri Nov 02, 2012 9:15 am

Re: SD card access error

Post by loovee » Mon Dec 15, 2014 9:42 am

Hi,

1. you can update the firmware and try again: http://www.seeedstudio.com/wiki/LinkIt_ ... are_Update

2. you should try the examples in LStorage, you can refer to here: https://github.com/Seeed-Studio/LinkIt- ... e/examples

please have a try, thanks`

barba.montrezol
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Wed Dec 10, 2014 9:53 pm

Re: SD card access error

Post by barba.montrezol » Mon Dec 15, 2014 9:24 pm

I did the firmware update now, the error persists, did the tests with the examples of said library without success. Concerning the LAudio library, can run audio files present in the flash memory with the call storageFlash however, with storageSD also does not work, what can I do?
Thank you!

User avatar
loovee
Elementary-3
Elementary-3
Posts: 352
Joined: Fri Nov 02, 2012 9:15 am

Re: SD card access error

Post by loovee » Mon Dec 15, 2014 9:57 pm

Hello, Could you please post your test code here, I can have a try in my side. thanks.

barba.montrezol
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Wed Dec 10, 2014 9:53 pm

Re: SD card access error

Post by barba.montrezol » Mon Dec 15, 2014 11:06 pm

I tested all examples of LStorage library and one below, the Laudio library.
This runs smoothly with the call storageFlash, but with the SD card (storageSD) does not.
Created partitions in FAT16 and FAT32, as logical and primary partitions, all without success. :(


#include <LAudio.h>

#define KEY 5
char buff[120];
unsigned char KEY_NUM = 0;

enum{Play,SetVolume,Pause,Resume,Stop};

unsigned char Status_Value = Play;

void Scan_KEY()
{
if( digitalRead(KEY) == 0 )
{
delay(20); //延时20ms,去抖动
if( digitalRead(KEY) == 0 ) //查看按键是否按下
{
KEY_NUM = 1;
while(digitalRead(KEY) == 0); //松手检测
}
}
}

void setup()
{
LAudio.begin();
pinMode(KEY,INPUT_PULLUP);
Serial.begin(115200);
Change_Status(Play);
pinMode(8, OUTPUT);

}

void Change_Status(unsigned char status)
{
switch(status)
{
case Play:
LAudio.playFile( storageSD,(char*)"1.mp3");
LAudio.setVolume(4);
Serial.println("playOne");
break;
case SetVolume:
LAudio.setVolume(6);
Serial.println("setVolume");
break;
case Pause:
LAudio.pause();
Serial.println("pause");
break;
case Resume:
LAudio.resume();
Serial.println("resume");
break;
case Stop:
LAudio.stop();
Serial.println("stop");
break;
default:
break;
}
}

void loop()
{
//digitalWrite(8, HIGH);
//digitalWrite(8,LOW);

AudioStatus status;
Scan_KEY();
status = LAudio.getStatus();
if(status == AudioEndOfFile)
{
Status_Value = Play;
Change_Status(Status_Value);
}
if(KEY_NUM == 1)
{
KEY_NUM = 0;
Change_Status(Status_Value);
Status_Value++;
if(Status_Value == Stop+1)
{
Status_Value = Play;
}
}

delay(1000);
}

barba.montrezol
Pre-kindergarten
Pre-kindergarten
Posts: 9
Joined: Wed Dec 10, 2014 9:53 pm

Re: SD card access error

Post by barba.montrezol » Tue Dec 16, 2014 11:44 pm

Hello Again, how are you?
I did some testing with mp3 playing code described above and with the inclusion of LSD.h library and the call LSD.begin() and i succeeded in executing file using the SD card, the code was like this:

#include <LAudio.h>
#include <LSD.h>

#define KEY 5
char buff[120];
unsigned char KEY_NUM = 0;

enum{Play,SetVolume,Pause,Resume,Stop};

unsigned char Status_Value = Play;

void Scan_KEY()
{
if( digitalRead(KEY) == 0 )
{
delay(20); //延时20ms,去抖动
if( digitalRead(KEY) == 0 ) //查看按键是否按下
{
KEY_NUM = 1;
while(digitalRead(KEY) == 0); //松手检测
}
}
}

void setup()
{
LSD.begin();
LAudio.begin();

pinMode(KEY,INPUT_PULLUP);
Serial.begin(115200);
Change_Status(Play);
pinMode(8, OUTPUT);

}

void Change_Status(unsigned char status)
{
switch(status)
{
case Play:
LAudio.playFile( storageSD,(char*)"1.mp3");
LAudio.setVolume(2);
Serial.println("playOne");
break;
case SetVolume:
LAudio.setVolume(6);
Serial.println("setVolume");
break;
case Pause:
LAudio.pause();
Serial.println("pause");
break;
case Resume:
LAudio.resume();
Serial.println("resume");
break;
case Stop:
LAudio.stop();
Serial.println("stop");
break;
default:
break;
}
}

void loop()
{
//digitalWrite(8, HIGH);
//digitalWrite(8,LOW);

AudioStatus status;
Scan_KEY();
status = LAudio.getStatus();
if(status == AudioEndOfFile)
{
Status_Value = Play;
Change_Status(Status_Value);
}
if(KEY_NUM == 1)
{
KEY_NUM = 0;
Change_Status(Status_Value);
Status_Value++;
if(Status_Value == Stop+1)
{
Status_Value = Play;
}
}

delay(1000);
}


Thank you for your attention and goodbye! :mrgreen:

User avatar
loovee
Elementary-3
Elementary-3
Posts: 352
Joined: Fri Nov 02, 2012 9:15 am

Re: SD card access error

Post by loovee » Wed Dec 17, 2014 8:32 am

nice job~ :mrgreen:

Post Reply