Issue creating and using binding files for SPI

Hi all, will need to post short as I am getting a "cannot create ticket" error.

Hi all,

I'm quite new to nrf, zephyr and embedded of this complexity but have completed the fundamentals and intermediate courses.

My intention is to get SPI set up for a TI ADS1298 chip connected to my nrf52DK/52832 board. The only way I know to do this is via bindings and as shown in the lessons and if there is a better way for a custom device with this SPI device connected and an SPI SD card (backup for later BLE comms), please let me know..

I am trying to create a new binding file for the ADS1298 so I can get communication in a similar way to the intermediate course SPI module.

I am working on SDK v2.8.0 in VSCode.

I have created a new blank project and tried to create my own binding file, keeping it simple. Basic file structure within the project is as follows:

my_app
|___ build |___ src |___ prj.conf |___ CMakeLists.txt |___ dts |___ bindings |___ sensor
|___ ti,ads1298.yaml

I have not edited the CMakeLists.txt file.
  • Another alternative is using SPIM TASKS_SUSPEND and TASKS_RESUME coupled via PPI to a timer to provide the required delay which then allows a much higher clock speed. I never got around to trying that.

  • Hi Hieu,

    That is correct there were errant spaces, I'll bear in mind those are an  issue, probably there from me commenting out sections when retying.

    Removing those spaces provided a different error:

    I can see I have replaced reg with an int instead of an array in the binding.

    Building ads1298test1
    C:\WINDOWS\system32\cmd.exe /d /s /c "west build --build-dir d:/_HONS/nRF_Projects/ads1298test1/build_2 d:/_HONS/nRF_Projects/ads1298test1 --pristine --board nrf52dk/nrf52832 -- -DNCS_TOOLCHAIN_VERSION=NONE"
    
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: C:/ncs/toolchains/b620d30767/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.8.0/zephyr/.cache
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf52dk, qualifiers: nrf52832
    Parsing C:/ncs/v2.8.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration 'D:/_HONS/nRF_Projects/ads1298test1/build_2/_sysbuild/empty.conf'
    Merged configuration 'D:/_HONS/nRF_Projects/ads1298test1/build_2/_sysbuild/empty.conf'
    Configuration saved to 'D:/_HONS/nRF_Projects/ads1298test1/build_2/zephyr/.config'
    Kconfig header saved to 'D:/_HONS/nRF_Projects/ads1298test1/build_2/_sysbuild/autoconf.h'
    --
    **********************************
    * Running CMake for ads1298test1 *
    **********************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: D:/_HONS/nRF_Projects/ads1298test1
    -- CMake version: 3.21.0
    -- Found Python3: C:/ncs/toolchains/b620d30767/opt/bin/python.exe (found suitable version "3.12.4", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.8.0/zephyr/.cache
    -- Zephyr version: 3.7.99 (C:/ncs/v2.8.0/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf52dk, qualifiers: nrf52832
    -- Found host-tools: zephyr 0.17.0 (C:/ncs/toolchains/b620d30767/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.17.0 (C:/ncs/toolchains/b620d30767/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/b620d30767/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/ncs/v2.8.0/zephyr/boards/nordic/nrf52dk/nrf52dk_nrf52832.dts
    -- Found devicetree overlay: D:/_HONS/nRF_Projects/ads1298test1/nrf52dk_nrf52832.overlay
    devicetree error: D:/_HONS/nRF_Projects/ads1298test1/dts/bindings\sensor\ti,ads1298.yaml (in 'reg'): 'type' from included file overwritten ('array' replaced with 'int')
    CMake Error at C:/ncs/v2.8.0/zephyr/cmake/modules/dts.cmake:295 (execute_process):
    execute_process failed command indexes:
    
    1: "Child return code: 1"
    
    Call Stack (most recent call first):
    C:/ncs/v2.8.0/zephyr/cmake/modules/zephyr_default.cmake:133 (include)
    C:/ncs/v2.8.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    C:/ncs/v2.8.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
    CMakeLists.txt:2 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    CMake Error at cmake/modules/sysbuild_extensions.cmake:514 (message):
    CMake configure failed for Zephyr project: ads1298test1
    
    Location: D:/_HONS/nRF_Projects/ads1298test1
    Call Stack (most recent call first):
    cmake/modules/sysbuild_images.cmake:20 (ExternalZephyrProject_Cmake)
    cmake/modules/sysbuild_default.cmake:20 (include)
    C:/ncs/v2.8.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
    C:/ncs/v2.8.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
    C:/ncs/v2.8.0/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
    template/CMakeLists.txt:10 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    See also "D:/_HONS/nRF_Projects/ads1298test1/build_2/CMakeFiles/CMakeOutput.log".
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\b620d30767\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/b620d30767/opt/bin/python.exe '-Bd:\_HONS\nRF_Projects\ads1298test1\build_2' -GNinja -DBOARD=nrf52dk/nrf52832 -DNCS_TOOLCHAIN_VERSION=NONE '-SC:\ncs\v2.8.0\zephyr\share\sysbuild' '-DAPP_DIR:PATH=d:\_HONS\nRF_Projects\ads1298test1'
    
    * The terminal process terminated with exit code: 1.
    * Terminal will be reused by tasks, press any key to close it.

  • Changing reg type from int to array then brought an error for spi-max-frequency:

    devicetree error: D:/_HONS/nRF_Projects/ads1298test1/dts/bindings\sensor\ti,ads1298.yaml (in 'spi-max-frequency'): 'required' from included file overwritten ('True' replaced with 'False')

    It seems I am missing some knowledge on editing binding files as even this change is throwing an error?

  • That is certainly a good idea suspending the task. Hopefully I will have time to try that and let you know. running at a higher clock speed would be nice to reduce power.

  • The error says that there is a conflict of the spi-max-frequency > required key between your file and a file it includes.

    As spi-device.yaml is the only file you have included, we only need to check there.

    Notice how in spi-device.yaml, the spi-max-frequency > required key is true, but in your file, it is false. This conflict is not allowed.

    This is not allowed. You will need to set spi-max-frequency > required to true 

Related