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.

Adapt "development_kits\DRV8312-C2-KIT_v128\BLDC_Sensorless" code to LAUNCHXL-F28069M + BOOSTXL-DRV8301

Other Parts Discussed in Thread: CONTROLSUITE, BOOSTXL-DRV8301, INSTASPIN-BLDC, MOTORWARE

Hi

I am trying to adapt the 

E:\ti\controlSUITE\development_kits\DRV8312-C2-KIT_v128\BLDC_Sensorless

to drive a BLDC motor with LAUNCHXL-F28069M + BOOSTXL-DRV8301

I managed to import it in CCS 6, compile (changes some dir / environnement variables) and Run It

I didn't succeed in starting the GUI of : E:\ti\controlSUITE\development_kits\DRV8312-C2-KIT_v128\GUI_project_InstaSPIN_BLDC

or E:\ti\controlSUITE\development_kits\DRV8312-C2-KIT_v128\GUI_project

the connection to Port COM 8 over USB fails while it works with another project example of InstSPIN -FOC _so I know that the harware / pilot are ok_

 

Even by trinyng manualy in a watch window to change the variables : EnableFlag and RunMotor

id didnt work in Leven1 or 2

/*------------------------------------------------------------------------------
Following is the list of the Build Level choices.
------------------------------------------------------------------------------*/
#define LEVEL1 1 // Module check out (do not connect the motors) 
#define LEVEL2 2 // Verify ADC, calibrate the offset, run the motor open loop
#define LEVEL3 3 // Auto-calibrate the current sensor and BEMF sense offsets
#define LEVEL4 4 // Verify CMTN_TRIG module
#define LEVEL5 5 // Verify the closed loop based on the computed BEMF zero crossings
#define LEVEL6 6 // Verify the closed current loop and current PI controller
#define LEVEL7 7 // Verify the closed speed loop and speed PI controller

Can anyone advice me the correction I must made to the code to get it spinning the BLDC sensorless

 

