Simple FOC with DRV8301

Hello! First of all thank you so much if you can answer to this question. Has anyone ever used this repository? —> GitHub - simplefoc/Arduino_SimpleFOC_DRV8301_Support_Library: Arduino DRV8301 library support for SimpleFOC, it also can use alone without SimpleFOC library

File which i am using → simplefoc_vesc6_3pwm_openloop_speed_control_test (its located in the example folder)

i want to use the 3 PWM leg “operation”. (i am not excatly sure if i can use the 6 pwm mode because in the arduino uno 2 of the dedicated PWM legs are SPI legs too.)

I set the SPI legs and the 3 PWM legs too in a correct way (its not a complicated thing) but still the motor is not moving when i adjust the “target_velocity” via series port.

Because its an “openloop” operation i dont need feedback.

i am using DRV8301 and arduino uno. Are there any “small” thing which i have to do to make it work?

I suspect you are missing a ‘small thing’ as you say.

Is it doing anything? Making a buzz/shake? If not then I suspect the driver is not enabled (have you pulled EN_GATE high) or not receiving enough voltage (think it needs more than 6V).

Any chance of describing your setup a bit more? Which DRV8301 board are you using? Can you post a photo of uno 2 + board with how you setup the wires and how you are powering it

Hello! First of all thank you for the answer (Sorry for the late reply i was not in my home country)! it was sucessfully launched! But i still have some questions. I could start the BLDC motor but just with the 6 pwm mode. I dont really understand it. When i try to use it in a 3 pwm mode the “over current” warning always pop up which is indicated by the DRV8301 but its a little bit none sense because its not even moving and the Gate enable pin is high so its make some ‘noise’ but just in a low frequency (around 500hz). Should i adjust or set up something more if i change the mode to 3 PWM? Maybe the problem is the dead time (i leave it as a default value which the 50ns)? I can attach a picture just like i am using 3 jumper to the 3 pwm signal and another one to the GATE_ENABLE. So its not a big set up :D. Thank you for your reply !

I wonder whether you’ve switched to 3pwm in software but the hardware (i.e drv8301) might still be in 6pwm. There datasheet has a pwm_mode register which can be set to 6pwm or 3pwm.

Might be worth checking that the drv8301 init code is setting that register

i already set it up via SPI ( The 3 pwm mode). But i wonder should i send a comman via SPI to adjust it to 3 PWM mode every power up? I couldn’t find any hint about this in the datasheet.

I really appreciate the help!

I suspect you’d need to set drv8301 config on every power up. It is unlikely to be persisted.

And how do you know this ? i mean i went through the whole datasheet of the DRV8301 and i couldnt find any hint about this.

You are right, I don’t know for sure. I don’t think the datasheets says that it has EEPROM therefore I would have thought the registers are backed by SRAM (i.e. volatile memory) which needs to be set on each boot.

Some devices that do persist certain config talk about the ‘burn procedure’ in their datasheets. They also talk about how often the registers can be changed (sometimes only once). Example being as5600 magnetic sensor which allow angle and config to be burnt.

This is just a matter of reading lots of datasheets…

Devices that have non-volatile memory always mention it, and typically they have more complicated procedures for programming the non-volatile memory than just for writing registers. So then the datasheet contains a description of that programming procedure.

The DRV8301 contains no such description, but on the other hand the datasheet contains a register map, and gives the default values for the registers.
So the way these chips work is that the chip starts with the registers set to the default values after each reset, and you have to change them by writing to them during the configuration phase of your software.

Most chips (that have registers) work like that, so they don’t mention it explicitly. They could make it clearer, for sure.

Clear explanation! Thank you so much!

You are right. I am not experienced with the datasheets. Thank you so much for the explanation!