Carlos Rodriguez

QE8 SPI slave does not transmit data to master

Discussion created by Carlos Rodriguez on Jul 22, 2008
Latest reply on Jul 24, 2008 by Carlos Rodriguez
Dear community,
 
I've been developing a SPI slave application using the QE8, so far I haven't been able to make the QE8 slave transmit data to the master, the master does trasmit the first "command" byte and then a blank byte just to clock the bus and get the byte out of the slave but it doesn't work. I know my master code is not bad because I'm using the same one to read other SPI devices.
 
I've read a couple fo threads in this forums regarding SPI_slave bugs but those are for the HSC12, the same fix didn't work for my case.
 
My application code is the following (using interrupts):
 
void interrupt SPI_RX_isr (void)
{
 byte temp;
 temp = SPIS;  /* Read the SPI Status and Control Register (required to acknowledge interrupt) */
 temp = SPID; /* Read of SPDR to complete the interrupt acknowledgement.
    if (temp & READ_FLAG) {
      switch (temp) {
        case GXP_HITS_ACUM_L:
          SPID = (byte) g_hits;
          while(!SPIS_SPRF);     
          temp = SPID;
          break;
        case GXP_HITS_ACUM_H:
          SPID = (byte) (g_hits >> 8);
          while(!SPIS_SPRF);     
          temp = SPID;
          break;
        default:
          SPID = 0;
          break;
      }
    } // if (temp & READ_FLAG)
  }
}
 
What I read all the time is the same byte the master srote to the slave, so it seems like the slave cannot modify the SPID register... When I step-by-step my code, the SPID = X assignment doesn't do a thing with the SPID memory location (address 0x2D).
 
An observation I made is that the SPIS_SPTEF flag never gets set, could this be related to my bug? (if it is it will be a HW bug)
 
Has somebody made the SPI slave work on a HCS08?
 
Kindest Regards,
Carlos


Message Edited by Lokutas on 2008-07-22 09:24 AM

Message Edited by Lokutas on 2008-07-22 09:27 AM

Outcomes