Skip to main content
Visitor II
October 7, 2021
Solved

How to interface with HMC5883L?

  • October 7, 2021
  • 1 reply
  • 2764 views

Hi. I want to use HMC5833L for my project but I couldn't find any library to be used as a reference. Can someone briefly explain what are the steps needed to read data from the sensor? I have a little piece of code below but it doesn't work.

HAL_I2C_Mem_Read(&hi2c1, GY271_ADDR, 0x10, 1, &check, 1, 1000);
if (check == 'H') {
	sprintf(data, "OK\r\n");
	HAL_UART_Transmit(&huart1, (uint8_t *) data, sizeof(data), 100);
	memset(data, '\0', sizeof(data));
}

 The value that I get for check is 8.

    This topic has been closed for replies.
    Best answer by Eleon BORLINI

    Hi @M7890.1​ ,

    please note that the HMC5883L magnetometer is a product from Honeywell, so I suggest you to ask for help on their support page.

    For a C library, I suggest to check this repository on Github.

    Or, if you have the GY-271 product, you might refer to this wiki page.

    Check also the suggested hardware connections.

    -Eleon

    1 reply

    ST Employee
    October 27, 2021

    Hi @M7890.1​ ,

    please note that the HMC5883L magnetometer is a product from Honeywell, so I suggest you to ask for help on their support page.

    For a C library, I suggest to check this repository on Github.

    Or, if you have the GY-271 product, you might refer to this wiki page.

    Check also the suggested hardware connections.

    -Eleon