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.

LP-EM-CC2340R5: No support in SysConfig to configure event/triggers between peripherals

Part Number: LP-EM-CC2340R5
Other Parts Discussed in Thread: SYSCONFIG, CC2340R5

Tool/software:

There is no configuration accessibility provided in Sysconfig version 1.21.1 to configure the events from peripherals  to trigger subscriber peripherals.
If there is any way(other than direct peripheral register configurations) to do this, please share.
Example : I need ADC to be triggered by the timer.    

  • Hello, 

    Thank you for reaching out. 

    For the moment, ADC trigger is not supported by the LGPTimer on CC2340R5. 

    I would suggest you reference the Periodic timer example available in the timer driver doxygen https://software-dl.ti.com/simplelink/esd/simplelink_lowpower_f3_sdk/8.20.00.119/exports/docs/drivers/doxygen/html/_l_g_p_timer_l_p_f3_8h.html 

    I hope this will help,

    Best regards, 

  • Oh. Ok.

    For my requirement, 
    "Configure the periodic timer interrupt -> get an interrupt from timer -> Trigger the ADC (single shot) in the same ISR -> get a periodic ADC reading"

    Is this what you mean ?


     

  • Hi, 

    For my requirement, 
    "Configure the periodic timer interrupt -> get an interrupt from timer -> Trigger the ADC (single shot) in the same ISR -> get a periodic ADC reading"

    Here is a code snippet you can consider. I basically took the empty example, added in sysconfig one ADC and one LGPTimer instance (I kept the default naming). Then I replaced all the content of empty.c with the following: 

    /*
     *  ======== empty.c ========
     */
    
    /* For usleep() */
    #include <unistd.h>
    #include <stdint.h>
    #include <stddef.h>
    
    /* Driver Header files */
    #include <ti/drivers/GPIO.h>
    // #include <ti/drivers/I2C.h>
    // #include <ti/drivers/SPI.h>
    // #include <ti/drivers/Watchdog.h>
    
    /* Driver configuration */
    #include "ti_drivers_config.h"
    
    #include <ti/drivers/timer/LGPTimerLPF3.h>
    #include <ti/drivers/ADC.h>
    
    ADC_Handle adcHandle;
    LGPTimerLPF3_Handle lgptHandle;
    
    volatile uint_fast16_t adcValue;
    
    void timerCallback(LGPTimerLPF3_Handle lgptHandle, LGPTimerLPF3_IntMask interruptMask) {
      // interrupt callback code goes here. Minimize processing in interrupt.
      ADC_convert(adcHandle, &adcValue);
    }
    
    /*
     *  ======== mainThread ========
     */
    void *mainThread(void *arg0)
    {
        ADC_init();
        // initialize optional ADC parameters
        ADC_Params adc_params;
        ADC_Params_init(&adc_params);
        adc_params.isProtected = true;
        // Open ADC channels for usage
        adcHandle = ADC_open(CONFIG_ADC_0, &adc_params);
    
        LGPTimerLPF3_Params lgpt_params;
        uint32_t counterTarget;
        // Initialize parameters and assign callback function to be used
        LGPTimerLPF3_Params_init(&lgpt_params);
        lgpt_params.hwiCallbackFxn = timerCallback;
        // Open driver
        lgptHandle = LGPTimerLPF3_open(CONFIG_LGPTIMER_0, &lgpt_params);
        // Set counter target
        counterTarget = 48000 - 1;  // 1 ms with a system clock of 48 MHz
        LGPTimerLPF3_setInitialCounterTarget(lgptHandle, counterTarget, true);
        // Enable counter target interrupt
        LGPTimerLPF3_enableInterrupt(lgptHandle, LGPTimerLPF3_INT_TGT);
        // Start counter in count-up-periodic mode
        LGPTimerLPF3_start(lgptHandle, LGPTimerLPF3_CTL_MODE_UP_PER);
        // Generate counter target interrupt every 1 ms forever
    
        while (1)
        {
            sleep(1);
        }
    }
    

    I hope this will help,

    Best regards,