• AVR Freaks

Hot!Issues in Generated Code with "SD Card Library" and "FatFs Library"

Author
ToolLabs
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2013/07/03 04:11:46
  • Location: 0
  • Status: offline
2019/06/21 17:15:56 (permalink)
0

Issues in Generated Code with "SD Card Library" and "FatFs Library"

I have encountered a couple of issues during building a code which handles sd card. I am happy if I would have clues to resolve the issue.
 
Followings are the steps I have tried.
1. Generate the new project with following parameters: Device=PIC18F14K50, Compiler=XC8 v2.05
2. Launch MCC and set as follows:
   - Added FatFs Library and SD Card Library to the project
   - In the FatFs module, Added the "SD Card (SPI)" driver
   - Assigned CD, CS, WP pins of the SD Card (SPI) module
3. Generate the code
 
After generating the code, building the code results in the following error.
i. "../drivers/spimaster.h" not found error
ii. Redefinition of "DIR" structure error
 
As for the (i) error the header file name is wrong. So I modified it to the correct name "../drivers/spi_master.h" and error resolved.
 
As for the (ii) error I have no idea to resolve it. "DIR" structure is defined in both ff.h and pic18f14k50.h. ff.h defines "DIR" structure to handle directory objects in FAT file system. pic18f14k50.h defines "DIR" as USTAT <DIR> bit.
 
I will wait for the update, but I would like to know any workaround if possible.
 
Thanks in advance.
#1

5 Replies Related Threads

    katela
    Super Member
    • Total Posts : 1429
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: Issues in Generated Code with "SD Card Library" and "FatFs Library" 2019/06/21 17:41:26 (permalink)
    4 (1)
    Can you post your full error message? Not just a summary.

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    #2
    ToolLabs
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2013/07/03 04:11:46
    • Location: 0
    • Status: offline
    Re: Issues in Generated Code with "SD Card Library" and "FatFs Library" 2019/06/21 18:01:21 (permalink)
    0
    Thank you very much for your prompt reply!
     
    I've attached the error log file. It says "DIR" is redefined...
    #3
    Danno
    Super Member
    • Total Posts : 273
    • Reward points : 0
    • Joined: 2005/09/07 10:12:10
    • Status: offline
    Re: Issues in Generated Code with "SD Card Library" and "FatFs Library" 2019/06/26 15:52:32 (permalink)
    0
    Do you need USB for your project? 
    I see there is a DIR bit in the USB Peripheral that conflicts with a definition in FatFS.
    #4
    ToolLabs
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2013/07/03 04:11:46
    • Location: 0
    • Status: offline
    Re: Issues in Generated Code with "SD Card Library" and "FatFs Library" 2019/06/26 16:12:29 (permalink)
    0
    Thanks for your comment.
     
    No, I don't need USB features.
     
    'DIR' is defined in the pic18f14k50.h header file and this file is to be included during build process, so I will try build my project with commenting out the USTAT structure definition in the pic18f14k50.h file. I hope there will be no effect to other code.
     
    Thank you for your clue!
    #5
    Danno
    Super Member
    • Total Posts : 273
    • Reward points : 0
    • Joined: 2005/09/07 10:12:10
    • Status: offline
    Re: Issues in Generated Code with "SD Card Library" and "FatFs Library" 2019/06/26 16:35:42 (permalink)
    0
    If you are not using USB, that bit is never accessed.
    #6
    Jump to:
    © 2019 APG vNext Commercial Version 4.5