cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Uart and PWM doesn't work at the same time

Maprex
Associate

Hello, I have urgent work. In the code I have, pwm is written as bare metal and uart is written with hal. I am using the STM32 F401RE model. PWM uses TIM1 CH1 and Ch2, TIM 10, TIM11, and Uart is with the TIM 2 Hal library. When I run the code alone, both of them work separately but when I combine them, they do not work. Since the codes are a bit long, I am sending them as a file. Your ideas are very valuable, please help.

1 REPLY 1

Welcome to the forum.

For best results, please see: How to write your question to maximize your chances to find a solution.

In particular, please give details of your hardware.

 


@Maprex wrote:

 when I combine them, they do not work. .


So your first step is to narrow-down what, exactly, is "not working".

  • Use the debugger
  • Add instrumentation
  • Compare & contrast the 'working' and 'not-working' cases.

There's no inherent reason why a UART shouldn't work at the same time as PWM,

 


@Maprex wrote:

 the codes are a bit long, 


Try simplifying to a minimal system which demonstrates the problem.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.