This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADC FIFO overrun!

I am doing ADC sampling continuously, not sure what will happen in the following situation.

When ADC FIFO overrun happens, but the FIFO overrun interrupt is not enabled, will TSC_ADC keep going or will it disable itself?

If FIFO overrun interrupt is enabled, usually what should I do to service the interrupt?  I am playing with BeagleBone, so AM335X.

Pardon me for bad English.



  • Turns out that I set FIFO0Threshold to 64, which is the size of FIFO0. So after I set it to 56, continuous sampling works OK.

    But it is wired, since when I set FIFO0THRES to 64, I can get FIFO0COUNT larger than 64, what happened? Does that mean if I only enable one FIFO, it is going to take both FIFO0 and FIFO1. 

    Please can somebody tell me what is ADC subsystem's behavior when there is a FIFO overrun? Will it stop AD convert or keep running? I can not find any description about it in the documents.

  • Hi Guoqiang Xia,

    Are you accessing the ADC on Linux platform? If so how you could get the ADC access. I am having trouble in finding any documentation on how to access the ADCs from application.

    Some places blog says it can be accessed through ti_tscadc driver. But not much clear information.

    Could you please help me on this.

    Thanks,

    Raja.

  • koen's blog show how to read adc in shell.

    In C you can do this, this read one AD conversion in, you can let it do more, but keep in mind, currently, ti_tscadc only do one shot sampling. You can read ti_tscadc.c to find that out.

    int main(int, char**){

    int count;

    int value[100];

    int fadc=open("/sys/devices/platform/tsc/ain0","O_RDONLY);

    count=read(fadc, (void *)value,2);

    /*then do your thing!*/

    close(fadc);

    return 0;

    }



  • Hi Guoqiang Xia,

    Thanks for posting the sample. I have added the patches to my kernel and followed koen's blog and run the command line arguments. I got Digital inputs. Need to validate the same.

    Do we have to configure the step size for ADC?

    I could see AIN numbers from 1 - 8, even the patch says channel numbers from 1 - 8 and I think internally driver removes the offset.

    Still I have not run the ADC continuously to see FIFO overrun problems.

    Regards,

    Raja.

  • Hi Guoqiang Xia,

    I could get the ADC values after following the koen's blog.

    But While accessing the same port from C sample provided by you, i am getting the read error and errno is EBUSY.

    Value updated by read call will be an integer or string. how many bytes we need to read to get proper value.

    I have followed your code mentioned above. I am reading ADC pin 1 as AIN2(equivalent to AIN1) as the ti_tscadc driver removes the offset 1 inside.

    fadc=open("/sys/devices/platform/tsc/ain2","O_RDONLY);

    count=read(fadc, (void *)value,2);

    Requesting your help in getting the value.

    Thanks,

    Raja.

     

  • Raja,

      Are you working with ti_tscadc too?

      I edited ti_tscadc.c so it is not the same as the original one.

      I can share the code, but the style and structure of the code is not as good as it should be, also I did not follow a lot of conventions about device drivers, so I am not sure about posting it here, right now its quality is still poor.

      But I think you should work with ti_tscadc to get going, also do not put too much trust on my code sample because it might not work in your case.

    Best,

    Guoqiang

  • Hi Guoqiang Xia,

    Yes. I am also working on ti_tscadc.

    Could you please share me teh ti_tscadc.c code on my email id if you are comfortable. I wont mind about the conventions.

    Today morning I could figure it out that the ADC value received from read call is in the form of ascii chars. I missed that point. converting string to integer gives the value equivalent same as getting from command prompt.

    Appreciate the help you have provided.

    Thanks,

    Raja.

  • Raja,

      Yes, I will send my updated ti_tscadc to your email, but I have to warn you it is just for reference, I am sure there is bug in the driver because I am reading LDD3 while working on the driver, so ...

       Please let me know how I can send it to you.

    Best,

    Guoqiang