So, I've been toying with an MSP-EXP4305529 board, and was trying to get the SPI to work.
I have taken the MSPware SPI slave example and modified it so that:
- It used the SPI pins available on the board.
- Its response was the received byte + 1
I've found that, looking through the debugger and looking at the sent/received data from an SPI unit, that I could either have the master understand the board, the board understand the master, but not both. If one got valid input, the other was getting nonsense. Turns out, the slave end was shifting/rotating its output by arbitrary amounts, where the previous input would bump into the next input; any extra would then bump into
I found the last post in this thread, where we emulate the effects of a chip select pin:
http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/19004.aspx
And this has mostly resolved the issue, with one exception: The least significant bit of the previous outgoing slave message is now the most significant bit of the following slave message. The LSB of the later message is then bumped into the MSB of the message after it, and so on.
Pastebin of the main.c contents:
Polarity/phase mismatches can be ruled out as the cause, because the bytes are obviously coming from the master to the slave properly when viewed in debug. It's just that the incremented response is coming back with the bits right-rotated. Fault with the master can be reasonably eliminated, because it has successfully communicated to a PIC32 and a Cortex M3 before this. So, what's going on?
Thanks for any help
Francis