Okay, I'm on the last hurdle of my SPI Slave library.
Here's my problem:
I am creating an array for data the slave will receive from the master.
Assuming the array has a length of, lets say, 100.
When I put the array in my lib it doesn't it doesn't write fast enough.
When I put the array in my main sketch it works fine.
It's being used by my interrupt every time data is received.
if I use:
receivedData[pointer] = SPI0_POPR;
everything works fine.
if I use:
SPI_SLAVE.receivedData[pointer] = SPI0_POPR;
I get problems due to the array not writing fast enough.
Any ideas? Is there a way to use arrays faster? Here is my interrupt code:
Here's my problem:
I am creating an array for data the slave will receive from the master.
Assuming the array has a length of, lets say, 100.
When I put the array in my lib it doesn't it doesn't write fast enough.
When I put the array in my main sketch it works fine.
It's being used by my interrupt every time data is received.
if I use:
receivedData[pointer] = SPI0_POPR;
everything works fine.
if I use:
SPI_SLAVE.receivedData[pointer] = SPI0_POPR;
I get problems due to the array not writing fast enough.
Any ideas? Is there a way to use arrays faster? Here is my interrupt code:
Code:
void spi0_isr(void){ //SPI Interrupt
receivedData[pointer] = SPI0_POPR;
pointer++;
if (pointer == dataLength){
pointer=0;}
SPI0_PUSHR_SLAVE = SPI_SLAVE.returnData[pointer];
SPI0_SR |= SPI_SR_RFDF;
}
Last edited: