using the 9S08AW32 with serial (SPI) Flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

using the 9S08AW32 with serial (SPI) Flash

2,521 Views
baddad
Contributor I
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.
BadDad



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

 

25FxxxS33.pdf

Message Edited by t.dowe on 2009-10-20 01:28 PM
Labels (1)
0 Kudos
1 Reply

348 Views
baddad
Contributor I
Nevermind.......
 
My clock polarity was wrong.
 
Works great now.
 
:smileyvery-happy:
0 Kudos