Hello
I want to share the ADC Module with the Sensorcontroller/Maincontroller on an CC1310.
The Sensorcontrollertask is executed 3 times per second. In this task I'm logging the ADC value from DIO9 and DIO8.
In the Maincontroller i only want to read the Batteryvoltage on Pin DIO10.
Now the problem is, that the result from the ADC_convert() on the maincontroller is always ADC_STATUS_ERROR.
This only happens, when I acquire the Hardware semaphore AUX_SMPH_2 before the conversation.
Is it necessary to acquire the hardware semaphore on the main controller?
Whats the correct way tho share the ADC?
Thanks for the help!
Edit: formating
// // MAIN CONTROLLER CODE // ADC_Handle adc_h; ADC_Params adc_params; void initAdc() { ADC_init(); ADC_Params_init(&adc_params); } int readAdc() { AUXSMPHAcquire(AUX_SMPH_2); //get access to the adc (parallel used in Sensorcontroller!) adc_h = ADC_open(TRANS_V1_0_ADC2, &adc_params); //Battery ADC Channel result = ADC_convert(adc_h, &batteryvoltage); ADC_close(adc_h); AUXSMPHRelease(AUX_SMPH_2); if (result == ADC_STATUS_SUCCESS) { return batteryvoltage; } return 0; }
// // SENSORCONTROLLER CODE // fwAcquirePeripheral(PERIPHERAL_ADC); adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_341_US, ADC_TRIGGER_MANUAL); adcSelectGpioInput(AUXIO_A_ADC_PIN_TEMPERATURE); adcGenManualTrigger(); adcReadFifo(output.adc); adcDisable(); fwReleasePeripheral(PERIPHERAL_ADC); //do some processing fwScheduleTask(1); // Schedule the next execution