While changing from one mode to another, the MCG module needs to wait some clock cycles for the clock mode to set in (as given in the Reference manual).What I want to know what number of cycles do we need to wait? I cant exactly use an endless while loop. I want to have a back up resort which would reset the module and re-call that function for changing the mode in MCG. But for that, I need a number (number of clock cycles to wait) and the rationale behind it. For OSC module, the reference manual has given the wait time of 4096 clock cycles but no such thing for MCG.
Hi Abhishek Sinha,
Yes, the MCG mode transfer time didn't list in the datasheet.
But, I think if you need it, you can test it on your side.
Take an example, use an GPIO output the signal, then use the loop code at first, just check the MCG mode change time with GPIO and the oscilloscope, test it a lot of times, then add some time margin, you can use that time as the time you need to wait the MCG mode transfer finished.
Before you call the MCG mode transfer, you can set the GPIO to low, when you call the MCG mode transfer API ouput the GPIO to high, after the MCG mode transfer finished, set the GPIO to low again, then you just need to check the high pulse time in the oscilloscope, it is very simple to test it on your side.
Wish it helps you!
If you still have question about it, please kindly let me know
Kerry
-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------