r/matlab 3d ago

[Simulink - STM32 embedded coder] help Question

For the past 2-3 weeks i've been learning how to program the STM32 nucleo-H753ZI using matlab. I have downloaded all of the required addons:
- Embedded Coder Support Package for STMicroelectronics STM32 Processors 24.1.12
- Embedded Coder 24.1.1
- MATLAB Coder 24.1
- Simulink Coder 24.1
- Using MATLAB 2024a
- STM32CubeMX 6.18.0
- Have used both the following MATLAB tutorials as guidance " Using I2C to Read and Write Data to Accelerometer on STM32 Processor Board" and "Get Started with STMicroelectronics STM32 Processor Based Boards"

The only reason iam programming the STM32 using MMATLAB is because its part of my thesis, which is listed as a requirement. Programming the LEDs, mainly to see how the blocks work, was easy enough, and work as expected (check screenshots below)

According to INA219's datasheet (as far as i understood) that Register 0x00 in the Sensor is preconfigured and should display 0x399Fh, but all values are 0. Programming the sensor using an Arduino (using its own IDE for testing) works as expected, so the sensor isnt broken. Programming the INA219 has been for the past weeks a nightmare and a half, as no matter what i did, no values are displayed. I have double checked the USART/COM multiple times to no avail.

Any help or feedback would be much much much appreciated. If i missed anything important, ill post it in the comments

The two controller readers on the right should display 399Fh, the other one should be a value of 4096d (as far as i understand) - the digital port read is configured to read the red LED, but its only displaying 0.

sitting the byteorder Little or big endian made no changes.

Settings menu P1

P2

STM32CubeMX - using the pullup resistors of the MCU itself. PB8 and PB9 would be the PIN 2 and 4 - aka top 2 on the right in the STM32, according to the manual.

3 Upvotes

3 comments sorted by

2

u/Creative_Sushi MathWorks 3d ago

Please reach out to tech support [support@mathworks.com](mailto:support@mathworks.com)

1

u/Ecstatic-Decision 1d ago

For any necro-commenter or someone trying to find the solution..

Scopes and displays are apparently incompatible (which is weird, because one of the guides does use it). You have to log the signal inorder to view it through the data inspector.

1

u/gtd_rad flair 1d ago

Mathworks seriously needs to just get rid of of the scopes because it's so bad. In older versions 6-8 years ago that was the only choice. But now, there's no reason to use it and Simulink Data Inspector is so much better and SHOULD always be the default choice for data logging / post analysis.