NXP FlexComm LPSPI Problems - FRDM-MCXN947 #80871
-
I am looking to use the LPSPI modules available on the MCXN947's FlexComms, but I am unable to see any activity from the controllers when I attempt to write to them. I initially desired to use the LPSPI on FC6 in order to use a Mikroe Clickboard on the MikroBus slot. I added entries for this FlexComm module to my existing overlay:
I mainly followed the example in the frdm_mcxn947_mcxn947_cpu0.dtsi overlay, as support for LPSPI was added for this board earlier in this commit. The resulting zephyr.dts shows flexomm6_lpspi as "okay" and I am able to retrieve a node ID with the DEVICE_DT_GET() macro and a spi_dt_spec using SPI_DT_SPEC_GET(). To test writing to this device with the zephyr APIs, I have tried manually creating the spi_dt_spec with the node_id:
This however, results in the following runtime error:
This error is returned at the end of spi_mcux_transfer_next_packet() in the spi_mcux_lpspi.c driver file:
I find it strange that the ...NonBlocking() API is called since I do not have CONFIG_SPI_ASYNC set. Overall, I would like to know if there is anything glaring missing from my overlay device definitions. I have played with the "spi-max-frequency" property by lowering it as well as the spi_config frequency, as I have seen that this caused some troubles in other threads discussing LPSPI. Even at 100 kHz, I am still not seeing successful writes or any activity on the bus. I have tried this with LPSPI1 on FC1 as well, the default lpspi in the overlay, to no avail. Additionally, here are the contents of my application-specific configuration file:
I would like to add that I did learn that clock gating is performed in the board.c, which I have already modified to send the clock to FlexComm6:
What would be the proper way to send this clock without modifying the zephyr source? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Tagging for visibility: @mmahadevan108 I noticed you added the definition of flexcomm1_lpspi1 to the FRDM-MCXN947's base overlay. Were you able to utilize the LPSPI successfully? @danieldegrasse I sent you an email earlier and you suggested moving this discussion to GitHub @DerekSnell I have seen you commenting on related threads where you mentioned that work has been underway on the spi_mcux_plspi driver |
Beta Was this translation helpful? Give feedback.
-
Hi @ECleverito , It would also help if you can capture the SPI bus signals during this transfer, so we can see if 4 SPI signals are wiggling as expected. The spi_loopback test runs and passes on this FRDM-MCXN947 board. You can run that test on the board to compare the differences with your app. Note that for the test to pass, the MOSI and MISO signals must be shorted together externally. Let us know what you find. Best regards |
Beta Was this translation helpful? Give feedback.
-
Hi @ECleverito ,
I run into this sometimes. One option is to add your own
For the Init Priority, you want this early in the startup code before the drivers are initialized, but after the SOC clocks are initialized. I used priority 2 for this.
|
Beta Was this translation helpful? Give feedback.
Hi @DerekSnell
I actually resolved my problem after some more investigation. I forgot to add a frame size spi config option. Thanks for checking on this again.
BR
Erich