SPI (Master) Example for nRF52840DK running a Arduino badge for Honeywell pressure sensors (Part# SEK001)

I'd like to know of an example(s) for interfacing nRF52840DK board as a Master SPI to an Arduino badge (from Honeywell). I have the badge working with an Arduino Uno (Rev 3), so I know it works.

But to port it to Nordic, what library/interface would work best? I've looked at the SPIM Manager but I'm not sure that is the right direction.

I would need an example that includes the prj.conf, .yaml, *.dts, and *.overlay files as well. 

Thanks in advance for your help.

Parents
  • There are some SPI samples here: https://github.com/sigurdnev/ncs-playground/tree/master/samples

    Take a look at the sample <ncs location>/zephyr/tests/drivers/spi/spi_loopback as well, I provided more information about that in this thread: https://devzone.nordicsemi.com/support-private/support/280379 

    Best regards,

    Simon

  • Hey Simon, thanks for the reply. I reviewed the samples you sent. I felt this one might be closest for what I need:

    https://github.com/sigurdnev/ncs-playground/tree/master/samples/spi_test

    But unfortunately, I'm having no success getting it configured and built. First, I'm switch to my nRF9160DK board to code the SPI master sample. So I used my Segger IDE to build a "blinky" sample for the nRF9160DK. It builds and works just fine. So I then copied these files into the folder, but I'm getting (at least) the following errors when CMake runs:

    C:/dev/NordicSDK/v1.7.1/zephyr/samples/basic/blinky/prj.conf:12: warning: attempt to assign the value 'y' to the undefined symbol SPI_1

    C:/dev/NordicSDK/v1.7.1/zephyr/samples/basic/blinky/prj.conf:14: warning: attempt to assign the value 'y' to the undefined symbol DEPRECATED_ZEPHYR_INT_TYPES

    error: Aborting due to Kconfig warnings

    Can you please provide some steps on how I can use these sample files when you have a moment. Thanks in advance!

  • Could you remove CONFIG_SPI=1 and CONFIG_DEPRECATED_ZEPHYR_INT_TYPES from the prj.conf file? I tested it on my end, and after doing that I was able to build and run the sample.


    Explanations:

    The configs CONFIG_SPI_<instance nuber> is not supported in NCS v.1.7.1, instead it will get the spi instance from the device tree. For example in your case it will look in the overlay file and see that the status of spi1 is "okay". Regarding CONFIG_DEPRECATED_ZEPHYR_INT_TYPES, that config was removed here: https://github.com/nrfconnect/sdk-zephyr/commit/19e5a9c0616df6e89280e42b20a0ebf03dec9200 

    Sorry but I forgot to mention that the sample from sigurdnev's repository might be outdated. The last change was made 10 months ago and he was using an older NCS version than v.1.7.1 (which you're using). By using samples from NCS (e.g. ncs/nrf/samples, ncs/nrf/tests, ncs/zephyr/samples or ncs/zephyr/tests) you will not face these kinds of issues.

    Best regards,

    Simon

  • Thanks for the reply and the explanation. Removing those 2 entries did fix the CMake error. But I guess I still have an issue on how I tried to integrate these files into my "blinky" project. If it matters I am using toolchain v1.7.1 and the latest nRFConnect (v3.9.1).

    But after running CMake and trying to compile the entire (Segger) project, I get this error:

    zephyr/include/generated/devicetree_unfixed.h:5467:37:error: 'DT_N_S_soc_S_peripheral_40000000_S_spi_b000_P_cs_gpios_IDX_0_VAL_pin' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_peripheral_40000000_S_spi_b000_IRQ_IDX_0_VAL_irq'?

    All I did was drag-n-drop the files into the blinky folder without any changes, other than your suggest change to prj.conf. Sorry for the "newbie" questions. So please bear with me, this is the first Segger/Zephyr project for our company.

  • Did you remember to copy over the overlay file nrf52840dk_nrf52840.overlay (assuming you're building with the board nrf52840dk_nrf52840)?

    If you don't get it to work, could you zip your "blinky" project and upload it here, so I can try to reproduce it on my end? Just delete the build folder, to reduce the size to the minimum.

    Best regards,

    Simon

Reply Children
Related