Hi everyone,
I'm trying to implement Arduino UNO as SPI master to send data to DSP microcontroller. I display the result on the terminal and quite frequently the response from DSP is not correct in the first tries.
The idea is to send consecutively 0x889 to slave and the slave respond 0x888. Arduino must send data until it gets right response.
It seems also that in the DSP side, the data sent from master is not always correct.
May I know what happened inside the SPI transmission ?
Thank you so much !
Which signals have you connected between your UNO and your DSP?
markd833:
Which signals have you connected between your UNO and your DSP?
I use SCK, MOSI and MISO. I programme with SS but didn't connect it as I have only 3 pins in DSP.
I assume that you also have a GND connection between the 2 devices?
Are you sure that your DSP does not have an SS input?
Even with only 1 device on the SPI bus, the SS signal still plays an important part in the communications. Without the SS signal, it is possible for the master and slave devices to get out of sync with each other. Using the SS signal effectively resets the slave SPI receiver at the start of each message.
markd833:
I assume that you also have a GND connection between the 2 devices?
Are you sure that your DSP does not have an SS input?
Even with only 1 device on the SPI bus, the SS signal still plays an important part in the communications. Without the SS signal, it is possible for the master and slave devices to get out of sync with each other. Using the SS signal effectively resets the slave SPI receiver at the start of each message.
Sorry for belated response. Actually I had fixed this problem. The code was correct but if I move it into a function and call it in main(), it gives this problem. Somehow, if I run the code directly in main(), that works !
I don't know exactly why but yes, maybe it loses the sync control when SS isn't used. But anw it works right now !