Picbasic MMC SD : sdfs3.bas


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326

    Default Picbasic MMC SD : sdfs3.bas

    Hi to all,
    I am going to interface an SD MMC card with a pic18f452 programmed with PicBasicPro 2.50. I included the SDFS.BAS program in my basic code.
    I then started to modify the SDTEST3.bas in order to make it compatible with my currently used hardware based on 18f452. The pic has a 10Mhz xtal and I enabled the x4PPL to get 40 Mhz clock speed. I did try to slow the clock speed by removing the x4PLL leaving the pic operating at 10 MHZ but with no changes in the operation.
    The voltage level has been adapted usinh a three resistors divider ( 1k8 / 3k3 ) as indicated in other projects on the web.
    The pic runs correctly, it talks on the serial port with my PC but I still have init : 400, init : 620, init 860, init: 623... errors.
    I used 128 M , 256 M and 1 G cards with no improvements.
    The three cards work well on my camera.

    I attach to this message my modified basic code.
    I will appreciate to receive your suggestion, directions, ..help in order to solve the problem.
    Thanks in advance.
    Ambrogio
    IW2FVO

  2. #2
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    There doesn't appear to be any code attached.

    Where did you get the original code for interfacing SD cards if you don't mind my asking?

  3. #3
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    I did the procedure to attach the file but it not there !
    let me try again
    The program has been taken from MeLabs SDFS3.zip.

    Quote Originally Posted by Art View Post
    There doesn't appear to be any code attached.

    Where did you get the original code for interfacing SD cards if you don't mind my asking?

  4. #4
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    It is me again,
    i did the procedure to attach the file but it is still not there.
    Any help in attaching it ?
    Thanks
    Ambrogio


    Quote Originally Posted by Art View Post
    There doesn't appear to be any code attached.

    Where did you get the original code for interfacing SD cards if you don't mind my asking?

  5. #5
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    try to attach again
    Ambrogio



    Quote Originally Posted by Art View Post
    There doesn't appear to be any code attached.

    Where did you get the original code for interfacing SD cards if you don't mind my asking?
    Attached Files Attached Files

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Try changing this line to not use the hardware.
    Code:
    SDC_UseHardSPI = TRUE	' Use hardware SSP port for SPI.
    I think you have the PIC pins mixed up.

    And I think you will have better luck if you run the PIC from a 4MHz clock. Then you can run the whole thing from 3 volts and not have to worry with the resistors.

    Do you have the SD pins 8 and 9 pulled up to 3 volts? That is also needed.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    Thanks a lot for the instructions:
    I will put:
    *SDC_UseHardSPI = False
    *a new 4 Mhz xtal
    * possibly a 3v3 power supply
    Yes, pins 9 and 9 have a pull up of 10K to 3v3.
    I will let you know the resultsby tomorrow evening .
    Thanks again
    Ambrogio




    Quote Originally Posted by mackrackit View Post
    Try changing this line to not use the hardware.
    Code:
    SDC_UseHardSPI = TRUE	' Use hardware SSP port for SPI.
    I think you have the PIC pins mixed up.

    And I think you will have better luck if you run the PIC from a 4MHz clock. Then you can run the whole thing from 3 volts and not have to worry with the resistors.

    Do you have the SD pins 8 and 9 pulled up to 3 volts? That is also needed.

  8. #8
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I did all the changes... no improvement at all.
    The pic has to be programmed at 5Vdc. I then changed the power supply voltage to 3v3. No change.

    Thanks
    Ambrogio
    North Italy



    Quote Originally Posted by mackrackit View Post
    Try changing this line to not use the hardware.
    Code:
    SDC_UseHardSPI = TRUE	' Use hardware SSP port for SPI.
    I think you have the PIC pins mixed up.

    And I think you will have better luck if you run the PIC from a 4MHz clock. Then you can run the whole thing from 3 volts and not have to worry with the resistors.

    Do you have the SD pins 8 and 9 pulled up to 3 volts? That is also needed.

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    What errors are returned?
    For example, what do you receive here?
    Code:
    Gosub FSInit
    	Serout2 PORTC.6, 16780, ["Init: ", Dec FAT_error, " ", Dec SDC_status, " ", Dec SDC_response, $d, $a]
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. SD or MMC card as storage for logging
    By HYETİK in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 16th January 2012, 02:07
  2. MMC and SD cards
    By micro in forum General
    Replies: 0
    Last Post: - 8th April 2006, 15:28
  3. Picbasic VS C Compiler
    By koossa in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th October 2005, 21:44
  4. Replies: 22
    Last Post: - 12th July 2005, 17:39
  5. PicBasic Fundamentals
    By Billyc in forum General
    Replies: 9
    Last Post: - 4th May 2004, 10:04

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts