Hi Minhwan, I thought I implemented functions. now I am trying to read chip id from bma400. I referenced Accelerometer.c. https://github.com/BoschSensortec/BMA400-API/tree/master/examples/accelerometer I did my mcu's spi initializing etc. I see data on clk,cs,mosi but can't see datas on miso. struct bma400_dev bma;
void AccelTaskFunction(void)
{
rslt = bma400_interface_init(&bma, BMA400_SPI_INTF);
bma400_check_rslt("bma400_interface_init", rslt);
rslt = bma400_soft_reset(&bma);
bma400_check_rslt("bma400_soft_reset", rslt);
rslt = bma400_init(&bma);
bma400_check_rslt("bma400_init", rslt);
} I am powering bma400 with 3.3V . I did some changes in functions. If I did sth wrong in functions please tell me . I deleted sth because I think they are dependent on coines board. bma400_interface_init returns 0, so it is okay. soft_reset function also returns 0 but I don't see any data on miso line. bma400_init returns -3 which means BMA400_E_DEV_NOT_FOUND. What does cause this problem ? int8_t bma400_interface_init(struct bma400_dev *bma400, uint8_t intf)
{
int8_t rslt = BMA400_OK;
if (bma400 != NULL)
{
if(intf == BMA400_SPI_INTF)
{
// dev_addr = COINES_SHUTTLE_PIN_7;
bma400->read = bma400_spi_read;
bma400->write = bma400_spi_write;
bma400->intf = BMA400_SPI_INTF;
// coines_config_spi_bus(COINES_SPI_BUS_0, COINES_SPI_SPEED_7_5_MHZ, COINES_SPI_MODE0);
}
bma400->intf_ptr = &dev_addr;
bma400->delay_us = bma400_delay_us;
bma400->read_write_len = READ_WRITE_LENGTH;
usleep(100000); // 100 ms wait
// coines_delay_msec(100);
// coines_set_shuttleboard_vdd_vddio_config(3300, 3300);
// coines_delay_msec(200);
}
else
{
rslt = BMA400_E_NULL_PTR;
}
return rslt;
} I think I modified coines_read_spi(dev_addr, reg_addr, reg_data, (uint16_t)len) and coines_write_spi(dev_addr, reg_addr, (uint8_t *)reg_data, (uint16_t)len) functions correctly. I am sending reg_addr first, then I reg_data. After that I wait for response. What is wrong with my functions ? I am calling bma400_init(&bma) function in background loop, and datas as below in logic analyzer.
... View more