The datasheet says on page 89 (chapter 3.2.1 - Primary interface i2c/spi protocol selection) that a rising edge on CS is needed to switch to SPI: "At reset / power-up, BMI160 is in I2C mode. If CSB isconnected to VDDIOduring power-up and not changed the sensor interface works in I2C mode.For using I2C, it is recommended to hard-wire the CSB line to VDDIO. Since power-on-reset is only executed when,both VDDand VDDIOare established, there is no risk of incorrect protocol detection due to power-up sequence.If CSB sees a rising edge after power-up, the BMI160 interface switches to SPI until a reset or the next power-up occurs.Therefore, a CSB rising edge is needed before starting the SPI communication" Is there a time limit for this or it will automatically switch to SPI even if the cs low/high edge comes later (let's say 1ms) after power up ? I have a board where the main cpu and the sensor are powered from a battery and I have the sensor wired to us SPI, is it enough to just do a dummy write (as the datasheets says) right after boot to trigger the switch to SPI or should I redesign the board so that the cpu controls the sensor's VDD pin Currently I am doing a dummy SPI read from 0x7e right after boot, then I can read the chip id and it has a correct value, but I was wondering if this may glitch from time to time or is it safe to keep as it is? I saw this as an example (but would require me redesign the board): set CS low, turn on sensor (apply power to VDD), set CS high. Thank you.
... View more