Jetson Nano SPI mode 3 issue


I’m trying to communicate with an IMX264 sensor on a custom board. The problem is that I had to use SPI mode 3 but the CLK signal didn’t stay at high level when not used.


Like we can see on the oscilloscope (nCS in blue and CLK in yellow), the chip select falls and then the clock rises. In SPI mode 3 value are taken on rising edge of the CLK so I want that CLK rises before chip select falls. How can I do this?
It’s a GPIO chip select.

I try to change these parameters without success:

imx264@0 {
    controller-data {
				nvidia,tx-clk-tap-delay = <????>;
				nvidia,cs-setup-clk-count = <????>;
				nvidia,cs-hold-clk-count = <????>;

How these parameters works? Do you have more informations?

I saw many post about this problem but I can’t resolve this. I the last one the solution is to had an inverter and change the mode. It’s not possible on my board.

Thank you.


Edit: I found parameters that partially resolves my problem. The problem is only resolved once, the first SPI transfer.

controller-data {
				nvidia,tx-clk-tap-delay = <16>;
				nvidia,cs-setup-clk-count = <16>;
				nvidia,cs-hold-clk-count = <0>;

1: The IMX264 responds.
2: The IMX264 does not respond.
3: The IMX264 does not respond.

What’s the version?

tegra-l4t-r32.4.2. I just edit my first message

I resolved my issue. I added a sleep before the gpio_set_value in the tegra_spi_setup_transfer_one function.

if (cstate && cstate->cs_gpio_valid) {
			int gval = 0;

			if (spi->mode & SPI_CS_HIGH)
				gval = 1;

			gpio_set_value(spi->cs_gpio, gval);


The SPI ports on the 40-pin header are software emulated and there is a bug in that software that causes the problem you are seeing. It is the exact same problem I saw.

Nvidia support pointed me to a kernel patch to try, but I never did. Instead I used a standard inverter on the clock so I could use one of the SPI modes that didn’t show the bug (any mode where CLK is idle low). As long as the inverter is reasonably fast (most are) then everything works very well.

I used:

If you can’t use the inverter trick I suggest you try that kernel patch. The link is in that thread you found me from.

Sorry I can’t be of more help,



I tried this patch without any success.


March 10


  • | - |


I tried this patch without any success.

Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.