I’m an engineering student and I want to implement a communication between 2 arduino feather M0. The master can send bytes to slave, but this can’t do it. The slave sends only 0. I read the datasheet and I should write the tx-buffer of the slave when the interrupt flag DRE is activated. I can only read the SPI.DATA.reg but not write it. Can you help me please? This is the code of the master and slave.
I removed the serial methods from the interrupt routine. I tested the code again.I want to receive data = 20 from the slave. Instead the master receives only 0 on the MISO. So I think that I can't write the register SERCOM4->SPI.data.reg to update the TX-buffer of the slave, but I don't understand why.
Thank you very much for your help.
I took your advice but the master receives only ‘0’ .
Then I tested the single pins (MOSI->pin 23, MISO->pin 22). Using pinMode and digitalWrite statements, I generate a square wave and whit MOSI it works but with MISO I read only ‘0’. Is there a malfunction on the pin 22-MISO? I will test whit an oscilloscope to better understand.