02-16-2021 09:57 AM - edited 02-16-2021 11:29 AM
Hi all,
as part of my masters thesis I need to connect the Bosch Bmx160 Shuttle board to an Infineon Aurix Triboard MC so I can read accel and gyro data. However, I have a few questions about the initialization of the sensor.
1. The first question is if i have to set the sensor Id to "0" or to "BMI160_CHIP_ID" ( which is 0xD8 in my case)?
2. What do I have to write in the Read and Write Function? Do I have to write the two functions myself or is this the interface with my MC that I just have to put in? If I have to write the function myself, what does it look like?
Please sorry if the questions sound too stupid, but I am quite new with the programming language as well as with sensors and MCs. I am just trying to understand how all this works.🙈
Thank you and best regards
"int8_t user_spi_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len);"
"int8_t user_spi_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len);"
sensor.id = 0;
sensor.interface = BMI160_SPI_INTF;
sensor.read = user_spi_read;
sensor.write = user_spi_write;
sensor.delay_ms = user_delay_ms;
02-16-2021 09:36 PM
Hello st105883,
First of all, my comment is based on our official code.
https://github.com/BoschSensortec/BMI160_driver
1. The first question is if i have to set the sensor Id to "0" or to "BMI160_CHIP_ID" ( which is 0xD8 in my case)?
- If you are using SPI and only one slave, it is okay to put 0 value, but I'd like to recommend to put the GPIO value for BMX160 chip select pin in Infineon device.
2. What do I have to write in the Read and Write Function? Do I have to write the two functions myself or is this the interface with my MC that I just have to put in? If I have to write the function myself, what does it look like?
Simply say, you have to write your own SPI write or read function in bmi160_read_spi and bmi160_write_spi for communication between MCU and BMX160. I attached an example code.
Thanks,