06-08-2020 06:23 AM
I tried to use STM32 MCU to use SPI to communicate with BMX160, but I can't get CHIPID, I already use github bmi.h and bmi.c files, please tell me which part is missing to read CHIPID normally
06-08-2020 07:40 AM
Suggest to check if there was SPI communication on SPI bus by logic analyzer tool or oscilloscope. If no, it needs to check whether SPI read calling function and process of the host are correct.
06-08-2020 09:21 AM
The SPI I set has communication, but I still can't get CHIPID with BMX160. I would like to ask if you have any sample code for SPI read calling function and process. Thank you
I already use bmi.h and bmi.c files, do I still need to use bmm.c and bmm.h files?
06-08-2020 10:09 AM
Maybe you could view this link to gew more info about BMX160 driver.
https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BMX 160-driver/m-p/6581
06-08-2020 03:39 PM
The following is my code
Read CHIPID is not 0XD8
read CHIPID is 0xFFFFFFFD
----------------------------------------------------------------------------------
int32_t main()
{
SYS_UnlockReg();
System_Init();
SPI0_PinSet();
SPI0_Set();
UART0_Set();
SYS_LockReg();
CS_IMU = PE12;
struct bmi160_dev sensor;
sensor.id = 0;
sensor.interface = BMI160_SPI_INTF;
sensor.read = IMU_spiRead_BMX160;
sensor.write = IMU_spiWrite_BMX160;
sensor.delay_ms = Delayms;
int8_t rslt = BMI160_OK;
rslt = bmi160_init(&sensor);
while(1)
{
printf("\n+------------------------+\n");
printf("[Chip ID] 0x%X\n", rslt);
printf("\n+------------------------+\n");
Delayms(1000);
}
}