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.

DRV8323R: RPM information from DRV8323R

Part Number: DRV8323R

Hello,

I have a customer who has been working on our DRV8323RH BLDC Board.  He is looking to extract the RPM information directly from the device. He would like to measure the RPM outside of GUI. Can you help me to provide instructions for how to do this?  Thanks!

-Will

  • Will,

    The device does not actually know the RPM of the motor. The customer can use the CSA output and their MCU to measure the electrical frequency of the back-EMF and therefore infer the RPM from the waveform using the following equation:

    RPM = Hz* (2 / poles) * 60

    RPM = shaft rotation speed or revolutions per minute

    Hz = electrical frequency or cycles/sec of one CSA output

    Poles = number of poles of your motor.

    Regards,

    -Adam

  • Thank you Adam.

    Which variable in the code is associated with CSA output. The RPM displayed in GUI is quite accurate. following variables are from global.h

    Thank you


    //Initial Speed Control Variables uint16_t ComparatorNext; uint16_t ComparatorState; uint8_t ISCbrake; uint16_t ISCcount; uint8_t ISCdone; uint16_t ISCfirst; ISC_STATE ISCStatus; //IPD Variables uint16_t IPDCoastTime; uint16_t IPDCount; uint16_t IPDCurrent; BOOL IPDDone; uint16_t IPDMaxCRV; SINT32 IPDCurrentRiseValue[7]; BOOL IPDStart; uint16_t IPDState; IPD_STATE IPDStatus; //Align Variables BOOL AlignComplete; uint16_t AlignWaitCounter; BOOL StartAlign; //Open Loop Acceleration Variables uint16_t AccelCounter; uint16_t AccelDistance; BOOL AccelDone; uint16_t AccelVelocityInit; /* This variable holds the initial value of open loop acceleration */ uint16_t Counter_1M_Second; /* This variable holds the counter value for 1 milli second based on PWM frequency */ uint16_t Counter_1_Second; /* This variable holds the counter value for 1 second based on PWM frequency */ //Closed Loop Variables BOOL ADCchange; uint16_t ADCcnt; uint16_t ADCdelay; BOOL ADCready; BOOL ADCswitch; uint16_t BEMFtrigger; uint8_t CommStateDetect; uint16_t CTvoltage; uint16_t GetBEMF; BOOL SpeedChange; uint16_t SpeedDivider; uint16_t SumBEMF; uint16_t PhaseA_BEMF; uint16_t PhaseB_BEMF; uint16_t PhaseC_BEMF; //System Variables uint8_t CurrentCommState; uint16_t CurrentDutyCycle; BOOL Direction; BOOL Direction_flag; uint16_t faultreg; uint16_t OClimit; uint16_t SystemCount; uint16_t TargetDutyCycle; uint16_t VCCvoltage; uint16_t MotorPhaseCurrent; uint16_t RestartDelay; uint16_t RestartDelayCounter; uint16_t RotationCount; uint16_t StallDetectCounter; uint16_t StallDetectDelay; BOOL TimerOverflowFlag; /* Interrupt counter to ensure the speed measurement with 18bit resolution*/ //MDBU Serial Variables uint16_t SPDFdbk; /* This variable holds the Motor parameter (0) Motor Spin frequency in timer counts with 18bit resolution */ uint16_t DeviceID; /* This variable holds the Motor parameter (2) Device ID to set the appropriate motor control page for a connected device */ uint16_t ISCMinBEMF; /* This variable holds the Motor parameter (3) ISC_MIN_BEMF to set the min BEMF value above which ISC routine is executed */ uint16_t ISCBrakeTime; /* This variable holds the Motor parameter (4) ISC brake time to set the amount of time to brake the motor during ISC routine */ uint16_t IPDBrakeTime; /* This variable holds the Motor parameter (5) IPD brake time to set the amount of time to brake before applying another pulse during IPD */ uint16_t IPDPulseTime; /* This variable holds the Motor parameter (6) IPD Pulse time to set the amount of time current pulse is given during IPD */ uint16_t IPDDecayConstant; /* This variable holds the Motor parameter (7) IPD Decay Constant time to set the amount of time current pulse is allowed to decay during IPD */ uint16_t AlignSector; /* This variable holds the Motor parameter (8) Align secor to set the commutation state to be aligned at the motor start up */ uint16_t AlignWaitTime; /* This variable holds the Motor parameter (9) Align wait time to set the amount of time for which voltage pulses are given during Aligning the rotor at start up */ uint16_t AccelRate; /* This variable holds the Motor parameter (10) Accel rate defines the Open loop Blind acceleration rate */ uint16_t AccelStop; /* This variable holds the Motor parameter (11) Accel stop defines the open loop to closed loop hand off velocity */ uint16_t AccelVelocity; /* This variable holds the Motor parameter (11) Accel stop defines the open loop initial velocity */ uint16_t BEMFThreshold; /* This variable holds the Motor parameter (13) BEMF_threshold to set the BEMF integration threshold value */ uint16_t RampRateDelay; /* This variable holds the Motor parameter (14) Ramp rate delay to set the acceleration/ desceleration of the motor */ uint16_t SetMotorSpeed; /* This Variable holds the Motor parameter (31) speed input from the GUI through MDBU serial */ uint16_t CommutationBlankTime; /* This Variable holds the Motor parameter (16) to set the number of PWM cycles to before which BEMF is sampled */ uint16_t PWMBlankCounts; /* This Variable holds the Motor parameter (17) to set the number of PWM cycles to after which BEMF is sampled after a commutation is taken place */ uint16_t MaxDutyCycle; /* This Variable holds the Motor parameter (18) to set the PWM Maximum duty cycle */ uint16_t MinOffDutyCycle; /* This Variable holds the Motor parameter (19) to set the PWM Minimum off duty cycle to spin the motor */ uint16_t MinOnDutyCycle; /* This Variable holds the Motor parameter (20) to set the PWM Minimum on duty cycle to start the motor */ uint16_t StartupDutyCycle; /* This Variable holds the Motor parameter (21) to set the PWM duty cycle at strtup*/ uint16_t PWMPeriod; /* This Variable holds the Motor parameter (22) to set the PWM switching frequency*/ uint16_t UnderVolLim; /* This Variable holds the Motor parameter (23) to set the supply undervoltage limit */ uint16_t OverVolLim; /* This Variable holds the Motor parameter (24) to set the supply overvoltage limit */ uint16_t StallDetectRev; /* This Variable holds the Motor parameter (25) to set the minimum revolutions to detect for a stall fault */ uint16_t StallDetecttime; /* This Variable holds the Motor parameter (26) to set the time after which stall fault is triggered */ uint16_t MotorPhaseCurrentLimit; /* This Variable holds the Motor parameter (27) to set the motor Phase current limit */ uint16_t AutoFaultRecoveryTime; /* This Variable holds the Motor parameter (28) to set the time limit after which faults are automatically recovered */ uint16_t Align_IPD; /* This Variable holds the Motor parameter (29) to set the rotor or to find the current position of rotor */ uint16_t PWM_Mode; /* This Variable holds the Ctrl type : 0 for 6PWM mode , 1 for 1 PWM mode*/

  • Ibrahim,

    Are you using the code inside CCS? If so you should be able to compare these variables in real time to the actual motor speed, I suspect "SPDFdbk" is what you need but I am not 100% sure and I don't have an EVM with me to check.

    Please let me know if this works for you.

    Note that once we find the electrical frequency variable, you will still have to use the number of poles to back calculate the RPM based on the equation I mentioned above.

    Regards,

    -Adam