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?
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.
Please check our API and use it.
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:
Step1 - Read chip ID
Step2 - Initialization sequence
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
Step 4 - Configure accelerometer
Please, take your time to review these details and let me know where's the mistake.
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.
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.