SPI on Port C

Hi, I’m trying to do a combined ethernet and SPI program using an RCM3700 and Chipcon 8051 compatible microcontroller and I ran into problem. I made a simple SPI program that reads in the SPI data and that worked fine on Port B with the #define SERB_USEPORTD as well as Port C and Port D when I tried it. I also wrote a program to handle tcp sockets for the ethernet and that worked fine on its own as well. When I put them together (each in it’s own costate) I had to set it to Port C because of conflicts with the ethernet on the other port. This worked great (and seemed to go Alot faster when doing printf’s of the incoming data) until I got a “bad packet” error while that was running. I assumed it was something in my code and I just clicked ok and double checked my code. Everything seemed fine, but ever since then Port C no long works for SPI. I went back and tried my original program that simply read in the SPI data, and it works fine on all the other ports except port C.

I’m wondering what could cause port C to work and then suddenly die like this? I’ve tried another RCM3700 microcontroller and it too does not work with port C. After reading the archives I think the bad packet error has to do with a communication problem with the rabbit. I’ve tried using normal reading and writing to port C so I think its just limited the SPI. Is there any registers that might be storing something funky that I can clear or erase? From what I can tell it seems to be “hanging” when I call the SPIRead() function. My code for reading from port C is listed below.

#class auto
#define SPI_SER_C
#define SPI_SLAVE
#use “spi.lib”

void main(){
char spi_reading[10];
SPIinit(); // initialize SPI

while(1){

	SPIRead(spi_reading, 8);
	printf("SPI bytes = 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x

", spi_reading[0], spi_reading[1], spi_reading[2], spi_reading[3], spi_reading[4], spi_reading[5], spi_reading[6]);
}
}

Any ideas / help is greatly appreciated.
Thanks in advance!

Have you verified that the unit this is connected to is actually sending data? You have the SPI port defined as a slave which would hang up if not getting a serial clock from a master device. That’s all I can see with the small sample you sent.