Robert Lewis

FatFs - not reading Boot Record, USB boot loader

Discussion created by Robert Lewis on May 2, 2013
Latest reply on Jul 12, 2013 by Robert Lewis

Hi

 

I am using the code base from AN4368 for the USB MFS bootloader.

 

For some reason I am not getting the boot record being read. I return from the check_fs(...), with a fmt = 2, or no file system found.

 

This happens because the field a 510 is supposed to be 0xAA55; which it is when I look at the boot record; I can see at offset 510 = 0x55AA

But in the fs structure I get 0x000 at 510

 

    if (disk_read(fs->drv, fs->win, sect, 1) != RES_OK) /* Load boot record */

    if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55)       /* Check record signature (always placed at offset 510 even if the sector size is >512) */

        return 2;

 

The disk is formatted as fat32. I did note in the comments of ffconf.h that if the code page index is wrong, a file open failure will occur, which is what I am getting. The code page currently is #define _CODE_PAGE  1258, Vietnam

 

If I set _CODE_PAGE to 437, US I get a compile error. I think I have to change other modules as well.

 

My question is, do we have to bother with the Language? Will this make a difference and is it the cause of block 0 being read is wrong?

 

The drive is formatted as FAT32 and windows doesn't report any errors.

 

thanks

 

Robert

 

Message was edited by: Robert Lewis Well I just tried a different flash drive and it works as expected; that is the boot record is correct. I never tried this before because I replaced the last drive with this one because it was getting errors in the main app. The problem is, the current flash drive that I was using was consistently working with the MQX USB MFS stack in the main app. The flashdrive I just got to work was pulled because it would fail during writes in the main app. So now I have a problem... the failed drive(not working correctly in the main app) works in the bootloader. The working drive in the main app, fails in the bootloader...could this be related to the bootloader USB stack?. I know that the USB stack was improved under mqx 4.0... should I try and move the code from mqx into the boot loader. If anyone has a suggestion it would be appreciated. I don't want to deal with restructuring the boot loader right now. Thanks Robert

Outcomes