This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Retrieving heading data from BNO055 IMU using STM32F401VCTx-Keil uVision 5

Hello all,

I am working on a navigation project that requires reading IMU heading data as an output. I have chosen the STM32F401VCTx chip for my custom board and am interfacing with an Adafruit IMU. Communication is through I2C, which I have some experience with but not a ton. The slave address for the BNO055 on the IMU is 0x28, which when bit shifted is 0x50. I am using the HAL functions provided by uVision for I2C transactions, namely the Mem_Read and Mem_Write functions for peripherals. I have configured the device to operate in "compass mode" and output a heading angle in radians, and store it in the bytes EUL_Heading_MSB and EUL_Heading_LSB. I want to see the heading bytes. 

Code:

uint8_t COMPASS_MODE = 0x09;                                                                            //Compass mode value 1001
uint8_t UNIT_SEL = 0x04;                                                                                         //Radians value 0100
uint8_t EUL_Heading_MSB[1] = {0x00};                                                                   //initialize MSB of output data
uint8_t EUL_Heading_LSB[1] = {0x00};                                                                    //initialize LSB of output data

HAL_I2C_Mem_Write(&hi2c1, 0x50, 0x3D, 1, &COMPASS_MODE , 1, 50);           //Setting OPR_MODE register to 1001 to initialize compass mode
HAL_I2C_Mem_Write(&hi2c1, 0x50, 0x3B, 1, &UNIT_SEL, 1, 50);                         //Setting UNIT_SEL to 0100 for radians

HAL_I2C_Mem_Read(&hi2c1, 0x50, 0x1B, 1, EUL_Heading_MSB, 1, 50);            //Read EUL_Heading_MSB data from 0x1B register
HAL_I2C_Mem_Read(&hi2c1, 0x50, 0x1A, 1, EUL_Heading_LSB, 1, 50);             //Read EUL_Heading_LSB data from 0x1A register

I am not seeing a readable output in uVision. I know to use Watch windows to view output, but I am not sure if it is working correctly. Here is a pic of my watch window:

 

If anyone has worked on a similar project, or knows of a possible solution/alternative please help out if possible. 

Thanks in advance :)

  • I am working on a very similar project. Did you solve the issue?

  • I also work on projects.

    Suggest you start by getting a terminal connection either via USART or SWV, so you can output diagnostic and telemetry data real time.

    I2C permits multiple registers to be read/written at a time, and auto-increments the register counter. Make a routine that dumps all registers.

    Print out the values you receive from your commands, and the status returned by the routines.

    Check the part docs and make sure you have the initial setting correct, and functionality enabled.

    Check if the routines called throw errors, for example if the IC doesn't respond with an ACK when queried.

    For the cut-n-paste crowd, find examples of this part in use, on whatever MPU that might be, and then implement the equivalent for the MPU that you are using. All this stuff is significantly more similar than it is different.