Hello everyone!!! I use Nuvoton M451 MCU with BMX160, The communication protocol uses SPI, I will read the BMX160 CHIP ID but cannot succeed rslt =-3(DEVICE NOT FOUND) ------------------------------------------------------------------------------- BMX160 ->CHIPDID is 0xD8 But the information I received is 0x80 &0xFF I would like to ask where is the problem ------------------------------------------------------------------------------- [my code] CS_BMX160_SPI = 0; CS_BMX160_SPI = 1; /////////////////////////////////////////////////////////////////////////////////////////////////// struct bmi160_dev bmi; bmi.id = 0; bmi.interface = BMI160_SPI_INTF; bmi.read = (bmi160_com_fptr_t)spiRead_BMX160; bmi.write = (bmi160_com_fptr_t)user_spi_write; bmi.delay_ms =(bmi160_delay_fptr_t) Delayus; /////////////////////////////////////////////////////////////////////////////////////////////////// while(1) { //CS_BMX160_SPI = 0; int8_t rslt = BMI160_OK; rslt = bmi160_init(&bmi); printf("\n\nCPU @ %dHz\n",SystemCoreClock); printf("\n+------------------------+\n"); if (rslt == BMI160_OK) { printf("BMI160 initialization success !\n"); printf("Chip ID 0x%X\n", bmi.chip_id); } else { printf("BMI160 initialization failed !\n"); printf("[Error code] %d\n", rslt); } printf("\n+------------------------+\n"); Delayms(1000); }
... View more