Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 29, 2024, 04:37:35 16:37


Login with username, password and session length


Pages: [1]
Print
Author Topic: proton and sdhc cards  (Read 7694 times)
0 Members and 1 Guest are viewing this topic.
jeanninemtv
Senior Member
****
Offline Offline

Posts: 311

Thank You
-Given: 57
-Receive: 25


« on: January 13, 2012, 12:10:09 00:10 »

hi, i read that the proton sd fille system library supports sd cards, but when i plug a sdhc nothing happens, is any modification necessary to have success with the other ones?

thanks in advance
Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1195

Thank You
-Given: 539
-Receive: 408



« Reply #1 on: January 13, 2012, 06:45:29 06:45 »

jeanninemtv Use this has your test code has I know it works, You may have to change the port settings and pic but it should get you going. Did you use the drawing out the help file to help you build the sd board



Code:
   Device 18F45K22
         Xtal =8
         
   
   

  LCD_DTPin = PORTB.0
LCD_RSPin = PORTB.4
LCD_ENPin = PORTB.5
LCD_Interface = 4
LCD_Lines = 2
LCD_Type = 0
     All_Digital = TRUE
LCD_DataUs = 50
    SCL_Pin = PORTC.3
    SDA_Pin = PORTC.4     



'-----------------------------------------------------------

All_Digital = TRUE

'-----------------------------------------------------------

Hserial_Baud = 4800                                         'Setup RS232 port

Hserial_RCSTA = %10010000                                       

Hserial_TXSTA = %00100000

'-----------------------------------------------------------

Dim Response As Byte

Dim SD_IO As Byte

'-----------------------------------------------------------

Symbol SD_CS = PORTD.2                                      'SPI CS to SD CS (SD pin 1)

Symbol SD_DI = PORTD.5                                      'SPI DO to SD DI (SD Pin 2)

Symbol SD_CLK = PORTD.3                                     'SPI CLK to SD CLK (SD Pin 5)

Symbol SD_DO = PORTD.4                                      'SPI DI to SD DO (SD Pin 7)

'-----------------------------------------------------------

Include "TESTCODE_LIB.PBP"     Device 18F45K22
     
'-----------------------------------------------------------

GoTo Over_Sub                                               'Jump over the subroutines

'-----------------------------------------------------------

Over_Sub:                                                       

    DelayMS 200

'-----------------------------------------------------------

Main_Prog:

    Print At 1,1,"INSERT SD OR MMC"

    Repeat

        Response = SD_Init_FS

    Until Response = 0

'-----------------------------------------------------------

Open_New_File:

    SD_File_Name = "TESTFILE"                               'File Name, upper case only!

    SD_File_Ext = "CSV"                                     'File Ext, upper case only! 

    Response = SD_Check_For_File                            'Check if file already exists

    If Response = 0 Then

        Print At 1,1,"FILE EXISTS - STOPPING"

        Stop

    Else         

        Print At 2,1,"OPENING FILE"
         SD_Day = 10: SD_Month =01: SD_Year = 12
         SD_Hours = 21 :SD_Minutes = 06: SD_Seconds = 25
        SD_New_File                                         'Open new file

    EndIf

'-----------------------------------------------------------

Write_To_File:

   Print At 2,1,"WRITING TO FILE"

    SD_IO_String = "TEST CODE"

    SD_Write_String_To_File                                 'Write SD_IO_String to file

    SD_Write_Byte_To_File 13                                                   

    SD_Write_Byte_To_File 10                                                   

'-----------------------------------------------------------

Close_File:

    SD_Close_File                                           'Close file
Print At 2,1,"FILE CLOSED"

    Stop
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
jeanninemtv
Senior Member
****
Offline Offline

Posts: 311

Thank You
-Given: 57
-Receive: 25


« Reply #2 on: January 13, 2012, 11:06:15 23:06 »

wait, you mean the same lib works for sdhc too?  maybe i have the wrong lib... but it's working only with the sd card and when i plug a sdhc card nothing happens ...

i know that the proton lib suppports fat16 file format and sdhc are working on fat32 format so no compatible at all, somewhere i read about a certain swordfish or amicus lib compatible for both but no file found until now Sad and the pbp lib for sdhc is a nightmare but i'm trying to test it -i attach the pbp files here on a compressed file in the next post-

thanks for your response, i will test your code... could you post the pbp include file just for checking if its the same ?
« Last Edit: January 13, 2012, 11:10:38 23:10 by jeanninemtv » Logged
pickit2
Moderator
Hero Member
*****
Online Online

Posts: 4639

Thank You
-Given: 823
-Receive: 4194


There is no evidence that I muted SoNsIvRi


« Reply #3 on: January 13, 2012, 11:23:13 23:23 »

jeanninemtv
until Wizpic gets back to you, when working with sd & sdhc cards & pics, don't you have to format them, with a pc first.
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1195

