PWM stm32-F303RE

Hello, I am trying to use two PWM blocks in my application — one to trigger the ADC and the other for the actual input to the ADC. When I was testing with just one PWM handling both functions, it was working. But when I tried to insert the second one, PLECS showed a communication error with the board.

ERROR:
Error in build step #6 (Make): Make process exited with code 2:
“C:/Users/LabSolar_02/Desktop/st_stm32_1.4.3_win/tsp_stm32/bin/c2p-gdb/c2p-gdb” load --server-cmd “\“C:/Users/LabSolar_02/Desktop/st_stm32_1.4.3_win/tsp_stm32/bin/openocd/bin/openocd\” -s \“C:/Users/LabSolar_02/Desktop/st_stm32_1.4.3_win/tsp_stm32/bin/openocd/share/openocd/scripts\” -f board/st_nucleo_f3.cfg” --server-start-delay 1000 --port 3333 --nvic 0x8000000 ./output_STM32F303RE/test.elf
Error: Unable to connect: A opera��o foi conclu�da com �xito [system:0]
Unable to connect.
Healthy exit.
test.mk:232: recipe for target ‘download’ failed

Open On-Chip Debugger 0.11.0 (2021-12-23-14:02)
Licensed under GNU GPL v2
For bug reports, read

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
srst_only separate srst_nogate srst_open_drain connect_deassert_srst

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : STLINK V2J33M25 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.263937
Error: init mode failed (unable to connect to the target)

make: *** [download] Error 1

Hello Rafael!

I am not able to reproduce the issue that you are experiencing by building a PLECS model that corresponds to your screenshot. May I ask you to attach a .plecs file that triggers the problem? Is the problem you described reproducible (i.e. can you repeatedly flash the microcontroller if you place just a single PWM block in the model, but not when you place two PWM blocks in the model)? Does the model revert to a working state if you remove the second PWM block?

As a side note: The model that you built should compile and function correctly. However, using two PWM blocks in a model for these purposes is not a typical workflow since both PWM blocks are operating at the same frequency. What desired behavior motivated the use of separate PWM blocks?

1 Like

Yes, it’s working with a single PWM. I know they have the same frequency — I’m going to change that later. I’m just trying to learn how the trigger function works.

test.plecs (22.6 KB)

Hello Rafael!

Thank you for posting the PLECS model. I am still unable to reproduce the issue.

One thing I can think of is that we have had reports of Windows 11 users experiencing connection issues as a result of missing drivers. Installing STM32 Cube IDE has helped those users install the necessary drivers. I would be surprised if this connection issue is triggered by placing a second PWM block in the model though!

1 Like

Yes, I am using Windows 11, and I already have STM32CubeIDE installed. I just don’t know if it is the most up-to-date version.

Hello Rafael,

I am not able to determine a likely cause for the error message you are seeing. Getting to the root of the issue would likely require a video call to see exactly what models trigger the error message and what the specific setup of your system is. If you are interested in such a call in the future, the best way to set it up would be to reach out to support@plexim.com.

Good afternoon.
I was able to upload the code to the STM. In the end, I just had to install some drivers.
When I opened STM32CubeIDE, a message appeared asking to update the ST-Link driver.
Thanks for your help!

1 Like