Hello support!
Using iMX6 board and writing code for ADC in C#. Libraries in use are latest CE libraries (toradexcelibraries_v1_6_3123)
The problem with ADC is:
ADC Init and configuration pass okay (TRUE) however actual Read_ADC request hangs the code without throwing any error.
Please see C# code below with comments
//Init ADC
ADC_handle = adc.Adc_Init("ADC1");
ResultBox.Text += "ADC Init Result: " + ADC_handle.ToString() + "\r\n";
At this point we are good and get actual ADC_handler.
//Pass init strings
bool set_conf1 = adc.Adc_SetConfigInt(ADC_handle, "BitResolution", 12, TdxCommon.ParamStorageType.StoreVolatile);
bool set_conf2 = adc.Adc_SetConfigInt(ADC_handle, "AvgSamples", 8, TdxCommon.ParamStorageType.StoreVolatile);
//Show result
ResultBox.Text += "Config results: " + set_conf1.ToString() + " " + set_conf2.ToString() + "\r\n";
We good here as well and also get both TRUE
//Assign Colibri pin (pin8)
gpio.uIo adc_pin;
adc_pin.GenericDefinition = 0x00200008; //Generic pin assignment and type definition (MSB:type LSB:pin number)
bool conf_res = adc.Adc_SetConfigInt(ADC_handle, "ioAdc", adc_pin.GenericDefinition, TdxCommon.ParamStorageType.StoreVolatile);
ResultBox.Text += "ADC Config result: " + conf_res.ToString() + "\r\n";
Probably this pin assignment is not required (as per your demo code) and we tried both ways with and without pin assignment code above. When pin assignment code is in use we have TRUE as a return.
Now we open ADC
//Open ADC
bool result = adc.Adc_Open(ADC_handle);
ResultBox.Text += "ADC Open result: " + result.ToString() + "\r\n";
Here we get TRUE
Now wait some time to be safe.
//Delay some time
Thread.Sleep(1000);
Now performing actual reading of ADC value.
Here our code hangs. We have no more results or information.
Code stays at Adc_Read function and waiting infinite.
//Read ADC
UInt32 read_res = adc.Adc_Read(ADC_handle, ADC_result, 4);
We never get here.
//Show result
ResultBox.Text += "Pre-result: " + read_res.ToString() + "\r\n";
//long longValue = Marshal.ReadInt64(ADC_result);
//Show result
ResultBox.Text += "ADC Read result: " + ADC_result.ToString() + "\r\n";
//Close ADC
bool adc_close1 = adc.Adc_Close(ADC_handle);
//Deinit ADC
bool adc_close2 = adc.Adc_Deinit(ADC_handle);
//Show result
ResultBox.Text += "Closure and DeInit: " + adc_close1.ToString() + " " + adc_close2.ToString() + "\r\n";
Please help to resolve this issue. So far it looks like we did everything as per your example and using your wrapper however for some reason there is no result which should be at the end.
Did we do something wrong ?
Thank you,
Vlad