Hi,
/* Channel assignment */
/* S0 S1 S2 S3 S4 S5 S6 S7 */
/* A0 */
ADC_CLIST1 = 0x3210;
ADC_CLIST2 = 0x7654;
/* S8 S9 S10 S11 S12 S13 S14 S15 */
/* B0 B0 */
ADC_CLIST3 = 0xBA98;
ADC_CLIST4 = 0xFEDC;
/* Enable samples 0, 1, 8, 9 */
ADC->SDIS = ADC_SDIS_DS(0xFCFC);
In addition
/* phase current AD channel assignment for HVP-KV46F150M board
*
* required format "MLIB_ShL_F16(ADC channel number,ADC channel list shift)"
*
*/
this->uw16AdcAchanIa = (UWord16)(MLIB_ShL_F16(2,0)); //ANA2 -> Iph_A
this->uw16AdcAchanIc = (UWord16)(MLIB_ShL_F16(3,0)); //ANA3 -> Iph_C
this->uw16AdcBchanIb = (UWord16)(MLIB_ShL_F16(10,0)); //ANB2 -> Iph_B
this->uw16AdcBchanIc = (UWord16)(MLIB_ShL_F16(11,0)); //ANB3 -> Iph_C
If I want to detect the three-phase current, why should I enable samples 0, 1, 8, 9? And why is 0xFCFC?
Best regards!
wang xuan
Hi,
I would recommend customer to download and check [Software for 3-Phase Permanent Magnet Synchronous Motor (PMSM) Motor Control(REV 1.2.0)] software, which also provide PMSM demo for HVP-KV46F150 board.
The demo located at C:\nxp\MCRSP_PMSM_V1.2.0\build_demos\hvpkv46f folder.
The <mcdrv_hvpkv46f.c> file provides the ADC channel number assignment array at InitADC12() function,
which using below define:
/* Phase current A assingned to ADC0 only */
#define M1_ADC0_PH_A (2)
#define M1_ADC1_PH_A (MCDRV_CHAN_OFF)
/* Phase current A assingned to ADC1 only */
#define M1_ADC0_PH_B (MCDRV_CHAN_OFF)
#define M1_ADC1_PH_B (2)
/* Phase current A assingned to ADC0 and ADC1 */
#define M1_ADC0_PH_C (3)
#define M1_ADC1_PH_C (3)
During the ADC initialization, there will change the ADC Channel list register for suitable ADC channel.
Wish it helps.
Have a great day,
Mike
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------