@tonton81
Was digging into the code a bit more and I don't think myFunc is ever being assigned via the OnReceive call. When I run the master with this slight change in the loop:
Code:
SPI.beginTransaction(SPISettings(24000000, MSBFIRST, SPI_MODE0));
digitalWriteFast(10, LOW);
for(uint8_t i = 0; i < 9; i++){
Serial.println(SPI.transfer(0));
}
delayMicroseconds(1);
digitalWriteFast (10, HIGH);
SPI.endTransaction();
Serial.println("=============");
delay(500);
this is what I am seeing in the slave window:
Code:
millis: 7416
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
millis: 8416
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
millis: 9416
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
and this is in the master:
Code:
=============
0
0
255
0
0
0
0
0
0
=============
It looks like its bypassing the function assignment:
Code:
if ( _spihandler ) {
_spihandler();
SLAVE_SR = 0x3F00;
asm volatile ("dsb");
return;
}
and printing from here:
Code:
while ( !(SLAVE_SR & (1UL << 9)) ) { /* FCF: Frame Complete Flag, set when PCS deasserts */
if ( SLAVE_SR & (1UL << 11) ) { /* transmit error, clear flag, check cabling */
SLAVE_SR = (1UL << 11);
transmit_errors++;
}
if ( (SLAVE_SR & (1UL << 8)) ) { /* WCF set */
uint32_t val = SLAVE_RDR;
Serial.print(val); Serial.print(" ");
SLAVE_TDR = val;
SLAVE_SR = (1UL << 8); /* Clear WCF */
}
}
Serial.println();
only other place that the slave code prints data out. Maybe its related to this change I made: https://forum.pjrc.com/threads/66389...l=1#post301214