Tool/software: TI-RTOS
I am trying to use ADCBuf driver on CC1350 Launchpad board. I am using TI-RTOS. When I use ADCBuf in blocking mode, everything is fine. But when I use it in non-blocking mode, it goes to callback just once then it gets stuck. Other tasks runs fine. If I change the sample size to 1, it does not get stuck but the value returned from ADC is wrong and always the same value returns. Please help.
/*
* ======== adcBufCallback ========
* ADCBuf conversion complete callback function
*/
void adcBufCallback(ADCBuf_Handle handle, ADCBuf_Conversion *conversion, void *completedADCBuffer, uint32_t completedChannel)
{
PIN_setOutputValue(ledPinHandle, Board_LED1, 0);
//uint32_t microVoltBuffer[ADCBUFFERSIZE];
//ADCBuf_adjustRawValues(handle, completedADCBuffer, ADCBUFFERSIZE, completedChannel);
//ADCBuf_convertAdjustedToMicroVolts(handle, completedChannel, completedADCBuffer, microVoltBuffer, ADCBUFFERSIZE);
}
void adcConvertFxn()
{
while(1)
{
Semaphore_pend(scConductivityExcStarted, BIOS_WAIT_FOREVER);
ADCBuf_Conversion singleConversion;
/* Configure the conversion struct */
singleConversion.arg = NULL;
singleConversion.adcChannel = 7;
singleConversion.sampleBuffer = sampleBufferOne;
singleConversion.sampleBufferTwo = NULL;
singleConversion.samplesRequestedCount = ADCBUFFERSIZE;
if (!adcBufHandle)
{
System_printf("ADC handler error!\n");
}
PIN_setOutputValue(ledPinHandle, Board_LED1, 1);
if (ADCBuf_convert(adcBufHandle, &singleConversion, 1) != ADCBuf_STATUS_SUCCESS)
{
// handle error
System_printf("ADC error!\n");
}
//ADCBuf_adjustRawValues(adcBufHandle, sampleBufferOne, ADCBUFFERSIZE, singleConversion.adcChannel);
//ADCBuf_convertAdjustedToMicroVolts(adcBufHandle, singleConversion.adcChannel, sampleBufferOne, microVoltBuffer, ADCBUFFERSIZE);
//Mailbox_post(adcMicroVoltMailbox, microVoltBuffer, BIOS_NO_WAIT);
//ADCBuf_close(adcBufHandle);
}
}