필터 지우기
필터 지우기

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.
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
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?

채택된 답변

Raghavendra Kandur
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
Sanath
Sanath 2023년 9월 12일
Hello, thank you so much, just on a related question, I am following this example to interface this LSM303AGR sensor in simulink. The example sensor is ADXL345, for which the very first step is '0x08' to be written to the POWER_CTL Register located at address 0x2D of the ADXL345 sensor which is to power up the sensor. My LSM303AGR sensor does not have any such power control register, how do i power up the sensor? the datasheet doesnt really state anything about the sequence of operation, it only states the general sequence of an I2C operation. Could you please help regarding the same?
Nevertheless thank you so much for your help.
Vikky Patil
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개)

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by