I have been trying to set up the BMA421 motion sensor in a nrf52 based smart watch, using the datasheet for the BMA423, which has the same interface. I had got the sensor working well with the original source code, but I was trying to set it up myself. It is connected via I2C, address 0x18.

I made some mistakes in my original code. I was trying to initialise the chip with a 6Kb byte stream (as in the original source), in chunks of 64 bytes. I didn't resend the register at the start of each data chunk, so ended up writing bytes to random registers.

Unfortunately, I have managed to get the sensor into an unrecoverable state - it now returns 0xFF to all reads, and doesn't respond to a soft-reset code (register 0x7E=0xB6). Even exhausting the watch battery to power cycle the chip doesn't seem to help.

I have found someone with a similar issue on the Borsch Sensortec forum, so I am hoping that a complete battery discharge works.

Does anyone have any other suggestions?

  • 1
    Are you using I2C or SPI? SPI doesn't have addresses, but every slave has a chip select pin. I2C on the other hand has addresses and no chip select pin.
    – chrisl
    May 6 at 8:24
  • Sorry, have corrected - it is I2C. May 6 at 8:31
  • Currently my plan of action is discharge the battery and then leave for a week to see if I can reset the chip. Not optimistic. May 6 at 8:57
  • A suggestion from another source was that I have put the device into SPI mode and disconnected it from the I2C bus - that would certainly explain the result. May 6 at 9:38
  • 1
    good point. From the "drain battery" I guess, that the hardware is mostly integrated, so that you cannot just try connecting SPI and configuring it again over that?
    – chrisl
    May 6 at 10:02

The BMA421 was not locked. An erroneous write to the wrong register had switched it to the (non-existant) SPI interface. The solution was to power cycle the sensor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.