SPISelect( ); // this triggers my CS stuff
SPIWrite( c , 4 ) ;
SPIDeSelect(); // cancels the CS stuff…
I hookup my Digiview to the proper pins and I get, clock (perfect), Chip select (perfect), 1 byte transmitted , fine, but the remainder is as follows:
0x13, 0x84, 0x7D.
Shouldn’t I be seeing the same output? I have played with DV’s internal stuff (clock edge, LSB,MSB,bits,inverting clock, data, etc…). I cannot get the last 3 bytes to show properly. I have isolated the master and still get the same.
I tried changing the way the data is sent, 1 byte at a time, change the clock divisor, etc. No change.
You should look at the value you have written to the SBER register (page 143 in User’s Manual). This controls the mode that the port is operating in. Different modes can invert either the clock or the data lines. It is also normal with SPI to transmit bits in LSB to MSB order, although the R4000 will allow you to reverse this as well. It just so happens that the sequence you saw 0x55, 0x13, 0x84, 0x7D is exactly what you would expect if the data was inverted and interpreted in the opposite bit order (MSB to LSB). This of course really throws you by the fact that 0x55 looks the same when inverted and the bits are reversed. Just make sure you write the same mode and bit order on both processors and your communications should work fine.
If you plan on doing Rabbit to rabbit SPI connections, be very careful with the speed at which you are communicating.
In the simplest of designs, I have to RCM4110 talking over SPI and I found that the default transmit speed provided it too fast for the receiver and sender to synch. This causes the slave to lose a bit for every byte and report erroneous results. A clock diviser of 100 solved the problem but renders the whole interface quite slow.