2 Replies Latest reply on Feb 26, 2015 6:26 PM by anko_284866

    SCB SPI Slave - tell when SS is negated?

      I'm looking through the SCB datasheet and API as well as the architecture/registers TRMs and don't see a way to either poll or be notified through an interrupt when the SPI slave is no longer selected.




      Is there a way to do this that doesn't involve routing SS to two pins, one for the SCB and another that is just a GPIO with an interrupt configured for rising edge?




      The reason I'm looking for this is to cleanly reset my SPI reception stack when a master either aborts or otherwise gets out of sync with the receiver software. Counting bytes won't work with aborted transfers. I thought of maybe using a timer which resets the rx software stack on overflow (and is reset whenever a byte is received) but that's kind of hokey.

        • 1. Re: SCB SPI Slave - tell when SS is negated?

          The data sheet is a little bit silent on the details of the slave operation. But you migth get lucky that SPI_SpiIsBusBusy() also works for slave mode.

          • 2. Re: SCB SPI Slave - tell when SS is negated?

            That's a really good idea!




            the SCB SPI Slave header file (SPIS.h for me) has the following defined:

            /* SPIS_SPI_STATUS_REG  */ #define SPIS_SPI_STATUS_BUS_BUSY_POS    (0u)  /* [0]    Bus busy - slave selected */ #define SPIS_SPI_STATUS_BUS_BUSY        ((uint32) 0x01u)



            Now the actual function doesn't exist, but this is definitely worth looking at. It seems it might be specific to EZSPI but this is a good direction to look.




            Somerthing else I've noticed is that the pin-specific APIs seem to be exposed even if the SCB is "in charge" of the line, I might be able to query the pin register directly.