• AVR Freaks

Hot!SD Card interface with PIC18F97j60

Author
prasanth R
Starting Member
  • Total Posts : 75
  • Reward points : 0
  • Joined: 2017/01/10 04:46:37
  • Location: 0
  • Status: offline
2019/12/03 22:49:28 (permalink)
0

SD Card interface with PIC18F97j60

Hi,
I'm developing a simple program to interface standard SD card with PIC18F97j60 MCU, to creat a .txt file on the SD card.
Is it possible with PIC18F97j60?If its so,Can i use MDD file system or FATfs lib.
How do i modify Microchip libs MDDFS-SD Card from PIC18F87j50 to PIC18F97j60
or else plz provide me with working FATFs library code for PIC18F97j60.
So please help, and I will appreciate your recommendation toward this project.
 
#1

12 Replies Related Threads

    katela
    Super Member
    • Total Posts : 1469
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: online
    Re: SD Card interface with PIC18F97j60 2019/12/04 04:27:18 (permalink)
    +1 (1)
    Microchip libs MDDFS-SD was done for the old compiler, it will be a hassle making it work with XC8 compiler.
    You can use FATFs lib with MCC using the File System Library

    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
    prasanth R
    Starting Member
    • Total Posts : 75
    • Reward points : 0
    • Joined: 2017/01/10 04:46:37
    • Location: 0
    • Status: offline
    Re: SD Card interface with PIC18F97j60 2019/12/04 05:23:40 (permalink)
    -3 (3)
    I'm using PIC18F97j60 with C18 compiler.
    Can you please send me complete code for PIC18F97j60?
    #3
    prasanth R
    Starting Member
    • Total Posts : 75
    • Reward points : 0
    • Joined: 2017/01/10 04:46:37
    • Location: 0
    • Status: offline
    Re: SD Card interface with PIC18F97j60 2019/12/04 05:31:46 (permalink)
    0
    "Release Notes for MPLAB® Code Configurator’s File System Library v1.00" says to "Download 'filesystem-v1.00.mc3lib' from microchip website." This is a MCC plug-in for Fatfs. I am unable to find this file. Can someone show me where to find it? Thanks in advance!
    #4
    katela
    Super Member
    • Total Posts : 1469
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: online
    Re: SD Card interface with PIC18F97j60 2019/12/04 05:48:54 (permalink)
    +1 (1)
    prasanth R
    I'm using PIC18F97j60 with C18 compiler.
    Can you please send me complete code for PIC18F97j60?


    Why are you using the old C18 compiler? What's the benefit of using such an old tool? MCC won't support it, if you really have to use it, then use the old Microchip libs MDDFS-SD.
    Here is the link to the MCC FATFs library: https://www.microchip.com/mymicrochip/filehandler.aspx?ddocname=en610077
     
    Unfortunately no one is going to give you the exact code for the exact PIC you are looking for, Try to do it yourself and if you get stuck, then post your errors. This video explains step by step how to do it but using a different PIC and using the FATFs library directly, it does not use the MCC generated FATfs library. It was done before.

    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
    #5
    prasanth R
    Starting Member
    • Total Posts : 75
    • Reward points : 0
    • Joined: 2017/01/10 04:46:37
    • Location: 0
    • Status: offline
    Re: SD Card interface with PIC18F97j60 2019/12/04 23:07:35 (permalink)
    0
    Hi Katela,
    I have encountered a couple of issues during building a code which handles sd card.
    Followings are the steps I have tried.
    1. Generate the new project with following parameters: Device=PIC18F97j60, 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.
    mcc_generated_files/fatfs/fatfs_demo.c:29:: error: (1250) could not find space (563 bytes) for variable _drive
    mcc_generated_files/fatfs/fatfs_demo.c:30:: error: (1250) could not find space (548 bytes) for variable _file
     
     
    #6
    ric
    Super Member
    • Total Posts : 24646
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: SD Card interface with PIC18F97j60 2019/12/04 23:12:57 (permalink)
    +1 (1)
    Sounds like you need a PIC with more FLASH memory, or a paid version of the compiler.
    You can licence the PRO version of the compiler on a month by month basis (after you've used up the one-off trial period)

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #7
    prasanth R
    Starting Member
    • Total Posts : 75
    • Reward points : 0
    • Joined: 2017/01/10 04:46:37
    • Location: 0
    • Status: offline
    Re: SD Card interface with PIC18F97j60 2019/12/05 00:36:15 (permalink)
    0
    I'm using PIC18f97j60 .Its Flash program memory is 128K and XC8 compiler version is  v2.05. But Some of others did Same SD card Project on PIC18F45K22 with 32K flash only.So i think its not like memory issue for my case and in addition to that i'm using recommended compiler version for FatFsfile system library. So kindly let me know whats other possiblities.
    #8
    katela
    Super Member
    • Total Posts : 1469
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: online
    Re: SD Card interface with PIC18F97j60 2019/12/05 04:54:13 (permalink)
    +1 (1)
    Can you try to Switch to C90 mode or post your code?

    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
    #9
    prasanth R
    Starting Member
    • Total Posts : 75
    • Reward points : 0
    • Joined: 2017/01/10 04:46:37
    • Location: 0
    • Status: offline
    Re: SD Card interface with PIC18F97j60 2019/12/05 05:09:10 (permalink)
    0
    Hi Katela,
     
    After generating the code, building the code results in the following error.
    mcc_generated_files/fatfs/fatfs_demo.c:29:: error: (1250) could not find space (563 bytes) for variable _drive
    mcc_generated_files/fatfs/fatfs_demo.c:30:: error: (1250) could not find space (548 bytes) for variable _file
    #10
    katela
    Super Member
    • Total Posts : 1469
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: online
    Re: SD Card interface with PIC18F97j60 2019/12/05 05:22:40 (permalink)
    +1 (1)
    You have said that already in #5

    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
    #11
    trossin
    New Member
    • Total Posts : 26
    • Reward points : 0
    • Joined: 2006/06/02 11:31:50
    • Location: 0
    • Status: offline
    Re: SD Card interface with PIC18F97j60 2019/12/06 21:47:24 (permalink)
    +1 (1)
    The error is most likely saying you don’t have enough RAM and not about code space
    #12
    edc_95
    New Member
    • Total Posts : 1
    • Reward points : 0
    • Status: offline
    Re: SD Card interface with PIC18F97j60 2019/12/08 18:48:51 (permalink)
    +1 (1)
    The size of stack-based variables is limited by the size of a data bank. As a workaround, you can move the definition of the variables drive and file just outside the FatFsDemo_Tasks() function.
    #13
    Jump to:
    © 2019 APG vNext Commercial Version 4.5