Brian Witzen

using the 9S08AW32 with serial (SPI) Flash

Discussion created by Brian Witzen on Jul 3, 2007
Latest reply on Jul 3, 2007 by Brian Witzen
I am using the 9S08AW32 with the Intel QH25F160S33B8 serial (SPI) flash (attached).
I have used SPI in the past with assembly, but was hoping to move to C this time.  Even after looking at other examples, I still get no data back from the flash.  Here is my code for the simple task of reading the manufactuer ID code (command=0x9F, no address needed and 3 bytes are returned)
// read the manufacture ID and Device ID
void Read_ID(void) {
 SPI_TX1(0x9F);              // Send read ID command
 ID[0] = SPI_TX1(0);        // Send read MFG ID code
 ID[1] = SPI_TX1(0);        // Send read ID code 1st byte
 ID[2] = SPI_TX1(0);        // Send read ID code 2nd byte
// spi transmit byte function
byte SPI_TX1 (byte sendval)
   while (!SPI1S_SPTEF);
   SPI1D = sendval;
   while (!SPI1S_SPRF);
   return (SPI1D);
The calling routine is handling the chip select (verified by o-scope).
I'm hoping I've just overlooked something simple.
Any help is greatly appreciated.

Message Edited by baddad on 2007-07-03 07:20 PM



Message Edited by t.dowe on 2009-10-20 01:28 PM