GPT running under freeRTOS on iMX7's M4 knocked out by Linux running on A7

I found that a GPT running under freeRTOS stops when Linux 2.8 runs. I found a previous post by Stefan.tx that indicates GPTB should not be driven by ccmRootmuxGptSysPllPfd0, which is used by Linux.

Snippet of current failing code:

/* Enable PLL PFD0 for GPTA */
CCM_ControlGate(CCM, ccmPllGateSys, ccmClockNeededRunWait);
CCM_ControlGate(CCM, ccmPllGatePfd0, ccmClockNeededRunWait);

/* Select GPTA clock derived from PLL PFD0 */
CCM_UpdateRoot(CCM, BOARD_GPTA_CCM_ROOT, ccmRootmuxGptSysPllPfd0, 0, 0);
/* Enable clock used by GPTA */
CCM_ControlGate(CCM, BOARD_GPTA_CCM_CCGR, ccmClockNeededRunWait);

And additional time initialization:

/* Initialize GPT module */

/* Set GPT clock source to 24M OSC */
GPT_SetClockSource(BOARD_GPTA_BASEADDR, gptClockSourceOsc);

The fix is supposed to be to use ccmRootmuxGptOsc24m clock instead. But doing this does not result in the timer running at all.

Is there a complete example of using the ccmRootmuxGptOsc24m for GPT use.


Dear @bobpbbd104

An example how to use the 24MHz oscillator for GPT is part of our regular iMX7 git repo. Just look at the folder:

I modified hardware_init.c line 56, to use ccmRootmuxGptOsc24m for GPTB, too.

CCM_UpdateRoot(CCM, BOARD_GPTB_CCM_ROOT, ccmRootmuxGptOsc24m, 1, 1);

Both GPTs work perfectly fine and provide the expected output on UART_B.

Regards, Andy

Thanks Andy. Also found in freeRTOS that the 24m oscillator pre and post divisor settings cannot be 0 as they were for the PLL-based clock. Found 1, 1 so, a total divide of 4. Maybe due to sync block in the GPT diagram.