Update: Just confirmed this behavior with the PixySPI_SS arduino library with Pixy set to SPI with SS mode so am pretty sure it’s a Pixy firmware problem. Unless my brand new Pixy is a bad unit.
Hi all, can’t seem to figure out what’s causing this problem but I am using SPI with slave select (on a PSoC 4 microcontroller) and it seems that I am able to read the correct data whenever an object is detected (0xaa55,0xaa55, then 6 16 bit words). However, when the object is no longer in view and not detected, I am getting 0xaa55 continuously instead of 0x0000. If I restart the Pixy, I do get 0x0000 but after it detects an object once it continuously sends 0xaa55 even when the object is no longer in view. I am getting the correct behavior with the Arduino ICSP SPI mode (0x0000 when no object is in view). I have attempted to solve the problem by updating to the latest firmware to no avail. This is my code for getWord().
int16 getWord() { uint16 word; uint8 lsb; ss_Write(0u); //Set ss low to start SPI PixyCom_WriteTxData(PIXY_SYNC_BYTE); //Write sync byte to Pixy via SPI while (PixyCom_GetRxBufferSize() == 0) { //Do nothing until we hear back from Pixy } word = PixyCom_ReadRxData(); //Get the MSB word <<= 8; //Do the same thing again for the LSB PixyCom_WriteTxData(0x00); //Send dummy data while (PixyCom_GetRxBufferSize()<1) { } lsb = PixyCom_ReadRxData(); word |= lsb; ss_Write(1u); //Turn slave select back on high return word; }