thanks

 

  • I would suspect something with the GPIO mapping or the scaling of the voltage/current variables.
    You should be able to get the first 5 levels running I expect...but you don't have the sum current measurement on the BOOSTXL that is required for level 6.

    Is there a reason you aren't using the provided InstaSPIN-FOC?
  • Thanks Chris

    I have go with all kind of GPIO with no success

    I have also tried SCI A and B on the simple example 28069M as said in my other post

     

    The code BLDC_Sensorless runs (tried level1 and 2) by managing the 8301 inverter enable flag

    #define OnduleurOff { GpioDataRegs.GPBCLEAR.bit.GPIO50 = 1;	}
    #define OnduleurOn { GpioDataRegs.GPBSET.bit.GPIO50 = 1;	}

    it drive a huge current and drop the power supply voltage down to 6 V (that goes in current limitation)

    also:

    1. the 2 GUI examples provided do not connect via my COM port, I don't know why.

    2. I can change the variable by my own GUI (using the variable  EnableFlag to make it spin) that is integrated to CCS 6.

    3. There is no DC current measure on the 8301, is it mandatory for the control (Level >3) , do the 2 and 3 phase currents enough, which file I must change ?

    4. I can sum manually the 3 currents if required, I have changed (but not tested) the ADC inputs as for InstaSpin FOC example 5g :

    f2806xileg_vdc_BLDC.h
    	/******* CHANNEL SELECT *******/															\
    																								\
    	AdcRegs.ADCSOC0CTL.bit.CHSEL 	= 0;   	/* ChSelect: ADC A0-> Phase U Churrent*/			\
    	AdcRegs.ADCSOC0CTL.bit.TRIGSEL 	= 5;	/* Set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1*/	\
    	AdcRegs.ADCSOC0CTL.bit.ACQPS 	= 6;	/* Set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)*/						\
    																								\
    	AdcRegs.ADCSOC1CTL.bit.CHSEL 	= 8;	/* ChSelect: ADC B0-> Phase V Current*/				\
    	AdcRegs.ADCSOC1CTL.bit.TRIGSEL  = 5;														\
    	AdcRegs.ADCSOC1CTL.bit.ACQPS 	= 6;														\
    																								\
    	AdcRegs.ADCSOC2CTL.bit.CHSEL 	= 7;	/* ChSelect: ADC A7-> DC Bus Voltage*/ 				\
    	AdcRegs.ADCSOC2CTL.bit.TRIGSEL  = 5;														\
    	AdcRegs.ADCSOC2CTL.bit.ACQPS 	= 6;														\
    																								\
    	AdcRegs.ADCSOC3CTL.bit.CHSEL 	= 9;	/* ChSelect: ADC B1-> V Phase A */					\
    	AdcRegs.ADCSOC3CTL.bit.TRIGSEL 	= 5;														\
    	AdcRegs.ADCSOC3CTL.bit.ACQPS 	= 6;													 	\
    																								\
    	AdcRegs.ADCSOC4CTL.bit.CHSEL 	= 2;	/* ChSelect: ADC A2-> V Phase B */					\
    	AdcRegs.ADCSOC4CTL.bit.TRIGSEL  = 5;														\
    	AdcRegs.ADCSOC4CTL.bit.ACQPS 	= 6;														\
    																								\
    	AdcRegs.ADCSOC5CTL.bit.CHSEL 	= 10;	/* ChSelect: ADC B2-> V Phase C */					\
    	AdcRegs.ADCSOC5CTL.bit.TRIGSEL  = 5;														\
    	AdcRegs.ADCSOC5CTL.bit.ACQPS 	= 6;														\
    																								\
    	AdcRegs.ADCSOC6CTL.bit.CHSEL 	= 1;    /* ChSelect: ADC A1->  Phase W Current -> Low Side DC Bus Return Cur.*/	\
    	AdcRegs.ADCSOC6CTL.bit.TRIGSEL 	= 5;														\
    	AdcRegs.ADCSOC6CTL.bit.ACQPS 	= 6;														\
    
    instead of the original:
      	AdcRegs.ADCSOC0CTL.bit.CHSEL 	= 1;   	 ChSelect: ADC A1-> Phase U Churrent			\
    	AdcRegs.ADCSOC0CTL.bit.TRIGSEL 	= 5;	 Set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1	\
    	AdcRegs.ADCSOC0CTL.bit.ACQPS 	= 6;	 Set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)						\
    																								\
    	AdcRegs.ADCSOC1CTL.bit.CHSEL 	= 9;	 ChSelect: ADC B1-> Phase V Current				\
    	AdcRegs.ADCSOC1CTL.bit.TRIGSEL  = 5;														\
    	AdcRegs.ADCSOC1CTL.bit.ACQPS 	= 6;														\
    																								\
    	AdcRegs.ADCSOC2CTL.bit.CHSEL 	= 10;	 ChSelect: ADC B2-> DC Bus Voltage 				\
    	AdcRegs.ADCSOC2CTL.bit.TRIGSEL  = 5;														\
    	AdcRegs.ADCSOC2CTL.bit.ACQPS 	= 6;														\
    																								\
    	AdcRegs.ADCSOC3CTL.bit.CHSEL 	= 15;	 ChSelect: ADC B7-> V Phase A 					\
    	AdcRegs.ADCSOC3CTL.bit.TRIGSEL 	= 5;														\
    	AdcRegs.ADCSOC3CTL.bit.ACQPS 	= 6;													 	\
    																								\
    	AdcRegs.ADCSOC4CTL.bit.CHSEL 	= 7;	 ChSelect: ADC A7-> V Phase B 					\
    	AdcRegs.ADCSOC4CTL.bit.TRIGSEL  = 5;														\
    	AdcRegs.ADCSOC4CTL.bit.ACQPS 	= 6;														\
    																								\
    	AdcRegs.ADCSOC5CTL.bit.CHSEL 	= 12;	 ChSelect: ADC B4-> V Phase C 					\
    	AdcRegs.ADCSOC5CTL.bit.TRIGSEL  = 5;														\
    	AdcRegs.ADCSOC5CTL.bit.ACQPS 	= 6;														\
    																								\
    	AdcRegs.ADCSOC6CTL.bit.CHSEL 	= 2;     ChSelect: ADC A2-> Low Side DC Bus Return Cur.	\
    	AdcRegs.ADCSOC6CTL.bit.TRIGSEL 	= 5;														\
    	AdcRegs.ADCSOC6CTL.bit.ACQPS 	= 6;														\
    

    Why I dont use the InstaSpin FOC:

    I have a BLDC PMSM motor (with trapezoidal bemf), when using the InstaSpin FOC _which require a sinus bemf SM), the current is "pumping"  and I got a bad behavior over 3000 rpm.

    Is there a InstaSPIN BLDC for 28069M _ the only one is for 283xxx E:\ti\controlSUITE\development_kits\DRV8312-C2-KIT_v128\InstaSPIN_BLDC)   instead of using this ?

    Is the code InstaSpin FOC for 69M / 8301  simpler to adapt than the BLDC_Sensorless code for 69M / 8312 ?

    Thanks for your kind help, we are almost lost here...

    Lotfi

  • I'm not sure what your problem is...porting SW to an new set of HW can be tricky. Need to configure all the I/O correct, set-up clocking, all scaling variables, etc.  You'll have to check your work.

    1. The GUI provided for the DRV83xx EVM won't work with your LaunchPad.  The binary is tied into the .exe, and that binary is built for the EVM.  You need to use the CCS project and GUI Composer to create a new GUI if you need it for your application.

    2. ok

    3 / 4. For trapezoidal BLDC control having a sum current is usually preferred.  We specifically built the BOOSTXL-DRV8301 to work for FOC control with just low leg shunts.  You can use these for total current sum.  I don't know what this has to do with lab 5g

    InstaSPIN-FOC can certainly be used with trapezoidal Bemf motors, and quite well.  If there is a current issue it is more likely to do with PWM frequency or misidentified motor parameters.

    InstaSPIN-BLDC is available for the F28035 and F28069 controlCARDs (the project is dual built).  Technically the F28069M controlCARD should work, but I think you will have to add the Iqmath library to the project and probably update the memory map .cmd file.

    Lotfi said:
    Is the code InstaSpin FOC for 69M / 8301  simpler to adapt than the BLDC_Sensorless code for 69M / 8312 ?

    Adapt to what?  If you are just changing HW platforms I think MotorWare / InstaSPIN-FOC is simpler to adapt.

    If you are porting HW and to a different MCU then controlSUITE code is probably where you should start.

    In your shoes I would look again at InstaSPIN-FOC. Work through the labs, post here to confirm your settings and ID'd parameters, and plan on using proj_lab10 eventually which offers over-modulation (trapezoidal drive at the top 25% of the duty cycle)

  • Thanks for your kind help

    I am still deep inside the BLDC sensorless code, trying to make it work, it just spinning the ramps... but no real control

    Is there a pdf describing the code ?

    If it don't work I will go back to InstaSPIN FOC or InstaSpin BLDC

    As I already said, InstaSPIN FOC  is working, I can change the speed, but above 2500 rpm the current begins pumping a lot, it is not as perfect as I expect, perhaps motor parameter is the issue as you said.

    I found that the BLDC sensorless code is smaller / simpler than InstaSPIN FOC, though this one is partially written in ROM, but the lib is huge and need lot of understanding.

    As far as now, my control works better with Instspin FOC...

  • C:\ti\controlSUITE\development_kits\DRV8312-C2-KIT_v128\InstaSPIN_BLDC\~Doc
    that's the extent of the documentation

    "As far as now, my control works better with Instspin FOC..."

    it should be better and simpler (control is mostly automated). Post your user.h with ID'd parameters if you go back to InstaSPIN-FOC.
  • here are the user.h and motor params

    Any suggestions ?

    Thanks

    user_j5.h

    user.h

  • small comment
    #define USER_MOTOR_Ls_d (0.0000171) // 0.0000147H or auto identified : 171 uH

    this is 17uH, not 171.
    17uH is certainly possible (and expected) for a high speed hobby motor, so that looks fine.

    your user.h looks fine.

    if you run proj_lab05a and set an IqRef_A of (5.0), how does the motor behave?

    I'm thinking your "problems" with current pumping may just be that you are running in speed control mode and haven't tuned the controller. The default "best guess" gains for the speed controller is just based off your max current setting. It's sort of a rule of thumb that tends to work pretty well as a starting point for "normal" motors. For high speed, low inertia, higher current motors like yours this default tuning is too stiff. In proj_lab05b try reducing the speed control Kp and Ki gains by a factor of 10 to start.

    There is no reason you should have current issues at 3 KRPM (250 Hz).
  • Thanks for the advices

    speed control Kp from 3 to 1, solved the current pumping

    I would like to modify the code to switch online between current control only to current and speed control, for testing

    is it safe to change it online in the main_ISR ?

        // Enable or not the Library internal PI.  Iq is referenced by the speed PI now
           if ( ctrl_speed_Iq)	CTRL_setFlag_enableSpeedCtrl(ctrlHandle, true);
           	   else  		CTRL_setFlag_enableSpeedCtrl(ctrlHandle, false);
    

    of course I have to update manually Iqs_ref

    also I notice that GUI composer sometimes doesn't work fine, for example, it does not display the Binding details Pre and Post Process function that I have already affected, and if I restart, I can see them...

    also when copying from an html to another, it does not keep the bindings name :-((

  • you can switch from speed to torque mode on the fly w/o any issue.
    when you try to switch to speed mode you need to seed the speed controller so that it seamlessly takes over and doesn't provide any sort of "blip" for the IqRef_A input to the torque control system.

    Regarding GUI Composer, yes, there are sometimes "flakey" things that happen. If you want to try to debug some of them the GUI Composer guys can help you on the Code Composer Studio forum. They are quite responsive.