Hi,
I have a question about the clock of s32k144. If I select the slow run mode I chose as clock FIRC clock that means CORE_CLOCK, BUS_CLOCK and SYS_CLOCK equal to 48MHz. So in my code I configured the ADC. In particular, the clock of ADC:
At the same time in my code I configured the CAN-Bus. The CAN has as clock SOSCDIV2 (NormalRunMode). The configuration of CAN and its clock:
To measure the Core Clock Cycles of ADC, I used the library #include <elapsed_time.h> and the functions: void elapsed_time_init(), void elapsed_time_start (uint32_t i), void elapsed_time_stop(uint32_t i).
In the main function, to quantify the time interval, necessary to have the conversion of ADC, I wrote (yellow line):
So if the difference is 992 and for the fact that there are configured both SlowRunMode and NormalRunMode, what could I do? I perform the ratio between 992 and 48MHz for the fact that the ADC works with FIRC clock?
It is possible to configure FlexCAN in order to have as clock FIRC clock?
Thanks for your help.
Sorry if this question is trivial, but I don't comprehend well the clock of the board.
Best regards,
Paola
Hi Paola,
The SlowRunMode and MormalRunMode are not modes of the MCU.
The MCU has the following run modes: RUN, HSRUN, VLPR.
If you use DWT to measure the execution time and the count difference is 992, then the elapsed time is 992 / CORE_CLK (SYS_CLK).
But it has nothing to the with the ADC clock.
The FlexCAN module can use either SYS_CLK or SOSCDIV2_CLK.
Regards,
Daniel