This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DRV8873SEVM: Using SPI to set PWM curve in brushed DC

Part Number: DRV8873SEVM
Other Parts Discussed in Thread: DRV8873

Hi everyone!

I don't understand how to control the PWM curve using SPI registers: it's ok for me using IN1 and IN2 with an ext PWM module (and it's works, with some strange noise from DC motor during acc and dec transition), but i don't find how to do the same with register options.

I'm using the evalutation board of DRV8873, and the controller connected is an Arduino Board based on ESP32 micro-controller.

Thanks in advance,

Daniele.

  • Hi Daniele,

    Are you trying to accelerate and decelerate using SPI while holding IN1 and IN2 HIGH the whole time?

    You can use Phase/Enable mode to only need 1 PWM pin and 1 digital pin (instead of 2 PWM pins). Most Arduino/ESP32 boards have several PWM-capable pins.

    Regards, 

    Yara

  • Hi Yara!

    No, i have checked and the combination of IN1 and IN2 is correct: i think which the problem may be the PWM frequency, it is less that 20kH.

    SPI is the way for me because i need a daisy chain of several drivers, and i don't have enough GPIO for control motors, hall sensors and current sensing:is it possibile use a PWM output and SPI for write enable on/off in Phase/Enable mode?

    Thanks in advance,

    Daniele.

  • Hey Danielle, 

    Take a look at the EN_IN1 and PH_IN2 bits in the IC3 register - I think that will do what you're looking for!  Not sure why it isn't mentioned anywhere else in the datasheet.  But you should be able to use those bits instead of the hardware inputs.  Note that this is generally recommended to be used for full ON/OFF/DIR control, and not for PWM control since you'd have to send many rapid SPI pulses to toggle either pin at PWM frequency.  But you're welcome to try if it works in your application. 

    Note the requirement for SPI_IN to be a 1 to use the SPI control

    Regards,

    Jacob

  • Hi Jacob,

    thanks for your suggestion! I will try this solution.

    Best regards,

    Daniele.