I am interfacing with PIC MCU via SPI. I am sending 32 bits of data to the PIC. I have configured SPID on PORTD as a slave and the SPI port on the PIC is the master. The XMEGA is reading and processing data from an ADC and conveys it to the PIC. When a packet of data is ready, the PIC expects the MISO pin (PD6) to go low. It then initiates the data transfer.
The problem is with PD6. I set it as an output:
PORTD.DIRSET = SPI_MISO_bm;
And then toggle it high
PORTD.OUTSET = SPI_MISO_bm;
to let the PIC know that data is not ready. I later toggle it low
PORTD.OUT &= ~SPI_MISO_bm;
when the data is ready.
When I probe PD6 with my DMM, it is always low (0.001V or so). If I don't configure the SPID, PD6 goes high and low as expected. But if SPID is on, the functionality seems to be lost. I am using an AvrDrago and can toggle the pins directly: same thing, if SPID is on, PD6 doesn't budge from 0V.
When the SPID is on, PD6 is in tri-state. So maybe my DMM is pulling it low. But this doesn't seem to be right since the DMM has a pretty high input impedance.
I am not sure why PD6 is acting this way.