01-20-2023 10:10 PM - edited 01-23-2023 03:54 PM
Hello,
I'm using BMA456 hosted by a AVR microcontroller over I2C.
My goal is just to read continuous XYZ acceleration data from the chip, I don't need any of the special features.
I've just finished writing the initialization code on my MCU but unfortunately, when I read the accel_drdy flag in the STATUS register, it never goes high. Meaning that there's no acceleration data available.
This is how I'm proceeding:
After this initialization, I read the STATUS register (0x03) and wait for the drdy_acc flag to turn on, but it never turns on.
Am I missing something?
Thanks
01-24-2023 07:54 PM
Hi,
https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bma456-ds000.pdf
Please follow p11 ~13.
You need to check below things.
1) 0x7D should be done before 0x7C.
2) Once initialization done, you should check 0x2A and get 0x01.
We have API to support BMA456 features as below.
https://github.com/BoschSensortec/BMA456-Sensor-API
Please check our API and use it.
Thank you.
01-25-2023 11:39 PM
Hello Minhwan,
Thank you for the feedback.
I've updated my code with your suggestions. I want to clarify that I won't use your driver, since it needs the user to provide blocking functions for I2C communication and delay functionality. And that's unacceptable for our application since it's implemented in a bare-metal fashion (the driver provided is unacceptable for virtually any bare-metal solution though). For example, during the configuration file uploading, your driver calls a delay of 150ms. That delay in a blocking fashion is unacceptable in a bare-metal solution. Let me know if there's a misunderstanding here.
That being clarified, here is a step-by-step of what I've done until now. Please take a look and let me know if I'm missing something:
STEP-BY-STEP
Step1 - Read chip ID
Datasheet specification
My implementation
Step2 - Initialization sequence
Datasheet specification
My implementation
I write the configuration file all at once in a single I2C write operation, this means that I write 1200 Bytes in a single write operation (let me know if this is a problem). But for writing that file I first write the registers 0x5B and 0x5C with the index value 0x0000 (LSB to 0x5B and MSB to 0x5C), because I'll write the entire file in a single write operation. Unfortunately, there's no information in the datasheet on how to write the chip in burst mode, so I had to reverse-engineer your driver. This is absolutely inconceivable, but I had to do it.
After writing the index (0x0000) to the registers 0x5B and 0x5C, I transfer the entire configuration file. I won't include the picture of that capture because is huge.
Step 3 - Check feature engine status
Datasheet specification
My implementation
Step 4 - Configure accelerometer
Datasheet specification
My implementation
Please, take your time to review these details and let me know where's the mistake.
Thanks
01-26-2023 12:26 AM
Hi Btruden,
Did you put 150ms delay after writing initialization file ?
Before you read 0x2A register, you need 150ms delay for ASIC is intialized.
You should value 0x01 once you try to read 0x2A register, not trying continously until you get.
Thanks,
01-26-2023 02:03 PM
Hi Minhwan,
It didn't work. To wait 150ms and then read the register to see if it's 0x01 or keep reading the register until it's 0x01 is almost the same. That change is trivial.
Regards