2023-04-12 02:13 AM
Hi all,
I'm not able to connect Simulink to the model running on the Nucleo-G491RE board using the "Monitor&Tune" mode via Simulink XCP protocol -> Virtual COM Port -> STLINK-V3E -> VCP LPUART1.
I can deploy the model itself successfully to the board (Simulink: Build&Deploy). The model just contains a pulse generator driving the user LED on the board, which works.
In the attachment, I have prepared the Simulink model, the *.ioc CubeMX project file and the output of the Simulink diagnostic viewer after running the "Monitor&Tune" mode.
The jumpers on the board are configured to use LPUART1 between the STLINK-V3E and the MCU (default):
LPUART1 (PA2/PA3) connected to STLINK-V3E Virtual COM port:
SB17, SB23: ON
SB18, SB22, SB12, SB20: OFF
USART1 (PC4/PC5) connected to ARDUINO® (D1 & D0) and ST morpho connector (CN10 pin 35 & 37).
SB13, SB19: ON
SB12, SB20, SB18, SB22: OFF
I followed an example from Mathworks called "Code Verification and Validation with PIL for STMicroelectronics STM32 Processors Based Boards" (unfortunately I'm not allowed to post links here).
I use following MATLAB related versions:
MATLAB 2022b
Embedded Coder Support Package for ARM Cortex-M Processors V22.2.0
Embedded Coder Support Package for STMicroelectronics STM32 Processors V22.2.1 (this supports the STM32G4xx)
I use following STM32 related versions:
STM32CubeMX V 6.4.0
STM32CubeProgrammer 2.6.0
STM32G4 firmware: STM32Cube_FW_G4_V1.5.1
Two more notes:
- I tried to modify the jumpers such that the USART interface is used instead of LPUART, which was also not working - the same error message arises.
- Also, I tried the same example on a Nucleo-F446RE using the normal USART interface, which works as expected using the "Monitor & Tune" mode.
Has anyone had this problem before? If so, I would be happy to hear his/her solution to the problem.
Also I'm about to measure the signals of the LPUART with a logic analyzer. I will post the results when I'm ready.
Thank you in advance!
2023-04-13 03:18 AM - edited 2023-11-20 08:26 AM
In the meantime, I was able to measure the LPUART1 communication, while Simulink tries to connect to the board. At the same time I analyzed the USB commands using a serial port analyzer. The files are attached. The RX signal of LPUART1, I measured at SB23 and TX at SB17.
On the TX, I don't see anything. On the RX, I receive two data patterns followed by each other with a delay of 2s:
If we look closer to one data pattern using the following serial interpretation settings
I get the following framing errors:
As I have read, LPUART has low active signals, so if I change the configuration to "inverted" as follows,
the framing errors disappear and 7 data words are being interpreted by the logic analyzer:
E.g. the first data word is 1111 1101. As it seems, the LSB is transmitted first, this translates to BF. Now, these are the two data sequences interpreted in the way described above:
When I look at the USB serial port analyzer, I see following write commands:
The write commands shown in the picture, are the only write commands in the whole recording. The write commands marked yellow in the picture, are 2s apart from each other, so this makes sense when we look back at the LPUART measurements. However, I'm not able to figure out, how the data sequences seen on the USB, translate to those of the LPUART1.
First, what I don't understand is, that on the LPUART, I see 7 words, on the USB it seems to be 8. And second, the data itself - from my understanding - has no relation between USB and LPUART, or am I missing something?
Since I'm not an expert on serial communications, I would be happy to get some support!
Thanks in advance!
2023-04-14 06:10 AM
Hi All,
This question was routed to the online support center for direct support from our specialist team.
Regards,
Jake
ST Support
2023-07-26 02:35 PM
Did u fix this problem as i have the same problem ?
2023-09-06 12:12 AM
Hi, was the problem fixed? I am trying to do this and have the same error with my f411 discovery board. Could you please support.