0
\$\begingroup\$

I have encountered a problem that I am unsure how to solve.

As shown in the image at the bottom of the question, I have an FPGA (Nexys A7-100T) that generates signal to run a motor connected to a L298N motor driver. The FPGA signals are forward, reverse and a 20kHz PWM signal. However as the FPGA outputs are 3.3V max and the L298N requires 5V inputs, I have used a BSS138 bi-directional FET level shifter board.

This system works perfect without the PWM signal connected to the BSS138. When the enable jumper is in the L298N and the forward or reverse input is high, the motor runs at full speed.

But when I try to use the PWM signal through the BSS138 to the L298N, all the 5V outputs sit at the same voltage as the PWM channel, which is around 2.5v (The PWM signal has a 50% duty cycle).

Is this BSS138 not suitable for PWM signals?

Or what is my mistake here?

Hardware Circuit Image

EDIT 1

Below is an image of the BSS138 level shifter board used:

enter image description here

EDIT 2

Below is an image of the L298N board used:

L298N board image

\$\endgroup\$
9
  • \$\begingroup\$ What is the motor power rating and DCR? \$\endgroup\$
    – D.A.S.
    Commented Apr 13, 2021 at 13:41
  • \$\begingroup\$ Motor is around 5W I guess, as there is no power rating. It draws 200mA under no load. What is DCR? \$\endgroup\$
    – David777
    Commented Apr 13, 2021 at 13:44
  • \$\begingroup\$ DC resistance of coil helps you determine T=L/R = tau decay time on pulses \$\endgroup\$
    – D.A.S.
    Commented Apr 13, 2021 at 13:49
  • \$\begingroup\$ Ah right, the DC coil resistance is around 10.5 ohms. \$\endgroup\$
    – David777
    Commented Apr 13, 2021 at 13:50
  • 1
    \$\begingroup\$ Do you have the 3.3V and 5V connected to the level shifter? You don't show it in your diagram. \$\endgroup\$ Commented Apr 13, 2021 at 14:25

3 Answers 3

1
\$\begingroup\$

I thought a BSS138 was just a single Nch FET. You don't have any pullup R's but you don't need it anyways.

The L298 works off of 2.3V logic to 5V logic

Vil <= 1.5 V

Vih >= 2.3V

Also with Vce(sat) on hi/lo outputs you need at least 2.5V more than motor rated voltage for full RPM + torque. CMOS or FET power half or full H bridge drivers are better

This is not TTL input which has a threshold of 2 diode drops or 1.3 so the Vil <=0.8V and Vih>=2V. What does the datasheet tell you for Ih, Il? ( no issue ).

So you don't need the level shifter.

\$\endgroup\$
3
  • \$\begingroup\$ Ah yeah, I suppose it is TTL on the L298N. But do these inputs draw much current from the FPGA outputs directly? \$\endgroup\$
    – David777
    Commented Apr 13, 2021 at 13:51
  • \$\begingroup\$ This is a board with 4 Nch FET's with 10K pull up resistors in place. I will provide an image in the question. Also all I have is a L298N as I haven't got time to wait on a MOSFET driver for this project. I have supplied the L298N with 26Vdc to compensate for Vce. \$\endgroup\$
    – David777
    Commented Apr 13, 2021 at 13:53
  • \$\begingroup\$ OK then 24V motors current limited to 24V/10.5 Ohms = 2.3A ...x24 = 56 W on start up then 10% at rated power \$\endgroup\$
    – D.A.S.
    Commented Apr 13, 2021 at 13:57
1
\$\begingroup\$

The BSS138 rise and fall times look in MHz range, but to be honest I always used them on slow signals. If you have oscilloscope it would be nice to measure what is going from the FPGA pin, what is going after BSS138 when the L298, is there some capacitance, would a big pull down resistor change the characteristics?

When checking the L298 PDF: https://www.st.com/resource/en/datasheet/l298.pdf

Then it looks like you could drive the input directly with 3.3V logic and avoid the BS138 based board:

Input Low -0.3 to 1.5V

Input High 2.3V to VSS

A lot of electronics are 5V logic, but 3.3V compatible, I would double-check that the input is always input and not output, nor something with pull-ups. Don't know what exactly the board with the L298 is doing. Same with the BS138, that's just transistor, but you are using some board using these transistors, do you have schematics to it.

But if you are sure it's just pure input you could use the 3.3V, maybe I would resistor to limit current in series.

\$\endgroup\$
2
  • \$\begingroup\$ I have attached an image of the L298N board used, but I think they are always input so should be ok. \$\endgroup\$
    – David777
    Commented Apr 13, 2021 at 14:44
  • 1
    \$\begingroup\$ Yes but from the picture I still don't know the schematic and even if something looks identical on the picture might have different schematics. So I do not want to guarantee you that it will 100% work. But you should be fine to use it without the level shifter. \$\endgroup\$
    – Anton Krug
    Commented Apr 13, 2021 at 14:53
1
\$\begingroup\$

Though my replay is for sure timed out, I think it's worth to observe that the BSS138 level shifter can turn useful when you need to go back and forth with your signals between two blocks with different power voltage. In this case, you simply control the L298 from your FPGA, no need for feedback signals here. So there's no need for a bidirectional level shifter, at most some buffer, maybe also open collector, to protect the FPGA from possible spurious spikes from the motor power control.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.