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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
6,594 次查看
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

标签 (1)
1 解答
3,307 次查看
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

在原帖中查看解决方案

0 项奖励
回复
27 回复数
505 次查看
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 项奖励
回复
505 次查看
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 项奖励
回复
505 次查看
celsoken
Contributor V

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

Cheers,

Celso

0 项奖励
回复
505 次查看
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 项奖励
回复
505 次查看
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 项奖励
回复
505 次查看
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 项奖励
回复
505 次查看
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 项奖励
回复