I connected STM32 F334R8 microcontroller to L298 H-bridge. I made some measurements. The problem is output signal on L298 has quite slow slopes and is not as sharp as input signal. I do not understand why the distortion occurs. As you can see the frequency is very low - only 10 Hz.

  • Pink color = L298 output signal,

  • Yellow color = L298's Enable pin (STM32's PWM output),

  • Green color = L298's Input 1 (STM32's output),

  • Blue color = L298's Input 2 (STM32's output),

Input 1 and Input 2 determine direction of output current.

Oscilloscope measurements low freq

Also when we increase the frequency of PWM to 25 kHz and change duty cycle dynamically to achieve stepped sinusoidal signal, then output not always follows the input: Oscilloscope measurements high freq

Not sure are the distortions showed on 1 and 2 related.

Note 1: Oscilloscope waveform acquire is in Hi-Res to average signals.

Note 2: On PWM output (yellow) I am generating abs(stepped_sin(x)). Then to make stepped_sin() on the L298 output I am changing Input 1 and Input 2 (just inverting current direction).

I'm just curious what's the reason of such strange behavior.

L298 logic supply voltage is 5 V, power supply voltage is 8 V. Output load is 4Ω power resistor.

I have already checked L298 datasheet and typical PWM switching frequency is 25 kHz. Also input's logical high starts with 2.3 V. My microcontroller uses 3.3 V logic so it should be sufficient, isn't it?

  • \$\begingroup\$ Why do you fiddle with the enable pin during normal operation? \$\endgroup\$ – Harry Svensson Jan 20 '18 at 14:59
  • \$\begingroup\$ Because enable pin usually used for PWM, what is wrong with it? \$\endgroup\$ – Madras Jan 20 '18 at 15:15
  • \$\begingroup\$ Do you have low ESR Cap across IC? Since the ESR of each driver is close to 1 Ohm and the total drop is >3V @ 1A and >4V @ 2A the L298 is not a good candidate at low supply voltage<12V A better candidate is a MOSFET bridge \$\endgroup\$ – Sunnyskyguy EE75 Jan 20 '18 at 16:06
  • \$\begingroup\$ The L298 is a horrible, antiquated, lossy part. If you want firm drive use an FET solution. \$\endgroup\$ – Chris Stratton Jan 20 '18 at 17:05
  • \$\begingroup\$ Why do you have channel 4 (pink) on 50 ohms mode? \$\endgroup\$ – τεκ Jan 27 '18 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.