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"Originally Posted by PaulBarter
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!





Bookmarks