test code
Duane Degn
Posts: 10,588
····· *******Test Post********
I'm trying to write a simple test program to read and write to Winbond flash memory.· I'm using Mike Green's driver found at:
http://forums.parallax.com/showthread.php?p=805638
I cam·read the size of the flash memory but I can't write to it.
I've attached my demo code.· What am I doing wrong?
Duane Degn
Post Edited (Duane Degn) : 10/24/2009 3:42:57 PM GMT
I'm trying to write a simple test program to read and write to Winbond flash memory.· I'm using Mike Green's driver found at:
http://forums.parallax.com/showthread.php?p=805638
I cam·read the size of the flash memory but I can't write to it.
I've attached my demo code.· What am I doing wrong?
Duane Degn
Post Edited (Duane Degn) : 10/24/2009 3:42:57 PM GMT

Comments
Here's my try at a demo program using Mike Green's Winbond driver.
It reads the size of memory successfully but it doesn't write to the flash memeory.
{{ WinbondTest1a.spin Attempt at a demo program for Michael Green's Winbond flash driver. Vdd(+3.3V) Vdd(+3.3V)   ┌┫ W25X16A ┌╋─┐   │ ││ ┌────────────────┐││ │ 0.1µF P0 ──┼┼─┤1 /CS Vcc 8├┼┼─┻────── Vss P3 ──┼┻─┤2 DO /Hold 7├┘│ └──┤3 /WP CLK 6├─┼──────── P1 ┌──┤4 GND DIO 5├─┻──────── P2  └────────────────┘ Vss Pullup resisters are 10K }} con _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 _CS = 0 _Clk = 1 _DIO = 2 _DO = 3 _DebugBaud = 9600 OBJ Debug : "FullDuplexSerialPlus" Win : "Winbond_Driver" VAR long location byte buffer[noparse][[/noparse]128] PUB Main | localTemp Debug.Start(31, 30, 0, _DebugBaud) location := @buffer[noparse][[/noparse]0] localTemp := win.start(_CS, _Clk, _DIO, _DO, -1, -1) Debug.str(string(13, "Starting Winbond driver returned = ")) Debug.dec(localTemp) localTemp := flashSize Debug.str(string(13, "flashSize = ")) Debug.dec(localTemp) eraseData($8000) repeat localTemp from 0 to 127 buffer[noparse][[/noparse]localTemp] := localTemp Debug.str(string(13, "buffer filled with squential numbers = ")) repeat localTemp from 0 to 127 Debug.hex(buffer[noparse][[/noparse]localTemp], 2) Debug.str(string(", ")) Debug.str(string(13, "Write buffer to flash memory. Then erase buffer from prop memory.")) writeData($8000, location, 128) waitcnt(clkfreq / 10 + cnt) byteFill(@buffer, 0, 128) Debug.str(string(13, "cleared buffer = ")) repeat localTemp from 0 to 127 Debug.hex(buffer[noparse][[/noparse]localTemp], 2) Debug.str(string(", ")) Debug.str(string(13, "Restore buffer from flash memory. Buffer = ")) readData($8000,location,128) waitcnt(clkfreq / 10 + cnt) repeat localTemp from 0 to 127 Debug.hex(buffer[noparse][[/noparse]localTemp], 2) Debug.str(string(", ")) repeat pub winStop return win.stop pub flashSize ' Return the size of the flash memory in bytes return win.flashSize pub readData(a,d,c) ' Read a block of data from Flash return win.readData(a,d,c) pub writeData(a,d,c) ' Write a block of data to erased Flash return win.writeData(a,d,c) pub eraseData(a) ' Erase a block of data return win.eraseData(a)Thanks for the reply.· I didn't think anyone read these.· This was the first time I've posted code and wanted to make sure I posted it correctly before posting my question to the Propeller forum.· I should have made it clear it was a test message.
Duane