Inconsistent Chip Select (CS) Assertion in LPSPI on RT1060EVKB #77999
-
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 22 replies
-
What SPI controller driver is this, spi_nxp_32.c ? |
Beta Was this translation helpful? Give feedback.
-
@ofirshe There are some issues going around the LPSPI of RT10xx, and hopefully we see soon a reimplementation of LPSPI driver #69658 (comment) In my projects, I have removed the <&iomuxc_gpio_xxxxxxxx_pcs0> from the pinmux and I instead I am using cs-gpio. Maybe this also helps you with the chip select issue. Additionally, I had problems using const struct spi_buf tx_buf & const struct spi_buf rx_buf (see #69658): |
Beta Was this translation helpful? Give feedback.
-
Hi @ofirshe , To use a GPIO chip select, you can refer to the mimxrt1062_fmurt6 board as a reference. Your SPI node needs a
|
Beta Was this translation helpful? Give feedback.
-
Hey @DerekSnell By the way, I’ve noticed a potential mismatch between the RT1060EVKB schematics and the LPSPI1 pinout declaration in Zephyr. In both the RT1060EVKB and RT1060EVK schematics, the SPI MISO (SDO) pin is connected to GPIO_SD_B0_03, and the SPI MOSI (SDI) is connected to GPIO_SD_B0_02. However, in Zephyr, these appear to be swapped. Specifically, the Zephyr configuration shows |
Beta Was this translation helpful? Give feedback.
-
Hey @DerekSnell, I’ve observed a consistent glitch in the clock signal on the 8th rising edge using a digital analyzer, which causes the corresponding bit to be corrupted. For instance, when sending 0xD0, the last bit of the first byte is transmitted as 1 instead of 0. This glitch is problematic and appears to be deterministic, as it occurs at the same point in the clock cycle for every piece of data I send, leading to corrupted data. Another instance is when I sent { 0xAA, 0xAA }, and again, the glitch in the clock led to data corruption. Is there any way to resolve this issue? |
Beta Was this translation helpful? Give feedback.
-
Hi @ofirshe , That narrow clock pulse is related to the last bit in the SPI transfer, as the chip select is deasserted. These first captures show the signals from the Then I modified the If your peripheral device is struggling with this timing, you can configure the timing of the LPSPI. Below are snippets from the RT1060 Reference Manual which detail the timing parameters. Have you already tried configuring these? Best regards |
Beta Was this translation helpful? Give feedback.
-
Hi @ofirshe , Above in this thread I shared snippets from the Reference Manual about these timing parameters. In Zephyr, these parameters are configured in the devicetree. The LPSPI bindings document these properties. In the attached project, I set
The attached project LPSPI_example.zip was configured for and tested on the MIMXRT1170-EVK board. This is also using the hardware chip select, not the GPIO option, although that should not impact the clock pulse timing. Best regards |
Beta Was this translation helpful? Give feedback.
Hi @ofirshe ,
Yes, NXP is currently improving the LPSPI driver, see #78732