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.

TM4C123GH6PM: read adc with trigger by external signal fed to a gpio pin.

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL

Tool/software:

Hello,

I need an example of reading a signal using an ADC triggered by an external trigger fed to the GPIO pin.
I tried the examples but couldn't find what I needed. If anyone has a similar example please share it with me.
I am looking forward to the support of experts.

Thanks,

Hai Lai

  • Hi,

      We don't have an exact example as such. However, you can reference C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c123gxl\adc_udma_pingpong. In this example, the trigger to the ADC is by a periodic timer. If you look at the block diagram, there are several trigger sources for ADC among which are GPIO, Timer, and PWM. You can modify the example from using Timer trigger to GPIO trigger. This example makes use of uDMA for reading the ADC values. If you don't need the uDMA, you can remove code that are related to uDMA.  I will also suggest you try out the C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c123gxl\interrupts example. Get a feel for how interrupts work. You can then reference the interrupts example to generate interrupts to trigger the ADC for your application.

    10.2.2.1 ADC Trigger Source
    Any GPIO pin can be configured to be an external trigger for the ADC using the GPIO ADC Control
    (GPIOADCCTL) register. If any GPIO is configured as a non-masked interrupt pin (the appropriate
    bit of GPIOIM is set), and an interrupt for that port is generated, a trigger signal is sent to the ADC.
    If the ADC Event Multiplexer Select (ADCEMUX) register is configured to use the external trigger,
    an ADC conversion is initiated. See page 847.
    Note that if the Port B GPIOADCCTL register is cleared, PB4 can still be used as an external trigger
    for the ADC. This is a legacy mode which allows code written for previous devices to operate on
    this microcontroller.