Thank You
-Given: 539
-Receive: 408



« Reply #4 on: January 14, 2012, 01:25:07 01:25 »

jeanninemtv the PBP file gets automaticily created when you compile aslong as the code was saved with the same name, EG testcode.bas then the include would be "TESTCODE_LIB.PBP", PDS then would create this.
Bearing in mind SDHC card may not work bigger than 2Gig with pic's and that goes for any compiler, I may be mistaken but I do remember reading some where about it

Pickit you don't have to but I do to be of the safe side
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
jeanninemtv
Senior Member
****
Offline Offline

Posts: 311

Thank You
-Given: 57
-Receive: 25


« Reply #5 on: January 14, 2012, 01:44:04 01:44 »

pickit: yes i formatted first my sd in w7 before test and worked i generated a file.txt from a internal counter, but i replaced the sd by the sdhc and nothin happened ...  same story with a mini sdhc mounted on his adapter ...  ok i'll test again with the testcode provided by wizpic Smiley  thankx

Posted on: January 14, 2012, 02:39:13 02:39 - Automerged

jeanninemtv the PBP file gets automaticily created when you compile aslong as the code was saved with the same name, EG testcode.bas then the include would be "TESTCODE_LIB.PBP", PDS then would create this.
Bearing in mind SDHC card may not work bigger than 2Gig with pic's and that goes for any compiler, I may be mistaken but I do remember reading some where about it

Pickit you don't have to but I do to be of the safe side

as i understand (im afraid of beein very wrong  )the .inc file was included in the same folder by you...  i dont know if the pbp file differs from mine ...
Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1195

Thank You
-Given: 539
-Receive: 408



« Reply #6 on: January 14, 2012, 09:06:04 09:06 »

here is the pbp file that got generated. Also the name of your file has to be 8 characters nothing less nothing more and it has to be in capitals too

I use 1GIG cards and it only has 1mb of data on it after logging for 6months

let me know how you get on or need more help





Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
gan_canny
Junior Member
**
Offline Offline

Posts: 89

Thank You
-Given: 101
-Receive: 26


« Reply #7 on: January 14, 2012, 09:38:02 09:38 »

Sometimes if a card isn't working, it is because the mbr has been messed up. A PC windows format is different than a factory format. If you have access to a camera then format your card in the camera and it will restore it to the manufacture's original format. Cards have varying write requirements. The MMC was like RAM and was byte addressed with a write block of 512 bytes ( you could read in bytes but had to write in 512 byte blocks). For MMC the max capacity the addressing could support was 4GB. Commerially few cards were manufactured at 4GB since it involved 4 wafers ( wafer max size was 1GB ) so popular cards were 1GB or 2GB. As the capacity increased the cards starting with SD use a hard disk type addressing (sector LBA type). The addressing scheme remains the same and the larger capacity between cards is a derivative of the sector size. Updates in all situations with cards are read/update /write and therefore the MCU doing the sector write needs enough RAM to buffer the sector. Code written for PIC will be different not only for FAT12 FAT16 FAT32 but also must accommodate the varying sector size as the card capacity increases. It doesn't end there since the electrical interface is also different. Most cards can be forced into SPI mode and often that is the 4 wire interface the MCU will use. SPI is for backwards compatibility but is not a mandate to the card manufacturer. Just to add more variation SPI comes in 4 modes itself dictated by the transitions of the clock and the data. Next there are the pull ups on the SPI interface the faster the I/O the lower the pull up value. Larger cards have tighter timeing constraints. Just as a hard disk identifies its addressing to its host at boot up so does a SD SDHC card. It is up to the host in this case the MCU to deal with this.
« Last Edit: January 14, 2012, 09:48:57 09:48 by gan_canny » Logged
twonuts
Active Member
***
Offline Offline

Posts: 118

Thank You
-Given: 55
-Receive: 42


« Reply #8 on: January 18, 2012, 10:06:28 10:06 »

Have you tried the Panasonic SD card formatter software?
Also does SDHC cards.

Free from Panasonic web site, page listed below.

http://panasonic.jp/support/global/cs/sd/download/index.html

Versions are available for Windows and Mac OS

« Last Edit: January 18, 2012, 10:10:17 10:10 by twonuts » Logged
jeanninemtv
Senior Member
****
Offline Offline

Posts: 311

Thank You
-Given: 57
-Receive: 25


« Reply #9 on: January 20, 2012, 03:28:20 03:28 »

hi, your lib provided for an unexpected reason dont work for me (compile ok but nothing happened to my sd card 1GB )

i tried another lib and it worked but ...  when i have no sd card in the slot it jumps until the part of opening file ...  (maybe a voltage level when the pins are in the air)  ... 

btw i am using just the rdo  ck sdi cs, there are some pins from the connector that are not used

the doubt still remaining is ...  is there any "easy" way to modify that freaky code of the lib to obtain a sdhc compatible lib?
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC