Other Parts Discussed in Thread: MSP430F5529, DRV832X,
Tool/software: Code Composer Studio
The code I will be referring to is "DRV832X_MSP430F5529_Trapezoidal_Sensorless_BLDC" provided by TI for BOOSTXL-DRV8323RH in combination with the MSP430F5529 dev kit.
I am having trouble with understanding how to control the motor speed/duty cycle using the potentiometer found on the BOOSTXL-DRV8323RH dev board. Is there a function in place that is already sampling the ADC port and I just need to use that, or do I need to implement that myself? The only portions of code I can find that somewhat indicate that the potentiometer is being sampled goes as follows:
Found in Init.c
void ADC_Init(void)
{
ADC12CTL0 = ADC12ON | ADC12SHT0_0 | ADC12SHT1_0; // Turn on ADC12, avoid overflow of results , select 16 clock cycles for sampling
ADC12CTL1 = ADC12SHP | ADC12CONSEQ_1; // Use sampling timer, Single sequence, start conversion from memory address 0 , Select clock as SMCLK
ADC12MCTL0 = ADC12INCH_6 + ADC12EOS; // channel = A6 (Read the speed input from pot 0-3.3v ) ,
ADC12IE = 0x00;
}
I have been trying to implement a method of checking the pot every 1 second when ApplicationStatus.currentstate= MOTOR_RUN
But this seems to interfere with the following function
Found in global.c
/*function
* FastReadBEMF
* Triggers ADC and Samples BEMF of all three Phases
* is the speed input (potentiometer) for the applications
* */
void FastReadBEMF(void)
{
ADC12CTL0 |= ADC12ENC; // Enable Conversions
ADC12CTL0 |= ADC12SC; // Start sampling of channels
while(ADC12CTL1 & ADC12BUSY_L)
{
}
;
ADC12CTL0 &= ~ADC12ENC; // End sampling of channels
ADC12CTL0 &= ~ADC12SC; // Disable conversions
SensorlessTrapController.GetBEMF = ADC12MEM0 & 0x0FFF;
/* Filter only last 12 bits */;
SensorlessTrapController.GetBEMF >>= PWM_FACTOR; /*12 bit ADC result has to be scaled to 10 bit value */
}
Also, does the comment “is the speed input (potentiometer) for the applications “ have anything to do with the function or was that a typo?