Hello Friends.
I want to receive data from register-serial interface.
I try to do that with module Spi.I want to have clock signal on the SCK pin.
But when I start controller-I do not see anything.Can anyone tell some idea.
My guess is that you have not understood that SPI is an exchange of values between the 'master' and the 'slave' devices.
Also the SPI peripheral in your MCU only generates the SCK signal while it is exchanging values.
Therefore I assume that your MCU is the SPI master so what you need to do is:
- (option but recommended) set the 'slave select' line that goes to the slave device so that it is selected and listening
- write a value to the SPI SSPBUF - this will start the exchange process
- wait until the exchange is complete (check the BF bit in the SSPSTAT register)
- (optional but recommended) read the received value from the slave from SSPBUF
- (required if the first step was done) reset the 'slave select' line to the slave device
[Note that the MCU has an 'SS' pin that is connected to the SPI peripheral. However this is NOT the'slave select' line I'm talking about above as the 'SS' pin is only used when the SPI peripheral is in slave mode. Instead you will need to select a GPIO pin and use that to select the slave device from the master.]
Susan