Other Parts Discussed in Thread: DRV8301
Tool/software: Code Composer Studio
When trying to run my motor with proj_lab11e, I wondered if the code is for 60DEG or 120DEG Hall sensor layout. I could not find anything in the software allowing me to choose between both. But using the code as is (with below correction) it works on my 120DEG motor. I am not sure if it will work for 60DEG motor.
One small mistake I found in HALLBLDC_State_Check:
gHall_GpioData = (~HAL_readGpio(halHandle, (GPIO_Number_e)HAL_HallGpio_C) & 0x1) << 2; //CAP1->J10/J4_1->green
gHall_GpioData += (~HAL_readGpio(halHandle, (GPIO_Number_e)HAL_HallGpio_B) & 0x1) << 1; //CAP2->J10/J4_2->green&white
gHall_GpioData += (~HAL_readGpio(halHandle, (GPIO_Number_e)HAL_HallGpio_A) & 0x1); //CAP3->J10/J4_3->gray&white
The schematic I am using for DRV8301-69M links CAP1 with GPIO_A and CAP3 with GPIO_C.
And one big(ger) mistake in hal.h the GPIO's for header 10 are wrong (GPIO 24,25,26 should be 40,41,42)
typedef enum
{
HAL_HallGpio_A=GPIO_Number_24, //!< GPIO pin number for Hall Sensor A
HAL_HallGpio_B=GPIO_Number_25, //!< GPIO pin number for Hall Sensor B
HAL_HallGpio_C=GPIO_Number_26 //!< GPIO pin number for Hall Sensor C
} HAL_HallGpio_e;
#endif
After changing to GPIO 40,41,42, it worked fine, except for an instability I experienced with
_iq gHall_speed_FastToBldc_low_pu @ 400rpm
_iq gHall_speed_BldcToFast_high_pu @ 600rpm
When going from FAST to BLDC with target RPM 450 > 350rpm, it doesn't reach 350RPM, but stays around 400rpm (see screenshot). It keeps oscillating between FAST and BLDC (BTW, I love this Analog Discovery scope ;-) ). I changed gMotorVars.MaxAccel_krpmps from very mild 0.2 to much more aggressive 2.0 but it doesn't make a difference. Any idea's? (I will re-identify my motor next week, but still the algorithm FAST > BLDC seems not robust when going to an RPM around the switching frequency). When increasing the hysteresis, it became better, but still I could reproduce the problem (maybe OK after making a very large hysteresis 400/1200rpm)
Best regards,
Tomas