Skip to content

Conversation

@ericslchiang
Copy link

@ericslchiang ericslchiang commented Nov 12, 2025

MMC5983MA Magnetometer Driver. A working driver for the magnetometer driver with additional calibration functions.

Functionality:

  • Register control
  • Read XYZ magnetometer data in either 16 bit (0.25mG/LSB) or 18 bit (0.0625mG/LSB) precision.
  • Print out magnetometer values to UART in a formatted string which allows external software MotionCal to calculate hard&soft iron distortions and calibration values accordingly.
  • Calibrate measured data
  • Read sensor die temperature
  • Software Reset

TODO:

  • Incorporate gauss to degree calculations
  • Tilt compensation via sensor fusion with accelerometer

Inquiries:

  • Current HAL library is hardcoded to STM32G0 chip. Maybe we should set up an environment file to automatically change the HAL library being used?
  • @Awesome-Ace22 I changed the definition of the vector_t variable in sensor_def.h because the old version didn't really make sense. Let me know if you have a newer definition and I can change it again.
  • What exact file structure do we want for these branches?
  • I guess since we aren't merging branches into main you guys can just approve this PR when you think the code is up to snuff. Then we'll just never merge it lol.


// Set CS Pin Low
status = HAL_SPI_GetState(&hspi1);
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_12);

Choose a reason for hiding this comment

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

Fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants