Problems porting SD FAT to MCF51 JM Badge Board - Datalogger application

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problems porting SD FAT to MCF51 JM Badge Board - Datalogger application

Jump to solution
5,480 Views
celsoken
Contributor V

Hi,

 

I am trying to use 9S08JM60 SD FAT software in MCF51 Badge Board but it doesn't seem to work.

Maybe someone already had these troubles and could help me in this job.

 

My goal is to run a (real) datalogger software designed for automotive applications, based on AP32.

I'll port the AP32 software to MCF51 after SD is working fine.

 

Besides the usual voltage/frequency/temperature inputs, I'll use QG8s as interface coprocessors - I gave up trying to imagine what I'll connect in the future.

 

Any help will be appreciated.

 

Thanks in advance,

 

Celso

Labels (1)
1 Solution
2,193 Views
celsoken
Contributor V

Solved:

 

Found a bug in SD_Write_Bloc (SD.C)

 

This software implements a software timer - wich is against Flexis recommendations - after sending the block to be written. It tipically worked on 9S08JM60 but crashed in MCF51.

 

The changes were from:

 

=============================================

for(u16Counter=0;u16Counter<BLOCK_SIZE;u16Counter++);

if((ReadSPIByte() & 0x0F) != 0x05) 

=============================================

 

To:

=======================================================================

SD_response=0xFF; // #001 created this variable
while (SD_response==0xFF) SD_response=ReadSPIByte(); // #001 wait for SD response <> 0xFF
if((SD_response & 0x0F) != 0x05)  // #001 checks if response = 0101 = data accepted
  
    {
        SPI_SS=DISABLE;
        return(WRITE_DATA_FAILS);     
    }
========================================================================

 

Preliminary test appears to be working.

And I look like a lunatic, talking to myself.
At least maybe it helps someone.

 

Celso

View solution in original post

0 Kudos
27 Replies
333 Views
sebasira
Senior Contributor I

Thanks Tom!

 

I'll take a look at that... Also I ment not only FAT information, but information about how to implement it with MCUs... I try reading FAT codes, but I was thinking about a tutorial or something like that

 

Anyway.. your help is greatly appreciatted! THANKS!!!

0 Kudos
333 Views
baja_usb
Contributor II

Ok, I corrected the byte struct alignment and managed to create a text file. In the PC, running Window's Vista (32 bits) the Window's explorer shows the file in the SD card with the right name, the right size but when I try to open the file, the system can't find the file. In my Linux partition, I can open the file without any problems.

 

It seems to be some issue in the CloseFile routine, I think that is when writes the final cluster since the size of the file is read fine by the PC. Do you had the same problem? Is strange because a major error in the FAT table won't permit the read of the file, neither in the Linux system.

 

Best regards,

Daniel

0 Kudos
333 Views
celsoken
Contributor V

No, I don't have problems. I'm working on XP.

Cheers,

Celso

0 Kudos
333 Views
HummingbirdElec
Contributor I

Hi Daniel

 

I'm having the same problem - can create a file, right name, right size, but Windows vista can't find the file when i try to open it.  Did you solve your problem?

 

Cheers, Norman

0 Kudos
333 Views
HummingbirdElec
Contributor I

OK, solved - just changed all file names to capitals - not sure why it works, but main thing is that it does!!!!   If anybody knows why, it would be interesting to know.

 

0 Kudos
333 Views
xiujiang
Contributor II

Hey guys, I am having some problem with my JM60 SD card routine too.

However, I am storing data from my ADC to SD card as .wav file.

I managed to close the file correctly but I can't write more than 2MB for 8k format, & 1MB for 4k format.

Meaning 2MB only able to cater for approx 5 mins of recording.

 

I need to find out if our problems are related? or anyone has encountered similiar issue.

Please advise.

 

Thanks.

 

Regards,

XJ

0 Kudos
333 Views
gustavod
Contributor III

The FAT File System of freescale with some bug fixes was posted on:

http://code.google.com/p/brtos/downloads/list

 

Now supports up to 512 MB and the list function is working correctly.

 

Best Regards,

Gustavo

0 Kudos