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.
Tool/software: Code Composer Studio
I wanted to set the ADC sampling frequency to 1MHz, I used c2000ware driverlib do it, but I only got 500KHz.
Then, I tried to fix it by changing the TBPRD(use EPWM5_SOCA as a trigger), however, no matter what TBPRD I chose, the sampling can't surpass 500KHz.
void ADC_Init(void) { ADC_setPrescaler(ADCA_BASE, ADC_CLK_DIV_4_0); ADC_setMode(ADCA_BASE, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED); ADC_setInterruptPulseMode(ADCA_BASE, ADC_PULSE_END_OF_CONV); ADC_enableConverter(ADCA_BASE); DEVICE_DELAY_US(1000); } void ADC_SOC_Init(void) { ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM5_SOCA,ADC_CH_ADCIN0, 15); ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER0); ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1); ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1); } void ADC_EPWM_Init(void) { EPWM_disableADCTrigger(EPWM5_BASE, EPWM_SOC_A); EPWM_setADCTriggerSource(EPWM5_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA); EPWM_setADCTriggerEventPrescale(EPWM5_BASE, EPWM_SOC_A, 1); EPWM_setCounterCompareValue(EPWM5_BASE, EPWM_COUNTER_COMPARE_A, 50); EPWM_setTimeBasePeriod(EPWM5_BASE, 100); // Freeze the counter EPWM_setTimeBaseCounterMode(EPWM5_BASE, EPWM_COUNTER_MODE_STOP_FREEZE); EPWM_enableADCTrigger(EPWM5_BASE, EPWM_SOC_A); EPWM_setTimeBaseCounterMode(EPWM5_BASE, EPWM_COUNTER_MODE_UP); }
Hi,
I looked into this and found that duration between two interrupts is quite large. The other approach could be to continuously sample the signal and capture the results at 1MSPS.
I am still looking at the latency numbers and will get back once I find something.
Thanks
Vasudha
Hi,
You need to set the HSPCLKDIV to 0 to make TBCLK = EPWMCLK. This needs to be done as HSPCLKDIV = 1 (/2) at reset. I think this should resolve your issue.
EPwm1Regs.TBCTL.bit.CLKDIV = 0x0; EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0x0;
Thanks
Vasudha