Inconsistant reads w/ SPI Flash & TI 430 micro

I've implemented several routines for the TI 430 that interface with a SPI flash chip (reads, writes, read id, etc). The problem I'm having is that my reads are not always consistant. Flash is fully erased yet, I read in 0x00. If hit a breakpoint and restart I then read in 0xFF (which is expected when this particular chip is erased). What could possibly cause this?

Thanks, dcastel

Reply to
dcastel
Loading thread data ...

Hang a scope or logic analyser on it the SPI. Check timing, check data on the bus is what you see in registers. If you don't have a scope or logic analyser it will take you a very long time to sort it out. You might get some luck here (in c.a.e) but you would need to provide a lot more detail.

Michael Kellett

Reply to
MK

Correct SPI phase and clock polarity are crucial. You can sometimes get intermittent results if one is wrong simply because of hold times from the memory.

Mark Borgerson

Reply to
Mark Borgerson

And it doesn't matter how long you study the datasheets for the devices -- on the first attempt you'll get either phase or polarity set up wrong.

--
Grant Edwards                   grante             Yow! Will this never-ending
                                  at               series of PLEASURABLE
 Click to see the full signature
Reply to
Grant Edwards

Agreed (almost) - that's why you need the scope.

Murphy's second law says that the probability of getting it wrong is, in fact, directly proportional to the time spent studying the data sheets.

Michael Kellett

Reply to
MK

In cases like SPI clock setup where there are only four choices, one would be tempted to just try different combinations until you find one that works. But, somehow there's always one that isn't really right but will partially work just long enough to fool you into thinking it's right.

--
Grant Edwards                   grante             Yow! I know th'MAMBO!!
                                  at               I have a TWO-TONE CHEMISTRY
 Click to see the full signature
Reply to
Grant Edwards

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.