2019-09-25 08:58 PM
I need sine modulated PWM during +ve half cycle of sine wave and zero output during -ve cycle of sine wave. Desired samples of sine are 200. I have attached the MATLAB simulation circuit snapshot. Problem is that I am getting 5Hz freq.
2019-09-26 03:19 AM
There's probably nobody here who could answer MATLAB-related questions.
Are you sure your system clock is 84MHz as you expect? Output system clock onto a MCO pin and observe.
JW
2019-10-16 07:29 AM
Hi @VSira ,
It will be nice if you could share your project (*.slx + *.ioc).
Thanks in advance.
Regards.
Cyril
2019-10-25 02:02 AM
Hi @VSira
,
Some precautions should be taken for sampling times in a complex model.
- check the value of the fundamental sample time.
Be aware that if it is set to 'auto', it will be implemented at 0.001 s.
Therefore, as an hint, set the exact value (I am not sure that 0.0001 s will allow a correct execution, depending on the CPU frequency of the device).
Set Timebase Source in the STM32CubeMX projet to TIMER. (SysTick is used for "stepping","profiling" the Simulink model).
- Re-adjust your model from 0.001 s for the fundamental value of the sampling time and set the sampling time of the Sine Wave source.
Check if overrun happens in the execution loop in the main() function.
Hoping that this gives leads to investigations.
Regards.
Cyril