I've got an accelerometer connected to a PIC24FJ family controller via SPI. I'm trying the simplest operation--reading an ID register whose contents never change--to confirm that I can make it work. While the problem could be due to one of many things, I'm working with the SPI peripheral for the first time and code generated by MCC.
What I'm wondering is, in an 8-bit transfer, does it generate 8 clocks to send the register request, followed by 8 more clocks to read the reply? Or do I have to get the reply byte separately? I've looked at both the datasheet for the processor as well as the Family datasheet, and neither seems to show this. There are plenty of pictures of waveforms for audio streams, and slave operation but I couldn't find something this simple. There is an illustration of an 8-bit transfer, but no suggestion as to what happens after the first 8 bits go out.
As for the peripheral, you put something to the transmit register, wait for a ready bit, and go pick up your results from the receive register. Since they don't explain what happens, that makes it magic. When I read the source code, I end up in the same place. Stuff the register, pick up results from the other register. I could look up other processors, but I couldn't be confident that the peripheral works the same way.
I haven't put a 'scope on it yet, because it's a BGA chip, and the PIC is a pretty find pitch. It may come to that anyway, but there's a chance someone could help if in fact there's something I don't understand about the transfer process.
. . .
Bonus question: What data do you clock out when you are just trying to read a byte from the chip? In this case, writing all zeroes would be a write request to a register you're not supposed to access. So there's got to be a better answer.