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.

Synchronizing the two ADCs on TMS570

Other Parts Discussed in Thread: TMS570LS3137

Hello.

I have a question concerning the ADCs on the TMS570LS3137. 

I want to compare the samples of certain channels of both ADCs in the same ISR. To do that, the ideal solution would be the following sequence:

  1. Trigger the conversion of ADC1 and ADC2 by the same event (e.g. the RTI triggers conversions with a defined frequency)
  2. One Interrupt Service Routine is called when both ADCs have finished their conversions
  3. Within the ISR the results of both ADCs can be read out and certain channels can be compared by software

The problem I have with the ADCs: I haven't found a way to synchronize them. They seem to be completely independent from each other so that I can only configure them in a way each of the ADCs calls its own ISR when finished. But then I have to solve the synchronization problem in software: The two ISRs are called asynchronously and I don't know which of the two ADC conversions finishes first.

As this complicates the design I wanted to ask if there is a clever way of receiving the conversion results of the two ADCs at the same time?

Thanks in advance.

Jakob 

  • Jakob,

    As such if you have the same configuration (sample time, etc) for the 2 ADCs and use the same trigger source, they 2 conversions should be "fairly" synchronized.

    One way to do it would be to have only one of the conversions generate an interrupt and in that ISR, you can access the conversion results of the ADC that generated the interrupt, then poll the status bit of the 2nd ADC (which should already be set by then) and access the result of the 2nd conversion as well, compare results and take action based on that.

    Let me know if you see any issues doing it this way.

    Regards,

    Abhishek

  • Hello Abhishek .

    Thank you for for quick reply.

    The solution proposed is what I meant with "solving the problem in software": I would have to code a construct like

    while(status_bit_not_set) { /* do nothing */ }

    in my ISR, which from my point of view is a very bad style as you cannot predict how long your ISR is going to take. Of course you can argue that the other ADC's conversion "should" be finished by then, but it is still asynchronous difficult to predict - and that's what the code tells us.

    But okay, if there is not possibility to synchronize the ADCs by hardware I have to find a way to solve the problem in software.

    Thank you.

    Jakob

     

  • Jakob,

    I understand the hesitation to do so in the ISR. But you really shouldn't be having any wait time at all.

    Another way of doing so would be to use the DMA h/w triggered by the conversions. Or optionally with channel chaining. Though not perfect, this may be a cleaner solution.

    Regards,

    Abhishek