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 Continuous Conversion Using HET

Other Parts Discussed in Thread: HALCOGEN

Hi,

I am very new to the 570 chip and am attempting some sample programs and modifications with the USB Dev kit.  I have successfully used the sample light sensor program with the ADC.  I am now attempting to use the NHET to set up the system where the ADC is automatically triggered and values converted, instead of the software trigger.  I basically want to read the adc automatically at a known rate using the HET.

I think I understand the procedure using HalCoGen.  I have set up the Fifo size to 16 bytes and set up the adc to trigger with HET19 and a hardware trigger, along with continuous conversion.  I have enabled PWM7 which is pointed to that pin.  

I have modified the sample code for the light sensor to include the het.h file and initialized the het.  I think, at that point, I should only need the adcGetData function to retrieve the converted values from the Fifo.  However, in the terminal, I get the same value over and over, as if the ADC is not being triggered.  

Am I missing settings in the HalCoGen program?  Or anything else I seem to be missing or setting incorrectly? 

Thanks in advance.

 

 

  • I did not see anything wrong in your description. 

    How fast is your PWM?

    Did you use ADC complete interrupt to read out the data?

    One possibility is that: The ADC data does not get processed in time and the ADC buffer overflowed.

    Regards,

    Haixiao

  • Haixiao Weng said:

    How fast is your PWM?

    I have tried several speeds, from 2000 uS period (50% duty cycle) to 100uS (50% duty cycle)

    I am not sure what you mean by "ADC complete interrupt".  Do you mean the group conversion end interrupt mentioned in the manual? I have not yet figured out how to initialize these in the program.  I currently have the while loop that comes with the sample and am using the adcGetData function as fast as the loop will go.  (with the knowledge that the loop will possibly be faster than the sampling rate and the intention to fix the timing/interrupts once I can read data from the adc).  I am not currently using an interrupt I don't think.  In addition, the result of the count variable returned from the adcGetData function is turning out to be zero.  

     

  • Can you publish the sys_main.c and adc.c? I can take a close look.

    Regards,

    Haixiao

  • Haixiao Weng said:

    Can you publish the sys_main.c and adc.c? I can take a close look.

    Regards,

    Haixiao

    Sure.  Thanks much.1122.TMS570 MibADC.zip

     

  • Please change:

    adcREG1->GxMODECR[1U] = ADC_12_BIT

    | 0x00000000U

    | 0x00000008U

    | 0x00000002U;

    to

    adcREG1->GxMODECR[1U] = ADC_12_BIT

    | 0x00000000U

    | 0x00000008U;

    And try it again. If it does not work out, send me the whole project.

    haixiao.weng@ti.com

    Regards,

    Haixiao

  • Here is the summary:

    1. If you use the hardware trigger mode, you still have to write to the Channel select register once. adcStartConversion() in HalCoGen. Otherwise, the ADC does not which channel to be converted. The difference from software trigger is: in software trigger mode, after you write to the channel select register, the conversion starts immediately (after some VCLK cycles); in hardware trigger mode, after you write to the channel select register, the conversion still has to wait for the trigger signal to start. In software trigger mode, if you want to do the conversion over the same channels again, you have to write to the channel select register again. However, in hardware trigger mode, you don't need to write to channel select register again, what you need to do is to provide the trigger signal again.

    2. If you use the PWM to trigger the ADC conversion, it is better to use the single conversion mode. I don't know what will happen if you keep trigger a continue ADC conversion.

    3. After I fixed these two questions, I found the SCI is slow (9600) while the ADC conversion rate (HET PWM frequency) is very fast. Therefore, the ADC doesn’t have enough time to process the data. I slow down the PWM rate to make it work.

    Regards,

    Haixiao