Page 1 of 1

SPI clock signal always active

Posted: Fri Oct 11, 2024 2:39 pm
by jtrose7
I am using an ESP32-C3 in order to configure and read data from a microcamera. This microcamera needs to be provided with a continuous clock signal in the range of 10 to 75 MHz. Using the clock signal from the SPI peripheral would be a good solution. The problem is that the clock signal (as expected per protocol) is only active when a transaction is transmitted. I'd like to know if there is a way to keep active the clock signal, and still be able to provide configuration data and read pixel data when I think it is necessary.
I am of course open to other alternatives than SPI, but I just thought it is the most appropriate protocol. Thanks.

Re: SPI clock signal always active

Posted: Sat Oct 12, 2024 3:16 am
by ESP_Sprite
If it doesn't need to be synced with anything, I'd use the LEDC to generate that clock.

Re: SPI clock signal always active

Posted: Sat Oct 12, 2024 4:09 pm
by jtrose7
No, the clock needs to be synchronized when sending the configuration data to the microcamera. Which options do I have then?

Re: SPI clock signal always active

Posted: Sun Oct 13, 2024 1:40 am
by ESP_Sprite
Do you have a datasheet or something that details the protocol you're trying to speak a bit more? Having SCLK pulsing continuously indeed is not something the SPI peripheral supports by itself, but there may be a workaround.

Re: SPI clock signal always active

Posted: Thu Oct 17, 2024 9:48 am
by jtrose7
Yes, I attach it. We are using the cameras in SEIM mode. This means that there are two phases: The DATA+ line
carries the data from the ESP32 to the µcamera while DATA- line transmits the clock; reading phase, the ESP32 provides the clock signal in DATA- and the camera pixel information in the DATA+.
Thanks for the help.

Re: SPI clock signal always active

Posted: Fri Oct 18, 2024 2:43 am
by ESP_Sprite
Given the fact that there's no CS line involved, I2S may be the best option to do what you want: it sends out a continuous bitclock and you can receive and transmit 1-bit data. The only thing that may be problematic is configuration as I2S signals traditionally have a fair bit of buffering on them and you'd need to do rx <-> tx switching manually, however if you only configure the sensor e.g. on startup this should not be an issue.