How i spend my sunday ......
Just spend an entire sunday trying to get my first dataflash up & running :? :?
I got a few dataflash as samples , but they are TSSOP :cry:
And i spend 3 hours fiddeling , making the the board with stripboard and thin wire.
Then it was time to test it , and i succesfully read the dataflash statusregister (it reads 0x9C) for a 4Mb dataflash that is "idle"..
Then i grabbed the GCC-Butterflly port of the dataflash files , and could still read the statusregister.
Step2 : I snipped some testcode from the butterfly test routines , and thats where the trouble began i always read 0xff :cry:
I did not want to wear out the dataflash , so the fistt thing i did was to write 50 bytes to the dataflash and then read it back .. just once.
Then i looped in a while(1) , and read and printed the statusbyte.
I spend like 6 hours debugging , and was uncertain if i had broken a wire on the adapterboard ... I couldnt test that as i had encapsulated the wires in glue. Because last time i tried this TSSOP trick with wires i broke off one of the dataflash legs , while i was fiddeling with the wire.
So this time i used a gluegun this time to enforce the dataflash end :wink:
The disadvantage of this is that you can not measure on the dataflash legs , and remember not to cross the wires before gluing. So that you are sure what wires comes from what pin. Because the glue is only transparent until it gets cold , and then you just have some wires sticking out of that glue stuff.
I got desperate and got out my LSA , but the timing was fine ,
CS_high was 480ns , and SCK was around 60ns (well maybe pushing a bit..)... but i still read the statusbytes fine , and still read just 0xff from the dataflash even though i had programmed a
I did try to slow down SPI and enter lots of strange delays at strange places ... still no luck.
Then i had a look at the statusbyte read routine (cause that was working) . and then i discovered it :oops: :oops:
In the butterfly routines there is a function in the read statusbyte routine that extracts the number of pagebits and the pagesize , and initialises a pair of global variables , from a pair of flashtables.
Guess who did not call the read statusbyte , before jumping to his testroutine , that he also snipped from the butterfly port.
So number if pagebits was zero & pagesize was zero , that was why the dataflash never wrote anytning.
So a thing to remember when using the butterfly dataflash code , is to call
the read statusbyte , just after the SPI init call.
Ohh Btw : Thanx for the port MJT , it worked fine