Jump to content
Sign in to follow this  
krishnat

using TIVA C tm4c123gh6pm ADC with Comparator and uDMA

Recommended Posts

Problem:


I have one pulse as shown in fig. Pulse width is 10 to 25 us. But next pulse will come after 100 ms.


I need to find peak of each pulse. I have reference peak value. I need to generate error send to DAC module.


post-49945-0-17675900-1485752285_thumb.jpg


FIG.1


 


In my current code,


If I take one sample and check whether peak or not, and calculate error send to DAC,


this code takes 35 us time.That means pulse is gone.


How should I tackle this situation 


post-49945-0-25242100-1485752301_thumb.jpg


FIG.2


 


I have one solution, I want suggestion from you , whether it is feasible or not??


ADC0 and ADC1- same pulse as input


ADC0-Comparator


ADC1-uDMA module


I will configure my ADC0 module for digital comparator for HIGH band in always mode.


I will start my uDMA module to store ADC1 samples until my comparator output is High.


Once comparator output is LOW, I will start find peak out of stored samples & generate error send to DAC module.


Share this post


Link to post
Share on other sites

First of all, welcome to the forum!

 

Sometimes doing things in the analog domain can be a viable option. Your requirements said "peak detector" to me when I read them. See the links below for some info on peak detectors and you may be able to find integrated solutions from the likes of TI, Analog Devices, Maxim, LTC, etc.

 

http://www.planetanalog.com/author.asp?section_id=396&doc_id=562072

 

http://electronics.stackexchange.com/questions/57866/how-to-sample-and-hold-on-very-narrow-pulse

Share this post


Link to post
Share on other sites

Till date my problem is solved.

In my application pulse with is 100 us now, so no need to go for Comparator and uDMA.

Simply ADC in continuous sample mode, take sample and check tricks worked. 

 

I wrote code in DRM style .(direct register assignment method)

I know only about ADC , timer as I used these modules only.

 

I want to learn API style coding using tivaware. How do I start..?

there are many doc and videos that talks about how to install tivaware, CCS or IAR workbench.

there is pdf by TI ->  ' TivaWare

Share this post


Link to post
Share on other sites

Hi ,

which systemclock should I configure with ADC & timer module ( I am using both module in same code)..??

SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); freq = SysCtlClockGet(); // 80MHz
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); freq = SysCtlClockGet(); // 50MHz
SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); freq = SysCtlClockGet(); // 40MHz

If I dont write any of above, I get :: freq = SysCtlClockGet(); // 16MHz

My requirement is lowest execution time.
Should I configure to 80MHz..?? 

If I do so will both ADC and Timers will work fine..??
Is any extra configuration needed...?



Regards,
Krishnat

Share this post


Link to post
Share on other sites

post-49945-0-42823500-1486379713_thumb.jpg

 

According to datasheet, if I set system clock 16 Mhz then only for 1msps setting, conversion time will be 1us.

 

What will be conversion time if I set System clock 40 Mhz, 1msps setting..?? OR

What will be conversion time if I set System clock 80 Mhz, 1msps setting..??

What will be conversion time if I set System clock 40 Mhz, 1msps setting..??

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...