SPI Question

Hi,

I'm having some trouble understanding the SPI protocol and I would appreciate if someone could clarify for me. So the SPI protocol requires a clock, a MOSI, a MISO and a slave select pin. I understand how MOSI, MISO and slave select works but I'm having some trouble with the clock.

The master pin sets the clock and in most devices, data is transmitted on a clock edge. Some devices require a certain number of clock edges to fully 'shift' out the data. My question is how do I control the clock pulses? How do I determine the number of clock pulses? Do I manually pick a clock pin and write a digital high or low signal to it? Or does the arduino 'pulse' the clock automatically?

If the arduino pulses automatically, which pin do I use to access the internal clock and can it be modified?

Thanks in advance.

look into Wire library setClock method

Do I manually pick a clock pin and write a digital high or low signal to it? Or does the arduino ‘pulse’ the clock automatically?

Short Answer: When we write data into SPDR Register by executing the instruction SPDR = 0x23, the 8 clock pulses (required to shift data) are automatically generated by the SPI hardware of the MCU.

I appreciate your curiosity that can only be fully satisfied by performing rigorous experiments. The attached Experiment Sheets may be helpful for you.