Need help! L298N's one phase side not outputting enough voltage

I am new to SimpleFOCLibrary and would need help on this issue.
I am currently following the step-by-step guide on the motor driver test: Getting started | Arduino-FOC

Hardware that I am using:

  1. Arduino Uno Rev 3
  2. L298N motor driver
  3. Nema 17 Stepper motor (soon to be attach)

My issue is that one phase side of the L298N is not working, where it will be at 0 V (around 20 mV). While the other side is 6 V.

I tried different cases by switching the pwm pins at digital pins and analog pins but it seems to be not working. (Note: I changed the pins in the code according to the cases.)

The code and the cases which I have tried are shown below.

// Stepper driver standalone example
#include <SimpleFOC.h>

// Stepper driver instance
// StepperDriver4PWM(ph1A, ph1B, ph2A, ph2B, (en1, en2 optional))
StepperDriver4PWM driver = StepperDriver4PWM(5, 6, 9, 10);

void setup() {

// pwm frequency to be used [Hz]
// for atmega328 fixed to 32kHz
// esp32/stm32/teensy configurable
driver.pwm_frequency = 32000;
// power supply voltage [V]
driver.voltage_power_supply = 12;
// Max DC voltage allowed - default voltage_power_supply
driver.voltage_limit = 12;

// driver init

// enable driver


void loop() {
// setting pwm
// phase A: 3V
// phase B: 6V

I hope someone can help.

I found out that pin 5 and 6 on the arduino were not outputting any voltages, by using a multimeter. So it was not the motor driver issue.

I also hooked it up to an arduino mega and it was the same result. I tried to swap to another pwm pins on the mega and still no improvement.

That’s strange… those pins should work for PWM on the UNO… I wonder what the problem can be?

I know that im not in the position to say this, but maybe it could be a bug somewhere in the codes?

because apparently majority uses other MCU other than arduino family, and most also use BLDC motor. so maybe there could be an overlook on the stepper motor and arduino family coding?

for example, the mega has some compiling issue. and this was fixed by editing some lines in the codes by following this guide. Compile error Arduino Mega 2560 with Encoder example

Yes, I think you are right - I also think the Stepper code is used less than the BLDC code, so it could be a bug… but I did a quick look into the code, and the pins you’re using are supported for PWM and it looks like they are configured and used correctly…

So I am unsure what’s going on :frowning:

You might want to try the BLDC driver and output pwm with it and see if Arduino outputs the PWM on the respective pins (without attaching the controller or the motor).

If it does, than it has to be a bug in the stepper driver, if it doesn’t output voltage with bldc driver, than the issue is somewhere else.

I tried to run a BLDC standalone motor driver test using the 3 PWM phase code on the arduino mega with nothing attached to it.

It turns out that the pwm pins were outputting voltages just fine with no issue.

You might be right, it might be a bug in the stepper driver code. Though I am not entirely sure whether it is true or not, hopefully someone could take a look and fix this possible bug. I can’t really read advance coding since this is not my field of specialty.