Hi, I am trying to bring up the BHI260AP Shuttle Board 3.0 at 1.8V using I2C with nrf52840DK. I had issue that I got kernel version value 0 from the call bhy2_get_kernel_version(&version, &bhy2), so basically I didnt get "printf("Boot successful. Kernel version %u.\r\n", version);". But I thought I had successfully uploaded the firmware to the ram since the boot_status is 0x31 from the call bhy2_boot_from_ram(&bhy2). What could be the problem? My BHI260AP Shuttle Board 3.0 setup: VDD -> 1.8V VDDIO -> 1.8V APP_SPI_CS -> 1.8V APP_SCL -> nrf52840DK SCL with external pull up resistor 4.7k APP_SPI_MISO -> GND APP_SDA -> nrf52840DK SDA with external pull up resistor 4.7k GND -> GND My sensor init part of code learnt from https://github.com/BoschSensortec/BHY2-Sensor-API : #include "bhi260ap/BHI260AP.fw.h" int sensor_BHI260AP_init() { uint8_t chip_id = 0; uint8_t product_id = 0; uint16_t version = 0; int8_t rslt; struct bhy2_dev bhy2; uint8_t hintr_ctrl, hif_ctrl, boot_status; #ifdef BHY2_USE_I2C intf = BHY2_I2C_INTERFACE; #else intf = BHY2_SPI_INTERFACE; #endif //setup_interfaces(true, intf); /* Perform a power on reset */ #ifdef BHY2_USE_I2C rslt = bhy2_init(BHY2_I2C_INTERFACE, (bhy2_read_fptr_t) platform_twi_read, (bhy2_write_fptr_t) platform_twi_write, (bhy2_delay_us_fptr_t) platform_delay_us2, BHY2_RD_WR_LEN, NULL, &bhy2); #else rslt = bhy2_init(BHY2_SPI_INTERFACE, (bhy2_read_fptr_t) platform_spi_read, (bhy2_write_fptr_t) platform_spi_write, (bhy2_delay_us_fptr_t) platform_delay_us2, BHY2_RD_WR_LEN, NULL, &bhy2); #endif print_api_error(rslt, &bhy2); rslt = bhy2_soft_reset(&bhy2); print_api_error(rslt, &bhy2); rslt = bhy2_get_chip_id(&chip_id, &bhy2); print_api_error(rslt, &bhy2); /* Check for a valid chip ID */ if ((chip_id != 0x70) && (chip_id != 0xF0)) { printf("CHIP ID read %X. Expected %X\r\n", chip_id, BHY2_PRODUCT_ID); } else { printf("BHI260/BHA260 found. CHIP ID read %X\r\n", chip_id); } rslt = bhy2_get_product_id(&product_id, &bhy2); print_api_error(rslt, &bhy2); /* Check for a valid product ID */ if (product_id != BHY2_PRODUCT_ID) { printf("Product ID read %X. Expected %X\r\n", product_id, BHY2_PRODUCT_ID); } else { printf("BHI260/BHA260 found. Product ID read %X\r\n", product_id); } /* Check the interrupt pin and FIFO configurations. Disable status and debug */ hintr_ctrl = BHY2_ICTL_DISABLE_STATUS_FIFO | BHY2_ICTL_DISABLE_DEBUG; rslt = bhy2_set_host_interrupt_ctrl(hintr_ctrl, &bhy2); print_api_error(rslt, &bhy2); /* Configure the host interface */ hif_ctrl = 0; rslt = bhy2_set_host_intf_ctrl(hif_ctrl, &bhy2); print_api_error(rslt, &bhy2); /* Check if the sensor is ready to load firmware */ rslt = bhy2_get_boot_status(&boot_status, &bhy2); print_api_error(rslt, &bhy2); if (boot_status & BHY2_BST_HOST_INTERFACE_READY) { uint8_t sensor_error; int8_t temp_rslt; printf("Loading firmware.\r\n"); /* If loading firmware to flash, erase the relevant section */ #ifdef UPLOAD_FIRMWARE_TO_FLASH if (boot_status & BHY2_BST_FLASH_DETECTED) { uint32_t start_addr = BHY2_FLASH_SECTOR_START_ADDR; uint32_t end_addr = start_addr + sizeof(bhy2_firmware_image); printf("Flash detected. Erasing flash to upload firmware\r\n"); rslt = bhy2_erase_flash(start_addr, end_addr, &bhy2); print_api_error(rslt, &bhy2); } else { printf("Flash not detected\r\n"); return 0; } #endif rslt = bhy2_upload_firmware_to_ram(bhy2_firmware_image, sizeof(bhy2_firmware_image), &bhy2); temp_rslt = bhy2_get_error_value(&sensor_error, &bhy2); if (sensor_error) { printf("%s\r\n", get_sensor_error_text(sensor_error)); } print_api_error(rslt, &bhy2); print_api_error(temp_rslt, &bhy2); #ifdef UPLOAD_FIRMWARE_TO_FLASH printf("Booting from Flash.\r\n"); rslt = bhy2_boot_from_flash(&bhy2); #else printf("Booting from RAM.\r\n"); rslt = bhy2_boot_from_ram(&bhy2); #endif temp_rslt = bhy2_get_error_value(&sensor_error, &bhy2); if (sensor_error) { printf("%s\r\n", get_sensor_error_text(sensor_error)); } print_api_error(rslt, &bhy2); print_api_error(temp_rslt, &bhy2); rslt = bhy2_get_kernel_version(&version, &bhy2); print_api_error(rslt, &bhy2); if ((rslt == BHY2_OK) && (version != 0)) { printf("Boot successful. Kernel version %u.\r\n", version); } } else { printf("Host interface not ready. Exiting\r\n"); //close_interfaces(BHY2_SPI_INTERFACE); return 0; } return rslt; }
... View more