Enabling GPIO+SPI mode support for nRF21540 - v2.8.0

This page (v2.8.0) https://docs.nordicsemi.com/bundle/ncs-2.8.0/page/nrf/app_dev/device_guides/fem/fem_nrf21540_gpio_spi.html

Suggests copying the following into devicetree.


&pinctrl {
    spi0_default_alt: spi0_default_alt {
       group1 {
          psels = <NRF_PSEL(SPI_SCK, 1, 15)>,
                  <NRF_PSEL(SPI_MISO, 1, 18)>,
                  <NRF_PSEL(SPI_MOSI, 1, 16)>;
       };
    };
 
    spi0_sleep_alt: spi0_sleep_alt {
       group1 {
          psels = <NRF_PSEL(SPI_SCK, 1, 15)>,
                  <NRF_PSEL(SPI_MISO, 1, 18)>,
                  <NRF_PSEL(SPI_MOSI, 1, 16)>;
          low-power-enable;
       };
    };
 };
 
However, I get this error:
note the following errors:
devicetree error: C:/ncs/v2.8.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52811.dts:138 (column 59): parse error: expected number or parenthesized expression
I can clear this error by changing SPI_CLK to SPIM_CLK etc...
This suggests I have a definition for SPIM_CLK but I am missing SPI_CLK
The prj.conf includes:
CONFIG_MPSL=y
CONFIG_FEM_AL_LIB=y
CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=y

It seems that documentation for enabling FEM is not sufficiently comprehensive or accurate to support success in v2.8.0
Is there an example project with nrf FEM support which is tested?
note the dtsi file (whatever that is or does) for this board includes:
SPIM and that hasn't the error. It would seem that SPI_SCK is not defined without some additional CONFIG perhaps?
Or SPI should be SPIM perhaps?
Thank you
Parents
  • I have changed the target board to nrf52840.

    When I add these sections to device tree, I get these errors:

    when I click /build from the Applications menu, the errors disappear briefly.

    I click pristine build then:

    The errors show in the build.

    I add the semi-colon because that's simple and indicated.

    press pristine build again.

    we get this error, but now no errors are displayed in the dts file.

    -- Found BOARD.dts: C:/ncs/v2.9.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts
    devicetree error: C:/ncs/v2.9.0/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840.dts:292 (column 59): parse error: expected number or parenthesized expression

    I can't make progress towards compiling code that supports the nrf FEM as documented on this page.
    This makes me think that no one is using this part given it is not supported.

  • Thanks for reporting these! I have reported it to our docs team so we will get them fixed!

    In your last image, i see that you still use SPI_ instead of SPIM_. Use SPIM_, I think that should work for you.

    Let me know if SPIM_ does not work

  • I tried SPIM earlier, and again in v2.9.0 same result.

    I get:

    C:/ncs/v2.9.0/nrf/subsys/mpsl/fem/nrf21540_gpio_spi/models/mpsl_fem_nrf21540_power_model_builtin.c:20:2: error: #error Cannot use nRF21540 built-in power model with unspecified supply-voltage-mv property
    20 | #error Cannot use nRF21540 built-in power model with unspecified supply-voltage-mv property

    When I add the property to the FEM node in DTS, I then get a config error in the dts file.

    I was hoping someone would compile the solution in v2.9.0 and provide tested documentation.

    Please consider prioritizing this request given there really is no tested documentation for the nrf21540 (+SPI) in the latest sdk.?

  • I am now able to compile this flag in v 2.9.0 for the 52811 (and 52840)

    However, when I run it on custom hardware (52811 reference hardware with 21540) I get an error within:

    mpsl_fem_nrf21540_gpio_spi_interface_config_set
    the error appears to be:
         reason = mem_manage_fault(esf, 0, recoverable);
        /** Arch specific fatal errors */
        K_ERR_ARCH_START = 16
    really seems like the 
    CONFIG_MPSL_FEM_NRF21540_GPIO_SPI=y
    flag triggers a memory error of some kind - maybe stack size error? I am unsure, and a bit unsure how to debug a mem_manager fault
    with this flag instead:
    CONFIG_MPSL_FEM_NRF21540_GPIO=y
    There is no error, and the program runs (communicates over shell and transmits as expected for radio test.
    Any way we can try to compile and run radio test with FEM+SPI for the 52811 target?
  • BenjaminGatti said:

    I was hoping someone would compile the solution in v2.9.0 and provide tested documentation.

    Please consider prioritizing this request given there really is no tested documentation for the nrf21540 (+SPI) in the latest sdk.?

    We are working on updating the documentation, but it will take some time.

    BenjaminGatti said:
    I am now able to compile this flag in v 2.9.0 for the 52811 (and 52840)

    Good job! What did you do to make it work?

    BenjaminGatti said:
    flag triggers a memory error of some kind - maybe stack size error?

    Some times just increasing stack size CONFIG_MAIN_STACK_SIZE fixes thing like this. Try that.

Reply
  • BenjaminGatti said:

    I was hoping someone would compile the solution in v2.9.0 and provide tested documentation.

    Please consider prioritizing this request given there really is no tested documentation for the nrf21540 (+SPI) in the latest sdk.?

    We are working on updating the documentation, but it will take some time.

    BenjaminGatti said:
    I am now able to compile this flag in v 2.9.0 for the 52811 (and 52840)

    Good job! What did you do to make it work?

    BenjaminGatti said:
    flag triggers a memory error of some kind - maybe stack size error?

    Some times just increasing stack size CONFIG_MAIN_STACK_SIZE fixes thing like this. Try that.

Children
  • I think the problem might be in the first post: the nrf52811 may only have a port 0 and not a port 1. the examples unfortunately for the 52840 do not transpose particularly well to the 52811, as there may also not be a spi3 in the nrf 52811. The example team may benefit from some encouragement to create samples for the small devices first - which will likely transpose without error to the larger chips.

    If the documentation team needs any assistance on this, I can help.

Related