cancel
Showing results for 
Search instead for 
Did you mean: 

How can I read data from BMP 280 bosch sensor with STM32F0 Discovery kit via I2C.

Apill
Senior

I am trying to read data from from BMP 280 bosch sensor but could not able to do , Any expertise on I2C/ Bosch sensor please?

I could able to communicate with my sensor by checking if the device address is right or wrong using function : HAL_I2C_IsDeviceReady(&hi2c1, 0xED,2,10). But I would like to read humidity and temperature from the sensor, I used the following functions but of no use.

HAL_I2C_Master_Transmit(&hi2c1, 0XEC,buffer, 1,100);

and HAL_I2C_Master_Receive( above parameters) ;

didnt get the data in buffer so used memory write and read in i2c but of no use!!

HAL_I2C_Mem_Write(&hi2c1, 0xEC,0XFD, 1, buffer, 1, 100);

Below I have attached the data sheet of Bosch sensor, I am aware to some extent that inorder to receive data of humidity sensor i have to write the register 0XFD and for Temperature has to write data to register 0XFA

Bosch also have drivers for this sensor, Do I need to use these drivers to get the data of temperature ? or HAL's API is sufficient? I am learning ,I do not know how to proceed! I had a glance of files of Bosch drivers, again do not know which functions to be used to get the value of Temperature from driver files of Bosch sensor.

https://github.com/BoschSensortec/BMP280_driver/tree/master/examples

Using STM32F0 discovery kit via I2c,

https://www.amazon.in/amiciSense-BMP280-3-3-BMP280-3-3-Atmospheric/dp/B07BLRXHHD?tag=googinhydr18418-21&tag=googinkenshoo-21&ascsubtag=_k_CjwKCAjwqNnqBRATEiwAkHm2BM_1rUXT-RDvZhY4_g3Qi_4olxOU37A-d4qOlrN9-93zLtqPyctP6xoCXlQQAvD_BwE_k_&gclid=CjwKCAjwqNnqBRATEiwAkHm2BM_1rUXT-RDvZhY4_g3Qi_4olxOU37A-d4qOl...

Any insights are much appreciated.

2 REPLIES 2

Should be able to use the HAL API to do a memory read, and read one or several of the registers back.

Bosch code may help combine registers to use​ful and scaled data.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

uint8_t buffer[1];

HAL_I2C_Mem_Read(&hi2c1, 0xEC, 0xFD, 1, buffer, 1, 100); // Read 1-byte from internal reg 0xFD

uint8_t buffer[8];

HAL_I2C_Mem_Read(&hi2c1, 0xEC, 0x20, 1, buffer, 8, 100); // Read 1-bytes starting from internal reg 0x20 and auto-incrementing

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..