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:
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.
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.
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.
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