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

Asset Tracker - disable light and env sensors

Using: Windows 10, nRF Connect v3.5.0, nrf v1.3.0, zephyr v2.3.0

I have a board based on the Thingy91 and the Asset Tracker application. I verified serial console output and that my LEDs work.

1. In the asset tracker folder, there is prj.conf and prj_thingy91_nrf9160ns.conf.  Does SES read and parse both of these?  If so, how does it know to load the second one?  Or does it automatically pull in all .conf files in the project folder?  Or are you supposed to overwrite prj.conf with it?

2. How do I disable the light sensor and environmental sensors?  If I grep for CONFIG_LIGHT_SENSOR in the asset tracker folder, I see conditionals for it, but not the actual define anywhere:

CMakeLists.txt:43:add_subdirectory_ifdef(CONFIG_LIGHT_SENSOR src/light_sensor)
src/cloud_codec/cloud_codec.c:415:#if CONFIG_LIGHT_SENSOR
src/cloud_codec/cloud_codec.c:461:#endif /* CONFIG_LIGHT_SENSOR */
src/cloud_codec/cloud_codec.h:276:#if CONFIG_LIGHT_SENSOR
src/cloud_codec/cloud_codec.h:279:#endif /* CONFIG_LIGHT_SENSOR */
src/light_sensor/light_sensor.c:37:static char *ls_dev_name = CONFIG_LIGHT_SENSOR_DEV_NAME;
src/light_sensor/light_sensor.c:47:static u32_t data_send_interval_s = CONFIG_LIGHT_SENSOR_DATA_SEND_INTERVAL;
src/light_sensor/light_sensor.c:61:     if (!IS_ENABLED(CONFIG_LIGHT_SENSOR)) {
src/main.c:188:#if CONFIG_LIGHT_SENSOR
src/main.c:190:#endif /* CONFIG_LIGHT_SENSOR */
src/main.c:898:#if defined(CONFIG_LIGHT_SENSOR)
src/main.c:1007:#if IS_ENABLED(CONFIG_LIGHT_SENSOR)
src/main.c:1161:#if defined(CONFIG_LIGHT_SENSOR)
src/main.c:1203:#endif /* CONFIG_LIGHT_SENSOR */
src/main.c:1638:#if CONFIG_LIGHT_SENSOR
src/main.c:1644:#endif /* CONFIG_LIGHT_SENSOR */

It doesn't show up in the boards/arm/thingy91_nrf9160/ folder either.  What am I missing?

3. I also need to swap out the ADXL362 and ADXL372 for an LIS2DW12.  I see that zephyr drivers exist for it, which is great, but is there a guide on how to add it and which parameters need to be listed in thingy91_nrf9160_common.dts (or elsewhere)?

Parents
  • Hi Pete,

    in reply to 1.  When using SES, the prj_thingy91_nrf9160ns.conf will be used since you specified the thingy91_nrf9160ns in Board Name (see below)

  • I added "#define DT_DRV_COMPAT stm_lis2dw12" at the top of the lis2dw12.c file.  The build gets further, but now I get sensor_sim errors:

    SES sensor_sim build errors

    The sensor_sim stuff should be off, since a real sensor is defined.  In the build folder, if I grep for "sensor_sim", I eventually see this:

    ./zephyr/.config:94:CONFIG_TEMP_DEV_NAME="SENSOR_SIM"
    ./zephyr/.config:462:CONFIG_SENSOR_SIM=y

    I added "CONFIG_SENSOR_SIM=n" to the prj.conf, but that didn't help.

    Any ideas?

  • Try setting these

    CONFIG_ACCEL_USE_SIM=n
    ACCEL_USE_EXTERNAL=y

    in the prj.conf folder for your particular board. You also have to configure the LIS2DW12 senor correctly in prj.conf (or prj_<board_name>.conf), as well as in the overlay/DTS file.

    For the thingy:91, the DTS specific stuff ADXL sensors are set in the board folder (nrf\boards\arm\thingy91_nrf9160\thingy91_nrf9160_common.dts), but you can add it in an overlay file as well.

    I think the API in \nrf\applications\asset_tracker\src\motion\motion.c should work fine for the LIS2DW12 sensor as well, just make sure to set the device name CONFIG_ACCEL_DEV_NAME according to your sensor label in the dts/overlay file.

    If you have more questions regarding this, please ask and I will try to guide you.

    Best regards,

    Simon

Reply
  • Try setting these

    CONFIG_ACCEL_USE_SIM=n
    ACCEL_USE_EXTERNAL=y

    in the prj.conf folder for your particular board. You also have to configure the LIS2DW12 senor correctly in prj.conf (or prj_<board_name>.conf), as well as in the overlay/DTS file.

    For the thingy:91, the DTS specific stuff ADXL sensors are set in the board folder (nrf\boards\arm\thingy91_nrf9160\thingy91_nrf9160_common.dts), but you can add it in an overlay file as well.

    I think the API in \nrf\applications\asset_tracker\src\motion\motion.c should work fine for the LIS2DW12 sensor as well, just make sure to set the device name CONFIG_ACCEL_DEV_NAME according to your sensor label in the dts/overlay file.

    If you have more questions regarding this, please ask and I will try to guide you.

    Best regards,

    Simon

Children
Related