Ok I have it working now, thanks for the assists and suggestions etc.
I plugged all my wires to SPI2 and it worked, so I thought maybe the analyser was interfering somehow, so removed those probes and put wires back to SPI1, still works. Put probes back on and still works.
For curiosity should anyone fall upon this post. ( a little crude, but will tidy it up after I have finished revelling in success )
#include <SPI.h>
char buf [100];
volatile byte pos;
volatile boolean process_it;
void setup()
{
Serial.begin(9600);
pos = 0; // buffer empty
process_it = false;
SPI.setModule(1);
SPI.beginSlave();
spi_irq_enable(SPI.dev(), SPI_RXNE_INTERRUPT);
pinMode(33, OUTPUT);
digitalWrite(33, HIGH); // turn the LED on (HIGH is the voltage level)
}
extern "C" {
void __irq_spi1(void);
}
void __irq_spi1(void)
{
digitalWrite(33, LOW); // toggle onboard LED to see if we crash out
short b = spi_rx_reg(SPI.dev()); // read data which shoould flush RXNE
spi_tx_reg(SPI.dev(), b); // echo data back to master
if (pos < sizeof buf) // append to a buffer and GTFO of the interrupt
{
buf [pos++] = b;
process_it = true;
}
digitalWrite(33, HIGH); // turn LED back on, we got this far.. oh my.
}
void loop()
{
delay(1000);
Serial.print("*"); // in case we crash whilst LED is still on :D
if (process_it)
{
buf [pos] = 0;
for( int i=0; i<12 && i<pos; i++ )
{
Serial.print(buf[i], HEX);
}
pos = 0;
process_it = false;
}
}