I recently got myself a little nucleo compatible accessory shield that comes with at I2C Temperature sensor LM75B. After carefully reading the datasheet I felt confident that I could get a working code quick enough. As a first test I decided to try to do a read of the temperature sensor using the pointer. I found some example online that I modified for my needs that look something like that :
volatile uint8_t buffer;
volatile uint16_t rawTemp;
buffer = 0x00; //Pointer to the Temp. Register
HAL_I2C_Master_Transmit(&hi2c1,0x48<<1,buffer,1,100); //Send pointer for Temperature Register
//Buffer : MSB
//Buffer : LSB
printf("Buffer After %d\r\n",buffer);
rawTemp = buffer<<5 | buffer; //combine 2 MSB and LSB in one 10 bit number
I use the cube to generate the basic code for the I2C Bus. I also know that the sensor is working because I ran the provided mbed code as a check to verify that the electric part of the "project" is working. If you could help with the code that would be great. On the other hand what I am interested in is ways that I can use HAL librairies to inspect where and how the code is breaking?
I tried to dig into the code and found various values like TIMEOUT and ERROR. Could I use these to check how my bus is failing?
Thank you in advance.