Skip to content

Cross-platform no_std compatible i2c library for 3-axis Hall Effect sensor.

Notifications You must be signed in to change notification settings

dysonltd/tmag5273

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TMAG5273 Rust Driver

Summary

This is a platform agnostic Rust Driver for the TMAG52732 3 Axis I2C Hall effect Sensor by Texas Instruments. The driver is based on the embedded-hal traits. For more information it is recommended to look at the docs using cargo doc

The Device

An extract taken from the Texas Instruments Datasheet:

The TMAG5273 is a low-power linear 3D Hall-effect sensor designed for a wide range of industrial and personal electronics applications. This device integrates three independent Hall-effect sensors in the X, Y, and Z axes. A precision analog signal-chain along with an integrated 12-bit ADC digitizes the measured analog magnetic field values. The I2C interface, while supporting multiple operating VCC ranges, ensures seamless data communication with low-voltage microcontrollers. The device has an integrated temperature sensor available for multiple system functions, such as thermal budget check or temperature compensation calculation for a given magnetic field.The TMAG5273 can be configured through the I2C interface to enable any combination of magnetic axes and temperature measurements. Additionally, the device can be configured to various power options (including wake-up and sleep mode) allowing designers to optimize system power consumption based on their system-level needs. Multiple sensor conversion schemes and I2C read frames help optimize throughput and accuracy. A dedicated INT pin can act as a system interrupt during low power wake-up and sleep mode, and can also be used by a microcontroller to trigger a new sensor conversion.An integrated angle calculation engine (CORDIC) provides full 360° angular position information for both on-axis and off-axis angle measurement topologies. The angle calculation is performed using two user-selected magnetic axes. The device features magnetic gain and offset correction to mitigate the impact of system mechanical error sources.The TMAG5273 is offered in four different factory-programmed I2C addresses. The device also supports additional I2C addresses through the modification of a user-configurable I2C address register. Each orderable part can be configured to select one of two magnetic field ranges that suits the magnet strength and component placement during system calibration.

Examples

Examples on how to use the driver across multiple platforms can be found here

Architecture Diagrams

The rough architecture of the files and directories of the project can be seen in the following plantUML diagram.

System Architecture

As an application developer, you will spend most of your time working with the TMAG5273 struct outlined in lib.rs. The device can initialised by the init_default method and configuration can be done using the methods outlined in config.rs. However for fine grained control of the device you can set and configure the raw registers outlined in the folder registers. More information around the code can be found using cargo doc.

Useful Links