This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Running DHT11 sensor on nRF9160

I am trying to run DHT sensor on the nrf9160 using the sample provided by zephyr (can be found under zephyr>samples>sensor>dht). The code was meant to run on nrf52. Is there any documentation for running on nrf9160.

  • Hi,

     

    The samples in zephyr/samples is not guaranteed to run on all devices, as these are not tested on all combinations of devices.

    Have you tried running it on the nRF9160, either with board nrf9160_pca10090 or nrf9160_pca10090ns?

     

    Kind regards,

    Håkon

  • Yes, It doesn't build with secure or ns. It goes into a loop.

    -- west build: build configuration:
           source directory: /home/ahmed/v1.2.0/zephyr/samples/sensor/dht
           build directory: /home/ahmed/v1.2.0/zephyr/samples/sensor/dht/build (created)
           BOARD: nrf9160_pca10090ns (origin: command line)
    -- west build: generating a build system
    -- Zephyr version: 2.1.99
    -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.7.5", minimum required is "3.6") 
    -- Selected BOARD nrf9160_pca10090ns
    -- Found west: /home/ahmed/.local/bin/west (found suitable version "0.7.2", minimum required is "0.6.0")
    -- Loading /home/ahmed/v1.2.0/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090ns.dts as base
    Devicetree configuration written to /home/ahmed/v1.2.0/zephyr/samples/sensor/dht/build/zephyr/include/generated/devicetree.conf
    Parsing /home/ahmed/v1.2.0/zephyr/Kconfig
    /home/ahmed/v1.2.0/nrf/lib/fprotect/Kconfig:20: WARNING: dt_int_val is deprecated.
    /home/ahmed/v1.2.0/bootloader/mcuboot/zephyr/Kconfig:37: WARNING: dt_int_val is deprecated.
    Loaded configuration '/home/ahmed/v1.2.0/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090ns_defconfig'
    Merged configuration '/home/ahmed/v1.2.0/zephyr/samples/sensor/dht/prj.conf'
    Configuration saved to '/home/ahmed/v1.2.0/zephyr/samples/sensor/dht/build/zephyr/.config'
    -- The C compiler identification is GNU 7.3.1
    -- The CXX compiler identification is GNU 7.3.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /opt/gnuarmemb/bin/arm-none-eabi-gcc
    -- Cache files will be written to: /home/ahmed/.cache/zephyr
    CMake Error at ../../../cmake/app/boilerplate.cmake:66 (add_custom_target):
      add_custom_target cannot create target "code_data_relocation_target"
      because another target with the same name already exists.  The existing
      target is a custom target created in source directory
      "/home/ahmed/v1.2.0/zephyr/samples/sensor/dht".  See documentation for
      policy CMP0002 for more details.
    Call Stack (most recent call first):
      ../../../drivers/sensor/dht/CMakeLists.txt:8 (include)
    
    
    -- Zephyr version: 2.1.99
    CMake Error at ../../../cmake/app/boilerplate.cmake:111 (add_custom_target):
      add_custom_target cannot create target "pristine" because another target
      with the same name already exists.  The existing target is a custom target
      created in source directory "/home/ahmed/v1.2.0/zephyr/samples/sensor/dht".
      See documentation for policy CMP0002 for more details.
    Call Stack (most recent call first):
      ../../../drivers/sensor/dht/CMakeLists.txt:8 (include)
    
    
    -- Selected BOARD nrf9160_pca10090ns
    -- Found west: /home/ahmed/.local/bin/west (found suitable version "0.7.2", minimum required is "0.6.0")
    -- Loading /home/ahmed/v1.2.0/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090ns.dts as base
    Devicetree configuration written to /home/ahmed/v1.2.0/zephyr/samples/sensor/dht/build/zephyr/drivers/sensor/dht/zephyr/include/generated/devicetree.conf
    CMake Error at ../../../cmake/kconfig.cmake:80 (add_custom_target):
      add_custom_target cannot create target "menuconfig" because another target
      with the same name already exists.  The existing target is a custom target
      created in source directory "/home/ahmed/v1.2.0/zephyr/samples/sensor/dht".
      See documentation for policy CMP0002 for more details.
    Call Stack (most recent call first):
      ../../../cmake/app/boilerplate.cmake:461 (include)
      ../../../drivers/sensor/dht/CMakeLists.txt:8 (include)
    
    
    CMake Error at ../../../cmake/kconfig.cmake:80 (add_custom_target):
      add_custom_target cannot create target "guiconfig" because another target
      with the same name already exists.  The existing target is a custom target
      created in source directory "/home/ahmed/v1.2.0/zephyr/samples/sensor/dht".
      See documentation for policy CMP0002 for more details.
    Call Stack (most recent call first):
      ../../../cmake/app/boilerplate.cmake:461 (include)
      ../../../drivers/sensor/dht/CMakeLists.txt:8 (include)
    
    
    CMake Error at ../../../cmake/kconfig.cmake:80 (add_custom_target):
      add_custom_target cannot create target "hardenconfig" because another
      target with the same name already exists.  The existing target is a custom
      target created in source directory
      "/home/ahmed/v1.2.0/zephyr/samples/sensor/dht".  See documentation for
      policy CMP0002 for more details.
    Call Stack (most recent call first):
      ../../../cmake/app/boilerplate.cmake:461 (include)
      ../../../drivers/sensor/dht/CMakeLists.txt:8 (include)
    
    

  • Try deleting your build folder first.

    You'll get a compilation error, as it cannot find the device tree for the dht:

    ../src/main.c:35:28: error: 'DT_INST_0_AOSONG_DHT_LABEL' undeclared (first use in this function)

    In that case, copy samples/sensor/dht/boards/nrf52_pca10040.overlay to samples/sensor/dht/nrf9160_pca10090ns.overlay (provided that this is the board you're running) and reconfigure the project.

    Cheers,

    Håkon

Related