0

I have a microcontroller from based on an Evaluation Kit of Texas Instruments. There is a vibration motor which is being activated with following code:

handle = ClipPWM_open(PWMI_MOTOR, &pwm_params); PWM_start(handle); uint8_t intensity = 100; PWM_setDuty(handle, intensity * 155) (PWM.h reference TI)

My task is to develop a function which will activate the vibration motor and start from X and ends at Y. This is executed in a specified amount of ticks.

Firstly, I tried to enable the motor, set the intensity (e.g. 10), wait using a for loop until half of ticks were reached. After that I added the intensity setting to another value (e.g. 100) to wait again using a for loop.

This won't work. the intensity of 10 (the first) is being ignored and it only executes the intensity of 100.

I'm new to these topics. Do I have the wrong approach?

  • 1
    Reading `PWM_setDuty` doc, it seems that an error has occurred: " If an error occurs while calling the function the PWM duty cycle will remain unchanged." Can you retrieve the error? – ferdepe Oct 28 '18 at 19:48
  • @ferdepe Hello, no unfortunately not. It returns PWM_STATUS_SUCCESS (0) at any time. –  Oct 28 '18 at 20:00
  • Use an oscilloscope to see whether there is a PWM at all. It may be that a level of 10 is in the dead-band of the motor - i.e. insufficient to overcome the motor's inertia and friction. – Clifford Oct 28 '18 at 23:14
  • What does `ClipPWM_open` do? The link provided documents `PWM_open`. – Clifford Oct 28 '18 at 23:18
  • What are the values of the `pwm_params` members? The question is unanswerable without knowing how you configured the PWM, because the `intensity` argument semantics depend upon that. – Clifford Oct 28 '18 at 23:26
  • Post a [mcve]. Your code doesn't show the calls to `PWM_init` and `PWM_Params_init`. You also don't have the delay you mentined. You also don't check if `handle` is `NULL` after `PWM_open`. Also, it's unclear what `ClipPWM_open` is, this function is not mentioned in the link you posted. Right now, this question is unanswerable. – vgru Nov 06 '18 at 08:32

0 Answers0