I2C Peripheral address and Peripheral Register address for embedded coder sensor fusion
조회 수: 16 (최근 30일)
이전 댓글 표시
Hello, As part of my master thesis, I am working on STM32F411 Discovery board which has an onboard LSM303AGR sensor for MEMS.
My aim is to use this sensor inputs and make a mathematical model in simulink. For this purpose, I want to interface the sensor via serial communication to get continous data input from the onboard accelerometer. The embedded coder has I2C read and write blocks, and I am using this example for sensor fusion:
I am trying to replace the blocks inside this model with my target hardware I2C read and I2C write block however, I do not understand the terminology used in simulink blocks.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1472626/image.png)
I have found the I2C address and I2C register address from the sensor data sheet but which address belong to which simulink block address, I am not sure. below are the addresses from datasheet
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1472631/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1472636/image.png)
There are not many examples from where I can understand. I also looked over the block description but it does not explain much exactly what address is being referred to. Has anyone worked with I2C sensor fusion in simulink and came across this or know in general which address is which?
댓글 수: 0
채택된 답변
Raghavendra Kandur
2023년 9월 7일
The "SAD" column of first table corresponds to "Peripheral address" used in I2C block.
The "Register address" column of second table corresponds to "Peripheral register address" used in I2C block.
댓글 수: 2
Vikky Patil
2023년 9월 21일
You need to configure the Data rate in CTRL_REG1_A as part of Initialize Function. Else the sensor will be always in Power-down mode
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!