How to configure CS for LPSPI peripheral on NXP MIMXRT106x #69692
Replies: 8 comments
-
I have a bit more data on the SPI clock speed. It turns out the default config from zephyr sets the LPSPI peripheral to run off USB1 PLL PFD0 (which is configured for 251 MHz) divided by 8. Because it was running below 32 MHz it was unable to generate a clock faster than 16 MHz. I modified soc_rt10xx.c in the zephyr to configure PFD1 as 480*18/29 and then divided by 3 to achieve ~100 MHz. This requires modifying settings in an SDK file. Is there a clean way I can override these settings? |
Beta Was this translation helpful? Give feedback.
-
What I ended up doing on RT1064 to test out the SPI with W5500 ethernet module was commenting out <&iomuxc_gpio_sd_b0_01_lpspi1_pcs0>, and then using cs-gpios = <&gpioX X GPIO_ACTIVE_LOW>. In this way I was able to make it work. with W5500. However, this did not work out with LAN865x. Could you send me the modified soc_rt10xx.c? |
Beta Was this translation helpful? Give feedback.
-
I have been able to get the cs-gpios to work with an I/O that wasn't in the pin configuration. I'll try your suggestion of commenting the PCS pin. The way pinctrl and muxing is implemented seems to me a complete mystery. I found "modules/hal/nxp/dts/nxp/nxp_imx/rt/mimxrt1062dvl6b-pinctrl.dtsi but not really sure how it all works beyond there. When I made the cs-gpios for the lpspi1 pcs I referenced the pinctrl to determine it should be either gpio3 io13 or gpio8 io13. I suppose that is explained somewhere in the reference manual.
I put this in my board pinctrl
But maybe I should be doing something like this:
BTW, the changes to soc_rt10xx.c were:
its a shame NXP doesn't provide enumerations for the CLOCK_SetMux register values, I hate having "magic numbers" in the code, or maybe they do and I haven't found them yet! |
Beta Was this translation helpful? Give feedback.
-
Well referencing the iomuxc in the cs-gpios didn't work. I got this error: devicetree error: <Node /soc/iomuxc@401f8000/IOMUXC_GPIO_SD_B0_01_GPIO3_IO13 in 'D:/aaa/radar/zephyr/misc/empty_file.c'> lacks #gpio-cells |
Beta Was this translation helpful? Give feedback.
-
Also so far I haven't been able to get the SPI to operate at full bus speed. I tried the DMA operation, but there are gaps between every byte of the transfer. The Zephyr drivers seem to need some work to drive at the full data rate. |
Beta Was this translation helpful? Give feedback.
-
@mmahadevan108 I noticed you have worked on the driver files. @DerekSnell not sure if you can advise, but you have been helpful on my other questions. :) |
Beta Was this translation helpful? Give feedback.
-
I noticed this comment in the fsl_lpspi_edma.c code:
Wondering if this assumption was true with spi running at 16MHz, but might not be true after boosting the speed to 50 MHz? |
Beta Was this translation helpful? Give feedback.
-
I'm encountering the same issue as I described here #77999. |
Beta Was this translation helpful? Give feedback.
-
zephyr 3.5.0
mimxrt1062 evkb
I soldered resistor to enable the arduino_spi interface.
I added my spi peripheral into the dts:
During testing I find:
I found a zephyr issue indicating the built-in PCS handling is buggy: #16544
Considering the recommended workaround is to use GPIO CS.
Beta Was this translation helpful? Give feedback.
All reactions