Not applicable
Jun 23, 2014
12:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 23, 2014
12:22 PM
Hi,
I've been trying to access, manage and use the sd card in my relax kit (I got the sd holder and the five resistors and soldered them, tested all the connections every thing is ok), I've already try to migrate some examples, and follow some tips posted here in the forum to no good,
Is there a simple example, to be used in a non rtos application, that shows how to use built in connector in the relax kit?
I'm using a 1GB card (FAT32/ 512 bytes allocation unit size)
Hoping to use this in a university project to store and read files.
I've been trying to access, manage and use the sd card in my relax kit (I got the sd holder and the five resistors and soldered them, tested all the connections every thing is ok), I've already try to migrate some examples, and follow some tips posted here in the forum to no good,
Is there a simple example, to be used in a non rtos application, that shows how to use built in connector in the relax kit?
I'm using a 1GB card (FAT32/ 512 bytes allocation unit size)
Hoping to use this in a university project to store and read files.
- Tags:
- IFX
5 Replies
Not applicable
Jun 23, 2014
03:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 23, 2014
03:41 PM
I'm locked in this in most examples (SDMMC003_Handle.TimerExpire == (bool)0) if someone knows how to solve this, I would appreciate. (I believe is error 47 :S )
Jun 23, 2014
10:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 23, 2014
10:35 PM
cumps wrote:
Hi,
I've been trying to access, manage and use the sd card in my relax kit (I got the sd holder and the five resistors and soldered them, tested all the connections every thing is ok), I've already try to migrate some examples, and follow some tips posted here in the forum to no good,
Is there a simple example, to be used in a non rtos application, that shows how to use built in connector in the relax kit?
I'm using a 1GB card (FAT32/ 512 bytes allocation unit size)
Hoping to use this in a university project to store and read files.
You can use the SDMMC001 apps which is non RTOS.
Not applicable
Jun 24, 2014
02:35 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 24, 2014
02:35 PM
Thanks @Travis, after a couple of attempts, I got it to work and could get the card info,
But now I have a new problem, using FatFs, i can mount the sd card, create folders, files, and write (both text, as raw data) to them, but I can't quite figure out how to get the raw data back
I adapted the example a bit, and right now i'm just testing, still need to clear it out.
After runing the code, the value of datawriten and datawrite is 70 (as is should), but the dataread is always 0.
Maybe you guys could give me a help on this one, do I need to reset the pointer of the file object?
I did this:
And it goes into FR_OK, so I can't figure out where i'm making a mistake
But now I have a new problem, using FatFs, i can mount the sd card, create folders, files, and write (both text, as raw data) to them, but I can't quite figure out how to get the raw data back
#include
uint16_t myarray[] = {0,0,0,1026, 1026, 2046, 1026, 1026,0,0,3968,4160,8224,8224,12304,12304,7182,12304,12304,8224,8224,4160,3968,0,0,32752,12,2,2,2,12,32752,0,0,0};
unsigned int lArray[35];
unsigned int datawriten=0;
unsigned int datatowrite=0;
uint dataread=0;
/* File pointer */
FIL fp ;
/* File System Object Structure variable */
FATFS myfsObject ;
void FATFS_TestDemo(void);
int main(void)
{
uint8_t DStatus;
// DAVE Initialization.
DAVE_Init();
DStatus = SDMMC001_Initialize();
if (DStatus == (SDMMC001_STA_NODISK | SDMMC001_STA_NOINIT))
{
//No card Present;
}
if (DStatus == SDMMC001_STA_NOINIT)
{
//Card Present but not initialized.
}
if (DStatus == SDMMC001_STA_PROTECT)
{
//Card is Write Protected .
}
FATFS_TestDemo();
while(1);
}
void FATFS_TestDemo(void)
{
volatile uint8_t DResult;
/* Set drv to 1 for USB/ 0 for uSD */
f_chdrive(0);
/* Mount USB device */
DResult = f_mount(0, &myfsObject);
/* Make directory */
DResult = f_mkdir("3D_ROOT");
if ((DResult == FR_OK) || (DResult == FR_EXIST))
{
//Directory already exists!!
}
// Create File
DResult = f_open(&fp, "3D_ROOT/data0.txt", (FA_CREATE_ALWAYS | FA_WRITE | FA_READ));
if (DResult == FR_OK)
{
//f_printf( &fp,"Eu Complico");
datatowrite=sizeof myarray;
f_write(&fp, &myarray,datatowrite,&datawriten);
f_read(&fp, &myarray,datatowrite,&dataread);
}
else if (DResult == FR_EXIST )
{
// File already exists!!
}
// Close File
DResult = f_close(&fp);
I adapted the example a bit, and right now i'm just testing, still need to clear it out.
After runing the code, the value of datawriten and datawrite is 70 (as is should), but the dataread is always 0.
Maybe you guys could give me a help on this one, do I need to reset the pointer of the file object?
I did this:
RResult=f_read(&fp, &myarray,datatowrite,&dataread);
if(RResult==FR_OK){
while(1);
}
if(RResult==FR_INT_ERR){
while(1);
}
if(RResult==FR_INT_ERR){
while(1);
}
if(RResult==FR_NOT_READY){
while(1);
}
if(RResult==FR_TIMEOUT){
while(1);
}
And it goes into FR_OK, so I can't figure out where i'm making a mistake
Jun 24, 2014
07:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 24, 2014
07:55 PM
Hi,
You can use the "SDMMC001_ReadBlock" API.
Best Regards
Travis
You can use the "SDMMC001_ReadBlock" API.
#include
int main(void)
{
uint32_t DResult;
uint32_t Count = 0;
uint32_t Counter = 0;
uint8_t WriteData[1536];
uint8_t ReadData[1536];
// DAVE Initialization.
DAVE_Init();
for(Counter=0;Counter<384;Counter++)
{
WriteData[Counter] = Counter * 10;
}
// Write functionality
DResult = SDMMC001_WriteBlock( WriteData, 200, 3);
if(DResult == SDMMC001_RES_OK)
{
// Read functionality
DResult = SDMMC001_ReadBlock( ReadData, 200, 3);
for( Count=0; Count<1536; Count++)
{
if( ReadData[Count] != WriteData[Count])
{
// Read and Write Data doesn't match.
}
}
}
return 0;
}
Best Regards
Travis
Not applicable
Jun 25, 2014
03:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 25, 2014
03:21 AM
Travis doesn't that mean low level access and no file-system? I will keep digging a bit more and try to learn where can the problem be.