Skip to content

drivers/sensors: add Microchip TC74 temperature sensor driver - #20171

Merged
xiaoxiang781216 merged 1 commit into
apache:masterfrom
daniel-p-carvalho:feat/drivers-tc74
Sep 18, 2026
Merged

xiaoxiang781216 merged 1 commit into
apache:masterfrom
daniel-p-carvalho:feat/drivers-tc74

Conversation

@daniel-p-carvalho

@daniel-p-carvalho daniel-p-carvalho commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add driver for the Microchip TC74 digital temperature sensor using the Sensor Driver Framework (uORB).
  • Registers as a uORB topic (/dev/uorb/sensor_temp<n>) via tc74_register(devno, i2c, addr).
  • Implements background sampling via the low-priority work queue with configurable interval (set_interval).
  • Automatically manages low-power standby mode when activated and deactivated.
  • Documentation added under Documentation/components/drivers/special/sensors/tc74.rst.

Impact

  • New sensor driver only; fully conforms to the modern Sensor Driver Framework. No changes or breakage to existing drivers.

Testing

  • tools/checkpatch.sh -g HEAD clean (all checks pass).
  • Built and validated on real hardware: Pextron R550 (STM32H743BI) connected to a Microchip TC74A5-3.3 on I2C bus 0 (address 0x4D).
  • Verified with official sensortest:
    • 1 Hz default interval:
      nsh> sensortest -n 5 temp0
      SensorTest: Test /dev/uorb/sensor_temp0 with interval(1000000us), latency(0us)
      temp0: timestamp:36070441 value:32.00
      temp0: timestamp:37070468 value:32.00
      temp0: timestamp:38070493 value:32.00
      temp0: timestamp:39070518 value:32.00
      temp0: timestamp:40070544 value:32.00
      SensorTest: Received message: temp0, number:5/5
      
    • Dynamic interval change (5 Hz / 200 ms):
      nsh> sensortest -i 200000 -n 5 temp0
      SensorTest: Test /dev/uorb/sensor_temp0 with interval(200000us), latency(0us)
      temp0: timestamp:48915000 value:32.00
      temp0: timestamp:49115025 value:32.00
      temp0: timestamp:49315049 value:32.00
      temp0: timestamp:49515075 value:32.00
      temp0: timestamp:49715101 value:32.00
      SensorTest: Received message: temp0, number:5/5
      

@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Size: L The size of the change in this PR is large labels Sep 17, 2026
Comment thread drivers/sensors/tc74.c Outdated
@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@acassis

acassis commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

@raiden00pl what is this issue:

image

@linguini1 linguini1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use the sensor driver framework? That is what NuttX is moving to for sensor drivers.

@acassis

acassis commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

@raiden00pl what is this issue:
image

Ok, found apache/nuttx-apps#3790

@daniel-p-carvalho

Copy link
Copy Markdown
Contributor Author

Updated the PR addressing all review feedback:

  • Migrated the driver to the modern Sensor Driver Framework (uORB) as requested by @linguini1. It now publishes as /dev/uorb/sensor_temp<n> via tc74_register().
  • Removed the redundant #if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_TC74) from the .c file as noted by @xiaoxiang781216.
  • Removed legacy fallback code, unnecessary casts and internal register #defines from the public header.
  • Added documentation under Documentation/components/drivers/special/sensors/tc74.rst.
  • Validated on real hardware with an STM32H743BI board and sensortest (default 1 Hz, custom intervals, and automatic standby upon topic deactivation).
  • Squashed into a single clean commit with tools/checkpatch.sh -g HEAD passing.

@linguini1

Copy link
Copy Markdown
Contributor

Please include the 'Assisted-by' field in your commit to indicate AI usage, as per the contribution guide.

Add support for the Microchip TC74 digital temperature sensor using the
Sensor Driver Framework (uORB). The TC74 is an 8-bit I2C temperature
sensor with a measurement range from -40C to +125C and a resolution
of 1C.

The driver registers as a uORB topic (/dev/uorb/sensor_temp<n>) and
polls on the low-priority work queue. It supports dynamic interval
configuration and automatically enters low-power standby mode when
the topic is deactivated.

Validated against a real TC74A5-3.3 on a custom STM32H743BI board.

Assisted-by: Gemini:gemini-3.8-pro
Signed-off-by: Daniel P. Carvalho <danieloak@gmail.com>
@daniel-p-carvalho

Copy link
Copy Markdown
Contributor Author

Added Assisted-by tag to the commit message per contribution guidelines.

@xiaoxiang781216
xiaoxiang781216 merged commit 1b172fb into apache:master Sep 18, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Documentation Improvements or additions to documentation Size: L The size of the change in this PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants