2411208_en-US

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2411208_en-US

2411208_en-US

Using the two LPSPI ports on the FRDM-MCXW71 with Zephyr?

Hello,

We want to use the two LPSPI ports on the FRDM-MCXW71 in a Zephyr application.

However when I check in Zephyr 4.4.0, under

zephyrproject/zephyr/boards/nxp/frdm_mcxw71

I find the following files:

  • frdm_mcxw_71.dts file.
    It only has an entry for &lpspi1. (used in the spi flash demo)
    The entry for &lpspi0 is not present?
  • frdm_mcxw71-pinctrl.dtsi
    Also only an entry for &lpspi1

Is there an example on how to use lpspi0 as well?

Which files outside of the regular zephyr project files (.overlay and prj.conf) need to be modified?

Thanks.

Re: Using the two LPSPI ports on the FRDM-MCXW71 with Zephyr?

I noticed a specific driver in zephyrproject/zephyr/drivers/spi/spi_nxp_lpspi.

Not sure how this can be used for addressing both lpspi ports though.

Re: Using the two LPSPI ports on the FRDM-MCXW71 with Zephyr?

Hello, hope you are doing well.

Both lpspi0 and lpspi1 are already declared at the SoC level in zephyr/dts/arm/nxp/mcx/nxp_mcxw7x_common.dtsi with all required hardware properties (registers, interrupts, clocks, FIFO sizes), but set to status = "disabled" by default. The board file frdm_mcxw71.dts only enables lpspi1 but lpspi0 can be enabled in the same way through your application overlay file.

You can take the existing lpspi1 configuration as reference. The basic overlay would look something like this, which you can then extend with your custom device implementation:

&pinctrl {
    pinmux_lpspi0: pinmux_lpspi0 {
        group0 {
            pinmux = ,
                     ,
                     ,
                     ;
            slew-rate = "fast";
            drive-strength = "low";
        };
    };
};

&lpspi0 {
    status = "okay";
    pinctrl-0 = <&pinmux_lpspi0>;
    pinctrl-names = "default";
};

Best regards,
Sofia.

Re: Using the two LPSPI ports on the FRDM-MCXW71 with Zephyr?

Hi Sofia,

I have created a minimal application with the overlay additions as suggested.

The application compiled, but binding the spi devices still failed.

Only when a label is added in the overlay sections, the binding works.

In overlay:

&lpspi0 {
    ...
    label = "LPSPI_0";
}

&lpspi1 {
    ...
    label = "LPSPI_1";
}

In main.c:

const struct device *lpspi0_dev; 
lpspi0_dev = device_get_binding("LPSPI_0"); 
printk("%p\n,lpspi0_dev);

Doing this for both lpspi0 and lpspi1 seems to work now.


Is it expected to create those labels with each application? 


Thanks,

Geert


タグ(1)
評価なし
バージョン履歴
最終更新日:
1週間前
更新者: