S12ZVM configuration for the motor control applications

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S12ZVM configuration for the motor control applications

S12ZVM configuration for the motor control applications

This document includes in attachment excel file calculation that might be useful for those using the S12 MagniV for motor control and proper PLL setting in their projects.

 

Following parameters can be set and reused for different scenarios via attached excel sheet calculation for the S12 MagniV BLDC motor control applications:

#define CPMU_REFDIV // PLL setting of ref. divider
#define CPMU_SYNDIV // PLL setting of multiplier
#define CPMU_POSTDIV // PLL setting of the post divider
#define CPMU_REFFRQ // PLL setting of ref. frequency
#define CPMU_VCOFRQ // PLL setting of VCO frequency
#define ADC_TIM // setting of ADC timer
#define MIN_ADC_TRIGGER_FIRST // setting of ADC trigger
#define MIN_ADC_TRIGGER_SECOND // setting of ADC trigger
#define PWM_MODULO // PMF module config.
#define PWM_DEADTIME // PMF module config.
#define TIM_PRESCALER // Timer prescaler
#define TIMER_1MS // Setting of timer
#define SCI_BAUDRATE // setting of SCI baud rate

 

This is how it can look for setting either internal or external clock:

// PLL settings /* /* // Internal clock 1MHz, 100/50 MHz CPU/Bus clock, 8.33 MHz ADC clock #define _INTERNAL_CLOCK                        // 1 MHz internal clock is used #define    CPMU_REFDIV        0 #define    CPMU_SYNDIV        49 #define    CPMU_POSTDIV       0 #define    CPMU_REFFRQ        0 #define    CPMU_VCOFRQ        3 #define    ADC_TIM            2 #define    MIN_ADC_TRIGGER_FIRST     24 #define    MIN_ADC_TRIGGER_SECOND    144 #define    PWM_MODULO                5000 #define    PWM_DEADTIME              50 #define    TIM_PRESCALER      6         // Timer prescaler 64; 50 MHz/64 = 1.28 us #define    TIMER_1MS          781 #define    SCI_BAUDRATE       5208 */  // External clock 4MHz, 25/12.5 MHz CPU/Bus clock, 6.25 MHz ADC clock #define _EXTERNAL_CLOCK #define    CPMU_REFDIV        3 #define    CPMU_SYNDIV        24 #define    CPMU_POSTDIV       1 #define    CPMU_REFFRQ        0 #define    CPMU_VCOFRQ        1 #define    ADC_TIM            0 #define    MIN_ADC_TRIGGER_FIRST     8 #define    MIN_ADC_TRIGGER_SECOND    48 #define    PWM_MODULO                1250 #define    PWM_DEADTIME       13 #define    TIM_PRESCALER      4         // Timer prescaler 16; 12.5MHz/16 = 1.28 us #define    TIMER_1MS          781 #define    SCI_BAUDRATE       1302   

 

It is used in following function for Clock, Reset and Power Management Unit configuration:

//Clock, Reset and Power Management Unit configuration //* //*****************************************************************************/ void initCPMU(void) {     // Wait for stable supply after power up     while (GDUF_GLVLSF)         GDUF_GLVLSF = 1;      CPMUREFDIV_REFDIV = CPMU_REFDIV;     CPMUREFDIV_REFFRQ = CPMU_REFFRQ;     CPMUSYNR_SYNDIV = CPMU_SYNDIV;     CPMUSYNR_VCOFRQ = CPMU_VCOFRQ;     CPMUPOSTDIV_POSTDIV = CPMU_POSTDIV;  #ifdef _EXTERNAL_CLOCK     CPMUOSC_OSCE = 1;     while (CPMUIFLG_UPOSC == 0) {}; // Wait for oscillator to start up (UPOSC=1) and PLL to lock (LOCK=1) #endif      while (CPMUIFLG_LOCK == 0) {};     CPMURFLG  = 0x60;     //Clear PORF and LVRF }      
 

 

Or setting of ADC clock for both ADC modules in ADC module configuration function:

  //ADC0CTL_1 = 0;        ADC0TIM = ADC_TIM;          // clock: clk = fbus / (2x(reg.value + 1)) [0.25 - 8MHz]      
  //ADC1CTL_1 = 0;        ADC1TIM = ADC_TIM;          // clock: clk = fbus / (2x(reg.value + 1)) [0.25 - 8MHz]      

 

All the rest of the corresponding registers settings can be found in the example for the BLDC motor control of 3-pase sensorless BLDC development kit with S12 MagniV in section download:

MTRCKTSBNZVM128_SW: Complete motor control application software package for MTRCKTSBNZVM128

添付
評価なし
バージョン履歴
最終更新日:
‎10-15-2020 03:02 PM
更新者: