ฉันใช้ PIC18F26K80 และคอมไพเลอร์ XC8 ฉันพยายามเริ่มต้นการ์ด SD และสร้างไฟล์ ฉันเพิ่งฟอร์แมตการ์ด SD บน Windows เพื่อให้มีระบบไฟล์ "FAT32" และ "ขนาดหน่วยการจัดสรร" ที่ 512 ไบต์ ความจุของการ์ด SD คือ 2GB ฉันใช้ไลบรารี MDD จากรุ่น MLA Legacy หลักของฉันคือต่อไปนี้:
FSFILE * file;
char sendBuffer[22] = "This is test string 1";
//**************************************************
// main function
//**************************************************
int main()
{
    initIO();
    LATBbits.LATB0 = 0;
    // Initialise SPI and SD-card
    while ( !MDD_MediaDetect() );
    // Initialize the device
    while ( !FSInit() );
    // Initialize 
#ifdef ALLOW_WRITES
    // Create a new file
    file = FSfopenpgm ( "FILE.TXT", "w" );
    if ( file == NULL )
        while(1);
    // Write 21 1-byte objects from sendBuffer into the file
    if ( FSfwrite ( (void *) sendBuffer, 1, 21, file ) != 21 )
        while(1);
    // Close the file
    if ( FSfclose ( file ) )
        while(1);
#endif
    LATBbits.LATB0 = 1;         //LED
    while(1) {}
    return (0);
} 
โปรแกรมติดอยู่ภายในฟังก์ชั่น "FSInit ()" และข้อผิดพลาดที่ฉันได้รับจากฟังก์ชั่นคือ "CE_BAD_PARTITION" ซึ่งหมายถึง "บันทึกการบูตไม่ดี"
ฟังก์ชัน "initIO ()" มีดังต่อไปนี้:
//==============================================================================
// void initIO( void );
//==============================================================================
// Sets the pins on the PIC to input or output and determines the speed of the
// internal oscilaltor
// input: none
// return: none
//==============================================================================
void initIO()
{
    OSCCON = 0x75;                  // Clock speed = 32MHz (4x8Mhz)
    TRISA = 0;
    TRISB = 0;
    TRISC = 0;
    TRISBbits.TRISB0 = 0;           //LED
    TRISCbits.TRISC3 = 0;           // set SCL pin as output
    TRISCbits.TRISC4 = 1;           // set RC4 pin as input
    TRISCbits.TRISC5 = 0;
    TRISAbits.TRISA5 = 0;
}
สองไบต์สุดท้ายของเซกเตอร์ 0 เป็นลายเซ็นการบู๊ตและพวกมันหมายถึงเป็น 0x55 และ 0xAA และรูปภาพที่ฉันรวมไว้ยืนยันว่า อย่างไรก็ตามภายในฟังก์ชั่น "LoadMBR" จะทำการตรวจสอบต่อไปนี้:
if((Partition->Signature0 != FAT_GOOD_SIGN_0) || (Partition->Signature1 != FAT_GOOD_SIGN_1))
{
    FSerrno = CE_BAD_PARTITION;
    error = CE_BAD_PARTITION;
}
else
{
    ...
}
และถึงแม้ว่าไบต์จะเป็นไปตามเงื่อนไขแรกและจะกลับมาพร้อมกับข้อผิดพลาด "CE_BAD_PARTITION"
