Alfat Sd/mmc


Results 1 to 32 of 32

Thread: Alfat Sd/mmc

Threaded View

  1. #9
    eoasap's Avatar
    eoasap Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by PaulBarter
    Powerup:
    Pause 500
    low ALFAT_CTS_PIN
    pauseus 20
    Input ALFAT_RTS_PIN
    pauseus 20
    low ALFAT_RESET_PIN
    Pause 200
    input ALFAT_RESET_PIN
    pause 500

    'Send reset string
    gosub clear_LCD
    lcdout "Sent- RS OK"
    serout2 ALFAT_RX,ALFAT_BAUD,["RS OK",13]
    serin2 ALFAT_TX,ALFAT_BAUD,2000,ALFAT_ERROR,[skip 2,str ALFAT_STRING\15] 'BRING IN UPTO 15 BYTES

    TIA
    My project is fully functioning now also (I use the Alfat chip and not the usb wiz, but should be similar). don't send the "RS OK" function first. you need to send "R" to run the firmware. Without running the firmware, you can't do anything and you're still in the bootloader. your code is right up until sending "RS OK". You only need to reset by dropping the reset pin low, not by sending out "RS OK". I can't imagine a scenario where you'd need to send "RS OK"

    this is what i have:

    LOW ALFAT_CTS : PAUSEUS 20 'MAKE CTS INPUT
    INPUT ALFAT_RTS : PAUSEUS 20 'MAKE RTS PIN OUTPUT LOW
    LOW ALFAT_RS : PAUSE 300 'PULL THE RESET PIN LOW
    INPUT ALFAT_RS 'BRING THE ALFAT OUT OF RESET
    INPUT ALFAT_TX 'RECEIVE ALFAT DATA

    SERIN2 ALFAT_TX , ABAUD , [str ALFATIN\2] 'should be "BL"

    LCDOUT CMD, LINE1, "ALFAT BOOT"
    LCDOUT CMD, LINE2, str ALFATIN\2
    ' pause 1000

    BL_Version_Read:
    LCDOUT CMD, CLR
    LCDOUT CMD, LINE1, "Bootloader Vers."
    SEROUT2 ALFAT_RX, ABAUD , ["V"] 'receive 3.0
    SERIN2 ALFAT_TX , ABAUD , [str ALFATIN\3] 'wait for CR
    LCDOUT CMD, LINE2, str ALFATIN\3
    ' pause 1000


    Firmware_Run:
    LCDOUT CMD, CLR
    SEROUT2 ALFAT_RX, ABAUD , ["R"]
    SERIN2 ALFAT_TX , ABAUD , [wait("A"), str ALFATIN\16]

    lcdout cmd, line1, "Firmware Active"
    lcdout cmd, line2, "A"
    lcdout cmd, lcdb2, str ALFATIN\16
    'will receive "Alfat Version 3.12 Z:" (or similar)
    'if you get "BL" in return, you need to update firmware
    pause 1000

    Disable_Echo:
    LCDOUT CMD, CLR
    SEROUT2 ALFAT_RX, ABAUD, ["EE 0", 13]
    SERIN2 ALFAT_TX, ABAUD, [str ALFATIN\2]
    lcdout cmd, line1, "ALFAT"
    lcdout cmd, line2, "INITIATED"
    ' pause 2000
    alfat_exit:
    RETURN



    'then after what i call 'initializing the alfat' , you need to change to drive A 'like this to access the SD card

    ALFAT_DRIVEA:
    LCDOUT CMD, CLR
    LCDOUT CMD, LCDA4, "CHANGING"
    LCDOUT CMD, LCDB4, "TO DRIVE A"
    ' PAUSE 500

    SEROUT2 ALFAT_RX, ABAUD,["A:", 13]
    SERIN2 ALFAT_TX, ABAUD ,[wait(13),str ALFATIN\3]
    LCDOUT CMD, CLR
    LCDOUT CMD, LINE1, "Command Prompt"
    LCDOUT CMD, LINE2, STR ALFATIN\3
    ' pause 500
    RETURN


    ' after this, you can create files and write to them like this
    'A = append existing file
    'R = open to read only
    'W = Create new file to write to
    SEROUT2 ALFAT_RX, ABAUD, ["OF W#1 GPRMC.TXT", 13]
    'open NEW file, called GPRMC.TXT
    LCDOUT CMD, CLR
    LCDOUT CMD, LINE1, "Open GPRMC.TXT"
    LCDOUT CMD, LINE2, "Success"
    pause 1000


    'tell alfat how many bytes (in hex) to write
    SEROUT2 ALFAT_RX, ABAUD, ["WF #1 6", 13]
    'send out the actual bytes to be writting
    SEROUT2 ALFAT_RX, ABAUD, ["$GPRMC" , 13] 'write the bytes


    'same thing but with a variable
    'Store Current GPS Data
    SEROUT2 ALFAT_RX, ABAUD, ["WF #1 36", 13] '
    SEROUT2 ALFAT_RX, ABAUD, [str GPRMC_IN\54, 13]


    I can write at least several hundred kb doing this without any problems (haven't tried logging longer yet) so it works fine
    let me know if you get stuck!
    Last edited by eoasap; - 9th February 2006 at 14:36.

Similar Threads

  1. Where should I discuss SD/MMC FAT issues?
    By JD123 in forum General
    Replies: 92
    Last Post: - 2nd April 2008, 22:41
  2. pic + alfat sd
    By ranaz in forum General
    Replies: 0
    Last Post: - 27th July 2006, 07:08
  3. SD/MMC Adapter
    By lester in forum Adverts
    Replies: 1
    Last Post: - 11th July 2006, 16:47
  4. Reading and Writing from SD/MMC cards as FAT filesystem?
    By charliez in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd June 2006, 23:26
  5. GHI Electronics ALFAT and USBWiz products.
    By lester in forum Adverts
    Replies: 1
    Last Post: - 15th June 2005, 13:59

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