Part Number: TMS320F280025C
Other Parts Discussed in Thread: C2000WARE
I want to configure an ADC channel to be triggered for start of conversion by external GPIO. I understand that I need to route a GPIO to Input X-BAR INPUT5. I have routed pin number 74 (GPIO5) to X-BAR input 5 as below:
XBAR_setInputPin(INPUTXBAR_BASE, XBAR_INPUT5, 5);
XBAR_lockInput(INPUTXBAR_BASE, XBAR_INPUT5);
The SOC is configured to use GPIO5 as external ADC trigger source as shown below:
//Configuring SOC for ADCIN6 . It will be triggered by GPIO, ADCEXTSOC
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER8, ADC_TRIGGER_GPIO,
ADC_CH_ADCIN6, 8);
An interrupt is configured to be generated when ADC conversion is complete:
//Configuring interrupt for conversion complete
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER2, ADC_SOC_NUMBER8);
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER2);
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER2);
Finally interrupt is enables in the main function as below:
Interrupt_enable(INT_ADCA2);
To test if the conversion is done, I have toggle an LED in the ISR. Due to some reason the SOC is not getting triggered by the external GPIO or the interrupt is not being generated. There are some other interrupts configured in the code that are working so I assume that global interrupt is enabled. I think there is no example in C2000Ware for SOC trigger by external GPIO. Please guide..