ndcube
Posts: 3
Joined: Fri Nov 30, 2018 12:29 am

Controlling SPI Clock

Fri Nov 30, 2018 12:34 am

Is there a way with wiringPi or otherwise to control the SPI clock after using wiringPISpiSetup?

For example I have a requirement to hold the clock low for a number of cycles in order to reset the interface on a chip.

User avatar
joan
Posts: 13912
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Controlling SPI Clock

Fri Nov 30, 2018 1:57 pm

The SPI peripheral hardware on the Pi controls the clock timing. I suppose you could take the SCLK GPIO out of SPI mode temporarily, do what you need, and then return the GPIO to SPI mode.

ndcube
Posts: 3
Joined: Fri Nov 30, 2018 12:29 am

Re: Controlling SPI Clock

Tue Dec 04, 2018 8:02 pm

Thank you. Are there any API calls that can do that? After setting the pin in GPIO mode the only way I have found to get it back to SPI is to unload and load the spi kernel module.

ndcube
Posts: 3
Joined: Fri Nov 30, 2018 12:29 am

Re: Controlling SPI Clock

Tue Dec 04, 2018 8:02 pm

Thank you. Are there any API calls that can do that? After setting the pin in GPIO mode the only way I have found to get it back to SPI is to unload and load the spi kernel module.

User avatar
joan
Posts: 13912
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Controlling SPI Clock

Tue Dec 04, 2018 11:43 pm

I am fairly sure that wiringPi has calls to set GPIO mode.

Return to “Interfacing (DSI, CSI, I2C, etc.)”