Interface LSM303AGR Acceleration sensor STM32F4xx Board
7 views (last 30 days)
Show older comments
Hello,
As part of my master thesis, I am working on the STM32F411E Discovery board. This board has an LSM303AGR Accelerometer+Gyroscope via I2C communication, which I am trying to interface in Simulink to further develop a model in Simulink.
I have installed the STM Embedded coder support package however this doesnt have a block to get acceleration sensor data. I tried to look up how to interface an IMU sensor in Simulink however I could not find a tutorial that would fit my case. Has anyone worked on accel sesnsor fusion for STM board who could help me in the same. I have found various posts on the community regarding this but seems to be unsolved, posts dating back to 2016 even. It would be very useful if anyone could finally solve this sensor interface.
Thank you so much in advance for all the help.
0 Comments
Answers (2)
Sebastian Gross
on 30 Aug 2023
Hi Sanath,
it is almost impossible to provide a block for every sensor for every target hardware.
There is an example for I2C communication with LSM303AGR on Arduino: https://www.mathworks.com/help/fusion/ug/estimate-oientation-using-ahrs-filter-and-imu-data-in-simulink.html. You might have seen this one. Do you have the corresponding I2C read block for your hardware plattform?
There are also ways to develop your own device driver block: https://www.mathworks.com/help/supportpkg/arduino/device-driver-blocks.html. This would result in a block like the LSM6DSL block in the example I listed above.
Did you try those approaches?
Best
Sebastian
3 Comments
Sebastian Gross
on 31 Aug 2023
Edited: Sebastian Gross
on 31 Aug 2023
Hi,
the link did not work as the dot at the end of the sentence became part of the URL. It should work now.
"The model provided is pre-configured for STMicroelectronics Nucleo F401RE board. You can configure this model for other supported Nucleo boards by browsing to Configuration Parameters > Hardware Implementation > Hardware board and selecting the required board."
With the support package I can open stmnucleo_AccelGyro_extmode and select STM32F411RE and STM32F4-Discovery as hardware boards. I think you should give this a try. Let me know how it goes.
Sebastian Gross
on 1 Sep 2023
Hi,
just to make sure that things are running without external mode, can you turn it off:
Best
Sebastian
1 Comment
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!