I try SOM on i.MX8, but has problem: M4 core periodic change performance.
In ours task we programm M4 to generate signal diagramm (by GPIO, inside timer handler). On power on, all is OK. But after Linux loaded to command prompt, I see that diagramm from M4 now more lenght, as if M4 slowly. Lenght increase to 4 times (see photos)
Also I try NXP samples (driver_examples\gpt), and add to timer handler the simple code, for check performance:
int summ = 0 , t1 , t2 ;
/ ********** Code ***** /
void EXAMPLE_GPT_IRQHandler ( void ) {
/ * Clear interrupt flag . * /
GPT_ClearStatusFlags ( EXAMPLE_GPT , KGPT_Output Compare1Flag ) ;
t1 = GPT_GetCurrentTimerCount ( EXAMPLE_GPT ) ;
for ( int i = 0 ; i < 1; i ++ ) { summ + = i ; } // dummy loop
t2 = GPT GetCurrentTimerCount ( EXAMPLE_GPT ) ;
PRINTF ( " time = % d \ n \ r " , t2 - t1 ) ;
/ **************** /
After run, we see that a time the dummy loop is unstable too, like two different "stable" states , about 10 or about 40 (on power on about 10; after load Linux - about 40, but sometimes show 10 again)
Plaese, help me for solve this problem. (sorry for my english)
I understand your question in the following way: You are running a program containing the given code snipped on an M4 core of an I.MX8 system on chip. The program creates a PWM signal by utilizing a general purpose timer. (The system on chip also contains a larger ARM core capable of running linux.)
When only the program within the M4 core runs, then the desired waveform timing is achieved. As soon as you boot linux on the other core, the waveform of the PWM seems to change periodically. It changes from the original waveform to the same waveform, but with a frequency drop of factor 4.
It seems that linux performs CPU Frequency Scaling and/or uses Dynamic Bus Frequencies. This may change the frequency of the clock domain of the M4 clock or at least the clock domain of the general purpose timer used to create the PWM. I think, the latter is the relevant problem origin.
See I.MX Reference Manual sections 2.3.3 and 2.3.4. This manual also lists the following command in order to disable Dynamic Bus Frequencies from userspace. (Make sure you are the root user.):
echo 0 > /sys/devices/platform/busfreq/enable
This should stop periodic changes of your waveform.