cancel
Showing results for 
Search instead for 
Did you mean: 

adc external trigger

elec_st
Associate III
Posted on March 23, 2017 at 12:06

i search in google and i can't find any adc external trigger example code i found timer trigger only.

i want adc start conversion when external  pulse found.

i want any example code

10 REPLIES 10
Imen.D
ST Employee
Posted on March 23, 2017 at 12:16

Hello,

Which device are you using ?

To have more insight into ADC applications, I recommend you to check the ADC example in the Cube package relevant to the device that you are using.

E.g  for STM32CubeF3 firmware package:

STM32Cube_FW_F3_V1.6.0\Projects\STM32303E_EVAL\Examples\ADC\ADC_TriggerMode

This example describes how to use the ADC and TIM2 to convert continuously data from ADC channel.

You have to follow your reference manual  in section Analog-to-digital converters (ADC)

Hope this help you.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on March 23, 2017 at 12:57

i use stm32f103

you say example use ADC and TIM2 . i not want to use timer.

i want when external pulse coming i want enable adc start conversion

 i use only one adc channel0.

reference manual give me adc Artitecture  but  i want how to use it in c/c++ code example.

elec_st
Associate III
Posted on March 23, 2017 at 15:11

ok,

the problem not in google the problem in stm32 support not give us enough example

atmel and microchip give you  all peripheral examples .

stm32 i spend alot of time to make peripheral work.

i make adc1 external triger.

 hadc1.Init.ExternalTrigConv = ADC_EXTERNALTRIGCONV_EXT_IT11;

but when i put a pulse the adc not start conversion .

   if (HAL_ADC_PollForConversion(&hadc1, 1000000) == HAL_OK)

        {

           value= HAL_ADC_GetValue(&hadc1);

        }

adc not start conversion

Posted on March 23, 2017 at 14:12

Engineering is not about finding solutions on the Internet.

For Google to have an example, someone would have to write one and post one, without the help of Google.

Configure a TIM in Input Capture such that TIMx_CCx matched one of the external trigger settings for the ADC. Find an example in the SPL of doing Input Capture, and modify it, and merge into your ADC code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 23, 2017 at 15:30

... the problem in stm32 support not give us enough example

This is not a ST support hotline here, but a public forum.

The former will charge you for their help, while you can't 'demand' solutions from the latter.

There are many examples to trigger the ADC by hardware (Timer). And there are many examples on how to config a GPIO.

Shouldn't be too difficult to combine both.

atmel and microchip give you  all peripheral examples .

I need to agree with Clive - embedded engineering is not about finding almost complete solutions with google.

You might soon come across a vendor like Cypress, without any public forum at all.

Posted on March 23, 2017 at 16:08

>>

stm32 i spend a lot of time to make peripheral work.

You might want to review how you approach problem solving. Apply some man-hours to understanding the hardware via the documentation, and provided examples. The people writing the examples don't have some magical talent.

>>

the problem in stm32 support not give us enough example

I think ST assumes that businesses using their chips will hire an engineering roster of their own.

What kind of hourly rate would you be willing to pay for support and examples tailored to your specific needs?

>>

atmel and microchip give you all peripheral examples.

Then use their parts, or apply the knowledge from those examples to other platforms, most of this stuff is more similar than dissimilar.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
juozas
Associate III
Posted on April 17, 2018 at 13:26

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6tX&d=%2Fa%2F0X0000000bxX%2FGEOdNYYEbyqqptcJL980B8wdoL9jF4IB92IFMQNrpK8&asPdf=false
anaeb.1
Associate III

I know it's been a long time but have you found any solution for this ? i have the same problem...

Yes, you use the plumbing of the TIM's to take an external input, perhaps time-stamp it, but having the knock-on effect of triggering an ADC sample.

ie if you can use TIM2_CH2 as an ADC Trigger, do an Input Capture on a TIM2 Channel 2, have TIM2 maximal and free-running, and wire your trigger to the external pin associated with TIM2_CH2. This isn't rocket science

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..