Hello,
I am using PLL as my CORE_CLK at 160mHz. I have a PWM period of 10000. When I measure the PWM output, I am getting16.131kHz. I am not sure where 131Hz are coming from. Any thoughts? Thanks!
I have to write all bare-metal code for my project. This is the initialization code I followed:
Except SET(PLL_PLLODIV_DIV(2u)) which I had to set to 1u, otherwise I was getting 10.4kHz.
解決済! 解決策の投稿を見る。
Hi Vusal,
Please refer to the attached bare-metal project. But please note that my development board uses 16MHz Crystal, so the PLL configuration is different from yours. PLL output 160MHz. PTD14(CLKOUT_RUN) output 160MHz/(7+1)=20MHz. (The Pad Type of PTD14 is standard plus switching up to 25MHz). PTA1(eMIOS0_CH9) output 16kHz PWM.
Best Regards,
Robin
Hi Vusal,
Please check the frequency of CORE_CLK by CLKOUT_RUN pin.
For the formula of PWM frequency, please refer to S32K344 hardware PWM frequency. What value did you assign to B1?
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi @Robin_Shen ,
Thank you for your message.
I am using S32K3-T-BOX. I checked PTD14 pin which is located on Wifi (UART) pin, and for some reason it reads zero Hz. I have MSCR[110] configured for OBE, DSE, and SSS (0x07). I have also configured MUX_6_CSC to CORE_CLK (1_0000b) and can confirm in the MUX_6_CSS that the MUX is working correctly. MUX_6_DC_0[DIV] I left at default.
Regarding your question about B1, in my PWM output, B is my duty cycle value and does not affect the frequency (period) when I change it.
Thank you,
Vusal
If you use S32DS+S32K3 RTD, it may be more convenient to use S32 Configuration Tool.
Hi @Robin_Shen ,
Thank you for your reply.
Unfortunately, I can't use RTD and have to stick to bare-metal. I am in the aviation industry, and we can't use third party API's.
It seems like I should be able to configure correct frequency using PLLDV:
Thanks,
Vusal
Hi Vusal,
Please refer to the attached bare-metal project. But please note that my development board uses 16MHz Crystal, so the PLL configuration is different from yours. PLL output 160MHz. PTD14(CLKOUT_RUN) output 160MHz/(7+1)=20MHz. (The Pad Type of PTD14 is standard plus switching up to 25MHz). PTA1(eMIOS0_CH9) output 16kHz PWM.
Best Regards,
Robin
Hi @Robin_Shen ,
At last, we were able to get a clean 16mHz clock frequency on PLL. We changed the values around a bit for ODIV2, RDIV, and MFI bits in the PLLDV register.
Thanks for your help again.
Vusal
Hi @Robin_Shen ,
Thank you very much for this. I'll take a look.
Best,
Vusal
Hi @Robin_Shen ,
I ran a few configurations; however, it seems that PTD14 on T-Box maybe not feasible for CLOCKOUT-RUN? I could not get PWM or CLOCKOUT-RUN show up on this pin. Would it be because it is tied to a reset?
Thanks,
Vusal
Did you connect ESP8266? If not, I don't think it was the problem.
Please check the values of the relevant registers mentioned before to confirm whether they are configured correctly. Also, is the PWM frequency accurate after referring to the project I gave? Have you measured the frequency of crystal and is it accurate?
Hi @Robin_Shen ,
Thanks for your message.
I have not connected ESP8266. Only GPIO shows up on PTD14. On adjacent pins, I can generate PWM, but not on PTD14.
PWM frequency is a bit off. For example, when I switch to PLL(160mHz) it shows 16131kHz with 10001 period. On FIRC (48mHz), it shows 4.836kHz.
For some reason, I can't run your project directly on my environment. I used your project as a reference and set the registers. I have checked the register values, and all seems correct to me, but maybe I missed something while configuring the PWM settings? Is there a particular pin that can measure the crystal, or do I need to hold a probe to it?
Thanks!
Vusal