Jetson Nano SPI mode 3 issue

Hello,

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.

TEK00055

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.

Jean

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.
TEK00056
2: The IMX264 does not respond.
TEK00057
3: The IMX264 does not respond.
TEK00058

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;

			usleep_range(2,4);
			gpio_set_value(spi->cs_gpio, gval);
		}

Jean,

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,

–Jesse

Hello,

I tried this patch without any success.





|

jbzp00y
March 10

|

  • | - |

Hello,

I tried this patch without any success.

Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.