Hello!
I'm facing a weird problem when reading data from a device.
Here is the environment:
CPU: MSP430F5659
Device : BiSS master (iC-MB4)
Dev environment: IAR (although I'm quite sure it doesn't matter).
1. What happens:
- I have configured the SPI device (UCB0) with polarity 0 (idle low) and phase = 1.
Although the maker says that the phase should be 0, I guess it very much depends
on what one calls phase = 0. I found out that the only case where the device responds
is when phase = 1 (i.e. MSP430's CKPH is 1).
- I verified that the timing is absolutely right on the oscilloscope. My scope
as a bus analyzer, and when set properly it can perfectly decode the data. I can
write data in user registers and read them back, the timing is right,
- Problem: MSP430 reads a result shifted by 1 bit to the right.
2. What I have tried:
- I have first tried all the other combinations of CKPH and CKPL, but there is only
one working (at least on the scope). All the other combinations return 0.
- Read the next byte. I thought that the next byte would possibly contain the last
bit of what I'm reading. Exxample: the value I am supposed to read is 0x03, but
when I read, it's shifted, and I get 0x01. So I thought that maybe the next byte
would be 0x80, in which case I could have a workaround, read one byte more than
needed, and then fix all the bytes I have read by shitfing left and adding but 7
of the next one. But it doesn't work.
3. What I finally did:
I made a GPIO implementation of the SPI bus (bit banging). And this works perfectly,
but I cannot use DMA for transfers, so I would really appreciate any hint to get out
of this problem cleanly.
Thanks for any hint!
Pascal