BL653 Trouble Getting SPI_DT_SPEC_GET

Hello,

I am using SDK v2.9.1 for a Bl653 (NRF52833) and was trying to use the Nordic Academy Example for how to setup the SPI bus. The Nordic Academy example states we must reference a SPI device "node", however, for the BL653 there does not seem to be one in any device tree files. I have tried using the name of the device "spi1" and the nrf52833's node for SPI but both of these result in a compilation error due to device tree linkage issues.

The device tree macro I am using:

struct spi_dt_spec spiSpec = SPI_DT_SPEC_GET(DT_NODELABEL(Some Node Goes Here), SPIOP, 0);

Bl653 Device Tree Overlay:

&spi1 {
	compatible = "nordic,nrf-spim";
	interrupts = <4 2>;
	status = "okay";
	cs-gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
	pinctrl-0 = <&spi1_default>;
	pinctrl-1 = <&spi1_sleep>;
	pinctrl-names = "default", "sleep";
};

Below is the NRF52833's device tree SPI declaration with the required SPI node "st25r3911b."

&spi0 {
	compatible = "nordic,nrf-spi";
	status = "okay";
	cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;

	pinctrl-0 = <&spi0_default_alt>;
	pinctrl-1 = <&spi0_sleep_alt>;
	pinctrl-names = "default", "sleep";
	st25r3911b@0 {
		compatible = "st,st25r3911b";
		reg = <0>;
		spi-max-frequency = <4000000>;
		irq-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
		led-nfca-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
	};
};

What node or alternative code should I be using to get my SPI bus working for the Bl653?

Parents
  • Hello,

    Thank you for sharing the detailed build logs. While checking the logs, I noticed that the issue might be that the SPI device node is missing in the device tree macro. I believe you can configure the SPI device using the macro.

    struct spi_dt_spec spiSpec = SPI_DT_SPEC_GET(DT_NODELABEL(st25r3911b), SPIOP, 0);
    
     

    In your device tree, make sure to add a label, as DT_NODELABEL() works only with a label.

    st25r3911b: st25r3911b@0 {
        compatible = "st,st25r3911b";
        ..
        ...
        
        
    };

    Check this device tree reference section.

    Kind Regards,

    Abhijith

  • Yes, this seems to be the answer!

    I am able to get the project to compile when updating my devicetree overlay. The key factor was adding the label "st25r3911b:" before "st25r3911b@0" as you mentioned. For what I have seen, the examples for the nRF52833 don't have this label. Here is my device tree setup for anyone with the same problem.

    I don't have my equipment to test currently, but will test Monday and verify the answer if this works.

    Abhijith, I had a question that arose from this discussion. The irq-gpios and led-nfca-gpios properties are required to build the project properly, but I was unable to find documentation on what these do. Do you know?

    Thanks for the help so far!

  • Hello,

    LeviRand said:
    I had a question that arose from this discussion. The irq-gpios and led-nfca-gpios properties are required to build the project properly, but I was unable to find documentation on what these do. Do you know?

    This is not part of the standard SPI peripheral; I believe it comes from the NFC reader driver module you're using. Most likely, the driver itself is requesting and using the irq-gpios and led-nfca-gpios.

    Could you let me know which driver you're using? Alternatively, you can check the driver code to see how the GPIOs are being configured or accessed.

    Kind regards,
    Abhijith

Reply
  • Hello,

    LeviRand said:
    I had a question that arose from this discussion. The irq-gpios and led-nfca-gpios properties are required to build the project properly, but I was unable to find documentation on what these do. Do you know?

    This is not part of the standard SPI peripheral; I believe it comes from the NFC reader driver module you're using. Most likely, the driver itself is requesting and using the irq-gpios and led-nfca-gpios.

    Could you let me know which driver you're using? Alternatively, you can check the driver code to see how the GPIOs are being configured or accessed.

    Kind regards,
    Abhijith

Children
No Data
Related