Other Parts Discussed in Thread: BLE-STACK,
Tool/software: Code Composer Studio
Hi All,
I am trying to use the ADC peripheral (I've tried referring to this example: https://e2e.ti.com/support/wireless_connectivity/bluetooth_low_energy/f/538/p/404426/1433112#pi239031350=1 )
My goal is very easy: enable the adc and perform a single reading of the value before disabling the adc again...
I am using the same pins of the example (DIO_23), but after triggering the adc manually (using the function AUXADCGenManualTrigger();), the code stucks in the AUXADCReadFifo() function. I have tried using this in interrupt (and the interrupts is never raised) and also calling directly the readFifo function... the result is the same: the execution stucks on the instruction:
while (HWREG(AUX_ANAIF_BASE + AUX_ANAIF_O_ADCFIFOSTAT) & AUX_ANAIF_ADCFIFOSTAT_EMPTY_M);
in the AUXADCReadFifo function
It seems that the conversion is never completed. Can you help me to understand if there is any error in my code?
This is an extract of my code: (the interrupt is not enabled because in this case I'm trying to read the fifo directly)
----------------------------------------------------------------------------------------------
the pin is initialized as: "IOID_23| PIN_INPUT_DIS | PIN_GPIO_OUTPUT_DIS"
----------------------------------------------------------------------------------------------
// Enable Interrupt for the ADC
// Hwi_Params hwiParams;
// Hwi_Params_init(&hwiParams);
// hwiParams.enableInt = true;
// Hwi_construct(&hwi, INT_AUX_ADC, adcIsr, &hwiParams, NULL);
Power_setConstraint(Power_SB_DISALLOW); // Disallow STANDBY mode while using ADC
// Enable clock for ADC difital and analog interface (not currently enabled in driver)
AUXWUCClockEnable(AUX_WUC_MODCLKEN0_ANAIF_M | AUX_WUC_MODCLKEN0_AUX_ADI4_M);
AUXADCSelectInput(ADC_COMPB_IN_AUXIO7); // Connect AUX IO7 (DIO_23) as analog input.
AUXADCEnableSync(AUXADC_REF_FIXED, AUXADC_SAMPLE_TIME_2P7_US, AUXADC_TRIGGER_MANUAL); // Set Up ADC
AUXADCGenManualTrigger(); // Trigger the reading
adcSample = AUXADCReadFifo(); // Read the value from the FIFO
AUXADCDisable(); // Disable ADC
Power_releaseConstraint(Power_SB_DISALLOW); // Allow STANDBY mode again
----------------------------------------------------------------------------------------------
Thanks in advance!
Mat