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.

PWM on Sensor Controller on CC26xx

Hi TI,

I have a question about the ability to creating the PWM on built-in sensor controller. I didn`t see any timers in it. So I guess it's impossible to make a low power PWM with frequency is about 200 kHz on CC26XX?

Maybe I can create the PWM on sensor controller using delays_us functions? What about the power consumption of this method? If I understand correctly, creating the PWM on the main Cortex-M3 core cause increasing power consumption by 550 uA because the controller can not enter Standby mode?

So I guess it's impossible to make a table

  • Hi Anton,

    There is no dedicated PWM or timer hardware modules within the sensor controller, but depending on your needs, you may be develop a software PWM. Waveform generation is listed as a potential use-case in the datasheet in section 6.4. To develop sensor controller code, download sensor controller studio, and follow the tutorials in there.

    Using the CM3 PWM module would use more power because there are certain power domains of the CPU that must remain on to run the peripheral.

  • Well, I`ve already downloaded the Sensor Controller Studio but I have not seen any example code for waveform generation. I suppose that the software PWM should be created using the delay_us function and not using the RTC tasks in Sensor Controller.

    I have not seen

  • Now I`m working on PWM on the Sensor Controller and I have noticed that it is impossible to do a infinite loop in the sensor controller. That why it is possible to do a time ended PWM, isn't` it?
  • Hello Anton,

    It is not impossible to do an infinite loop on the sensor controller, this feature is supported. Take a look at the UART example within the Task Code Language reference document (this can be found in the right toolbar in sensor controller studio).

    There are no examples for PWM on the sensor controller, but I can get you started in the right direction.
    There are two things to keep track of the a PWM waveform: frequency and duty cycle.
    Here is some pseudocode:
     
    Note that this isn't a comprehensive code solution, there may be some corner cases I'm missing, but just something to get you started.
    If precision isn't of highest importance, this should be a way to drive a PWM signal in low power mode.

    procedure do_PWM(my_frequency, my_duty_cycle)
        freq_counter = my_frequency
        duty_cycle = my_duty_cycle
    
        loop forever
            freq_counter++
    
            if (freq_counter == duty_cycle)
                GPIO_TOGGLE
            end if
    
            if(freq_counter == my_frequency)
               freq_counter = 0
            end if
    
            DELAY
        end loop
    end do_PWM