Hi,
I've used the SPIS_Example (Code Example), which saves data using DMA. I've added an interrupt to the DMA_RX (nrq) to notify when the buffer is full and that works fine. When I add an SPI Master module to the slave and transmit the data directly to the SPI slave it works as well.
I would like to send data from an arduino sensor to the SPI slave. The SPI Master was removed and the SPI pins added back. I have the slave configured as CPHA=0, CPOL = 0, MSB First, with buffer sizes of 5. The arduino Uno is set up as shown below:
void setup() {
Serial.begin(9600);
pinMode (psoc_ss, OUTPUT);
digitalWrite(psoc_ss, HIGH);
delay(1);
SPI.begin();
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(MSBFIRST);
}
and the data is transfered using the following method
void notifyPSoC(){
Serial.println("Sending floats");
digitalWrite(psoc_ss,LOW);
float curx = -9.9999;
//transfer float
unsigned char *chptr;
chptr = (unsigned char *) &curx;
SPI.transfer(0x11u);
SPI.transfer(*chptr++);
SPI.transfer(*chptr++);
SPI.transfer(*chptr++);
SPI.transfer(*chptr);
delay(10);
float cury = -9.9999;
//transfer float
unsigned char *chptr2;
chptr2 = (unsigned char *) &cury;
SPI.transfer(*chptr2++);
SPI.transfer(*chptr2++);
SPI.transfer(*chptr2++);
SPI.transfer(*chptr2);
delay(40);
digitalWrite(psoc_ss,HIGH);
}
The issue is the data output from the SPIS module now has no correlation with what is being sent. I have a logic level shifter so that the the arduino can talk to PSoC. Have I missed something obvious?
Thanks