Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] FATFS library with PIC18lf46k80 MPLAB X and compiler XC8

Status
Not open for further replies.

adi1525

Newbie level 3
Joined
Sep 7, 2017
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
Hello,
I try to use FATFS library on the PIC18lf46k80 with external 8MHz, but f_mount(&FatFs,"",1) don't return FR_OK. Can you tell me if this program works for you?
I don't know if problem is with software or hardware.
I use SSD1298 so connection should be right but, there are not a few resistor there.
20170907_130848.jpg
 

Attachments

  • SD_MPLABX_XC8.rar
    4.6 MB · Views: 120
Last edited:

From the original code:
Code:
if(f_mount(&FatFs,"",1)==FR_OK)
    {
        EUSART1_WriteStringln("It's work");
        /*
        if(f_open(&Fil,"test.txt",FA_OPEN_ALWAYS|FA_READ|FA_WRITE)==FR_OK)
        {
            if((Fil.fsize!=0)&&(f_lseek(&Fil,Fil.fsize)!=FR_OK)) goto endSD;
            f_write(&Fil, "No i dziala kurwa a to jest jakis tekst: ",54,&bw);
            endSD: f_close(&Fil);
        }*/
    }
    while(1);
}

Try doing something like this to catch the error :

bool = ErrorCode ;
ErrorCode =f_mount(&FatFs,"",1) ;
EUSART1_WriteStringln( ErrorCode );
 

It return 3.

So it's mean "The physical drive cannot work"

I have 8GB SDHC (4) Kingston, formatted to exFAT and Cluster to 32KB.
 

I don't know anyting of the library you are using, but I would recommend starting with the FAT16 formatting just due to the back compatibility that is available for these libraries; The eFAT is a more recent kind which perhaps is not compatible with all these libraries.
 
So ok now it's work.
For first SD socket in SSD1298 don't work and it can not be format exFAT. It work with FAT32.
Thanks for the tips ;)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top