2024-08-11 10:11 PM - edited 2024-08-18 04:32 AM
I am transfering data array from an array to PWM register of TIM1.
int16_t sin_table[20]= { 0, 39, 77, 113, 147, 177, 202, 223, 238,247, 250, 247, 238, 223, 202, 177, 147, 113, 77, 39};
HAL_TIM_PWM_Start_DMA(&htim1, TIM_CHANNEL_1, (uint32_t *)sin_table, 20);
And i am trying to blink in complete transfer callback fuction as follows .
I am getting PWM signal as expected . but trigger the TransferCompleteCallback).
by using break poiint the DMA Inerupt Handler triggers but not trigger the callback i said .
whats the wrong am with please help me .
i am attaching the full code here
aNY BODY HELP ME
Solved! Go to Solution.
2024-08-20 10:43 PM
You still have not understood what both MM and I have already explained to you. I'm sorry, but I just can't explain it any more clearly than I already have.
2024-08-21 01:27 AM
Oh okay i got and corrected it as follows
void PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim)
{ if (htim->hdma[TIM_DMA_ID_CC1] != NULL && htim->hdma[TIM_DMA_ID_CC1] == &hdma_tim1_ch1)
{
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
}
}
htim1.PWM_PulseFinishedCallback = PWM_PulseFinishedCallback;
I get Triggered as expected .
But I have two problems as follows
The DMA array size is 20 elements.
Total Transfer Time=506 µs×20=10.12 ms (as per pwm SIGNAL )
See the picture
why some red marked area is it continously (blue is the transfer complete callbak led toggeling signal ) ?
Also see the picture below
Here the blue line is the DMA complete trigger there take an 8 usecon ow to reduce it from the pwm
2024-08-21 03:38 AM - edited 2024-08-21 03:44 AM
Please use the code highlight block for showing code, it's "</>" on the posting toolbar. And ask new questions in a new thread, since your issue has been solved.