I2C Peripheral address and Peripheral Register address for embedded coder sensor fusion
16 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sanath
il 4 Set 2023
Commentato: Vikky Patil
il 21 Set 2023
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 Commenti
Risposta accettata
Raghavendra Kandur
il 7 Set 2023
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 Commenti
Vikky Patil
il 21 Set 2023
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
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!