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.
Hi,
I have enabled RTI and EPWM for ADC notification in the halcogen configuration. I can see the RTI Interupt being triggered in the RTI notification function,but I cannot see the ADC notification is triggered by the EPWM event. I have 3 adc pin input as below, but al the value have the same value as adc_data[0].value.
adc_data[0].value = (uint16)(adcREG1->GxBUF[adcGROUP1].BUF0); ////Get value for first conversion pin 8 from Potentiometer//
adc_data[1].value = (uint16)(adcREG1->GxBUF[adcGROUP1].BUF0); ////Get value for first conversion pin 10 from current sense that triggered by EPWM//
adc_data[2].value = (uint16)(adcREG1->GxBUF[adcGROUP1].BUF0); ////Get value for first conversion pin 11 from current sense that triggered by EPWM//
Could you help check my halcogen & code?:
void Init_all() { _enable_IRQ_interrupt_();/* enable irq interrupt in */ sciInit(); //Initialize the SCI (UART) module adcInit(); //Initialize the ADC module //hetInit(); //Initialize Het(PWM)// gioInit(); //Initialize GIO// etpwmInit();//Initialize PWM// TI_Fee_Init();// Initialize FEE. This will create Virtual sectors, initialize global variables etc.// rtiInit();// Initialize RTI driver // etpwmStartTBCLK();//This function starts the time-base clocks of all eTPWMx modules adcEnableNotification(adcREG1, adcGROUP1);//ADC enable notification adcStartConversion(adcREG1, adcGROUP1); rtiEnableNotification(rtiREG1,rtiNOTIFICATION_COMPARE0);// Enable RTI Compare 0 interrupt notification // gioEnableNotification(gioPORTA,1);//Enable notifications of GIO// canInit();//configuring CAN1 MB1,Msg ID-1 to transmit and CAN2 MB1 to receive // canEnableErrorNotification(canREG1); // enabling error interrupts CAN_Bus1// canEnableErrorNotification(canREG2); // enabling error interrupts CAN_Bus2// rtiStartCounter(rtiREG1,rtiCOUNTER_BLOCK0); // Start RTI Counter Block 0 // } //////**********************End of Initialization***********************///// void main(void) { Init_all();//Initialize all drivers// while(1) // Loop to acquire and do the task// { } } #pragma WEAK(adcNotification) void adcNotification(adcBASE_t *adc, uint32 group) { /* enter user code between the USER CODE BEGIN and USER CODE END. */ /* USER CODE BEGIN (14) */ GetAdcInput(); /* USER CODE END */ } void GetAdcInput(void) { adcData_t adc_data[3]={}; //ADC Data Structure adc_data[0].value = (uint16)(adcREG1->GxBUF[adcGROUP1].BUF0); ////Get value for first conversion pin 8// adc_data[1].value = (uint16)(adcREG1->GxBUF[adcGROUP1].BUF0); ////Get value for first conversion pin 10// adc_data[2].value = (uint16)(adcREG1->GxBUF[adcGROUP1].BUF0); ////Get value for first conversion pin 11// }
I am refering example below:
Please kindly help to solve the issue.
Thank you.
Best Regards,
Lukman
Hi Lukman,
You didn't share your ETPWM configuration, can you please make sure you configured ETPWM properly?
Especially below one
Have you enabled the ADC SOCA?
--
Thanks & Regards,
Jagadish.
Hi Jagadish,
Thank you for your reply.
Actually I got value on adc_data[0].value whic is convert analog voltage from Potentiometer and I confirm its correct value.
Then adc_data[1].value(ADC pin 10)& adc_data[2].value(ADC pin 11) which are connected to current sense, it has the same value with adc_data[0].value.
Please kindly check the pwm setting on picture below. I did enable the ADC SOCA. On the Pin Muxing also I saw by default it selecting start of SOC of eTPWM. Please kindly advice, is there any setting or register I need to take a look so that adc_data[1].value(ADC pin 10)& adc_data[2].value(ADC pin 11) can get correct value from current sense? Or since I use Hardware trigger, should I connect eTPWM pin to the Adc pin with wire or doesn't need?
Thank you.
Best Regards,
Lukman
Hi Lukman,
Can you please test with below project.
In this project i am generating a PWM signal with 6mS period and 50% duty-cycle, using this PWM i am triggering ADC which is operate in interrupt mode. Whenever a ADC interrupt occurs i am copying converted data into buffers, so please refer above project and test it at your end.
--
Thanks & Regards.
Jagadish.
Hi Jagadish,
I want to update that I solved my issue. Some how after I change my flash setting from necessary sector only to entire flash, everything is working nicely.
I appreciate your help.
Thank you.
Best Regards,
Lukman