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.

Hercules TMS570LS1224 ADC Halcogen configuration

Other Parts Discussed in Thread: HALCOGEN

Hi

I'm configuring the ADC to convert some data from a pressure and I need to read the data every 378ms. I have some question on this topic. 

first: 

what is that cycle time?? What does it do?? is the sampling time for the ADC?? (I changed from 800 to 100)

second:

Here I have the configuration for Group1. Im going to use those pins. 

Here I have 4 questions:

a) The FIFO size. If im going to only use those 6 channels, should I just write 6 in there?? because thats what the message says when putting the mouse in there (BTW it has a typo)

b) What could work better for me? Use a continuous conversion and read the data every timer compare? or just call the START_CONVERSION function from timer compare and wait for the data to be ready on GROUP1 interrupt and STOP_CONVERSION?? 

c) About the ID. Why do I need that?? The ADC doesnt go from channel 0 to channel N?? or the scanning is random? I saw on the example that it was used adc_data[0], so I assumed that the ADC scans all the pins and save the data on the corresponding location... If the ADC actually saves the data from channel 0 on [0] and channel 1 in [1] why would I need the ID?? 

d) If using continuous conversion for both, Group1 and Group2 is possible for what I read on TMR, but just to make sure I understand: The Group1 is high priority compared to Group2, so first convert Group1 and when finishes all the channels, starts with Group2 right?

Third question:

Here we have the memory configuration. BNDA corresponds to Group1? or for Group event?? What this part does?? what is BNDA and BNDB?? why 2*N there?? Im guessing 64 is the maximum words I can save inside the FIFO right??

Fourth question:

I read on TMR that when FIFO is full, a flag is turned and I have to reset FIFO right? but I could reset it every time I get the data no?? of FIFO is cleared when using adcGetData()???

Thanks for the answer in advance!!!

 

  • what is that cycle time?? What does it do?? is the sampling time for the ADC??

    Cycle time is the period of the ADCCLK. The ADCCLK is the reference clock by which it uses to operate the conversion. See below description about the sample window from the TRM. SW is the sample window which is also named sample time in the HalCoGen GUI.

    Group1 Acquisition Time. These bits define the sampling window (SW) for the Group1 conversions.
    SW = G1_ACQ + 2 in terms of ADCLK cycles.

    a) The FIFO size. If im going to only use those 6 channels, should I just write 6 in there?? because thats what the message says when putting the mouse in there (BTW it has a typo

    If you want to generate interrupt to the CPU after six channels are converted then you should put 6 as your FIFO size.

    b) What could work better for me? Use a continuous conversion and read the data every timer compare? or just call the START_CONVERSION function from timer compare and wait for the data to be ready on GROUP1 interrupt and STOP_CONVERSION?? 

    Both methods are provided. I guess you need to experiment with both to see which one suits your application. I will suggest starting with the adcStartConversion() first for better control.

    c) About the ID. Why do I need that?? The ADC doesnt go from channel 0 to channel N?? or the scanning is random? I saw on the example that it was used adc_data[0], so I assumed that the ADC scans all the pins and save the data on the corresponding location... If the ADC actually saves the data from channel 0 on [0] and channel 1 in [1] why would I need the ID?? 

    No, your understanding is not correct. Let's say the channels you want to convert are 10,11,12,13. The channel 10 will be save in adc_data[0] while channel 13 will be saved in adc_data[3].

    d) If using continuous conversion for both, Group1 and Group2 is possible for what I read on TMR, but just to make sure I understand: The Group1 is high priority compared to Group2, so first convert Group1 and when finishes all the channels, starts with Group2 right?

    Yes, your understanding is correct. All channels in Group1 will be converted first before moving to Group2. See below excerpt again.

    Any of the available analog input channels can be assigned to any of the conversion groups. This also
    allows a particular channel to be repeatedly sampled by selecting it in multiple groups. There is an
    inherent priority scheme used when multiple conversion groups are triggered at once. The Event Group is
    the highest-priority, followed by the Group1 and then the Group2.

    Here we have the memory configuration. BNDA corresponds to Group1? or for Group event?? What this part does?? what is BNDA and BNDB?? why 2*N there?? Im guessing 64 is the maximum words I can save inside the FIFO right??


     

    0 to BNDA corresponds to the size you allocate for the Event group. BNDA to BNDA corresponds to the size for Group 1. BNDB to BNDEND corresponds to the size for Group 2.


    I read on TMR that when FIFO is full, a flag is turned and I have to reset FIFO right? but I could reset it every time I get the data no?? of FIFO is cleared when using adcGetData()???

    Can you quote from the TRM about the FIFO full? I don't understand the question. 

     

  • Hi Charles

    Charles Tsai said:
    If you want to generate interrupt to the CPU after six channels are converted then you should put 6 as your FIFO size.

    This means the adc will trigger the interrupt when it finishes the 6 channels right? the adcGroup1 interrupt

    Charles Tsai said:
    Both methods are provided. I guess you need to experiment with both to see which one suits your application. I will suggest starting with the adcStartConversion() first for better control.

    If set as single cnversion, the adcStartConversion() will only do those 6 conversions and then stop? or should I call the adcStopConversion()??

    Charles Tsai said:
    No, your understanding is not correct. Let's say the channels you want to convert are 10,11,12,13. The channel 10 will be save in adc_data[0] while channel 13 will be saved in adc_data[3].

    ooh ok ok. So... if the channels to convert are selected by me, and I know what I have connected to those pins... and the ADC converts 10 and then the 11 and then the 12 and then the 13 and always is that way... and saves the data in order, why should I use the ID??

    About the memory, then I guess I should leave it that way no? even if Im only using 6 spaces from 16. I guess this is useful when having a lot of conversions in there and I need to change the FIFO size for an specific group right?

    About the last question Im looking for that. 

    Thanks Charles!!

  • Other question. When using two groups, the "adcData_t adc_data[2];" is the same for both?
    I was thinking that the variable would be set to the amount of channels but when the groups start conversion on different times? what happen there?
    thanks!

    update: 

    I was thinking... since the adcGetData has a pointer, I could use this no?:

    adcGetData(adcREG1, adcGROUP1,&adc_data[0]);

    adcGetData(adcREG1, adcGROUP2,&adc_data[6]);

    having the adc_data as a 12 positions array, I would be saying "the Group1 (6 channels) go to the first 6 positions of the array and the Groups2 go to the 6 last positions of the array"

    is that ok??

    Thanks Charles

  • What don't you create two pointers? Like *adc_data1 for Group1 and *adc_data2 for Group2?
  • Hi Charles

    how would that work?? because the function is 

    uint32 adcGetData(adcBASE_t *adc, uint32 group, adcData_t * data)

    how would I do that since the pointer is the same: adcData_t *

    and what about the ID values??

    thanks!

  • adcData_t is a type. It can be any type. The *data is a pointer to the type of adcData_t. It is like a int type and I can declare any number of pointers to the type int. You might want to check out the C language if you are new to pointer operation.
  • I already get it haha
    thanks!!