Hardware timer problems while setting timer through a task using FreeRTOS in i.MX7

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hardware timer problems while setting timer through a task using FreeRTOS in i.MX7

1,637 Views
harish_g
Contributor III

I am using RPMsg tool to communicate between the A7 and the M4 cores of  i.MX7 . My objective is to send commands from A7 to M4 via RPMsg , and perform the respective operation by parsing the command . Inorder to acheive that , i am using an task which parses the command and invokes the respective function as a seperate task . For testing i used , led toggle as one of the commands . So when i send blink through RPMsg , a particular GPIO should start to blink . When i tried this with software timer APIs , the expected result was obtained . But when i tried to configure the hardware timer to produce the delay , it gets stuck before setting the Oscillator prescaler setting of the timer . Both A7 and M4 stops responding after this . I used the timer part in the blinking_imx_demo example provided by FreeRTOS . When i create the task in parallel with the base command parser task , it runs properly until linux boots , after which the blinking process gets stuck . I have verified the device tree entries and the timer i used is disabled for linux . 

Any more information needed ? How to correct this problem ? 

Update : 

While trying out the demo blinking_imx_demo application , the blinking stops/ hangs heavily after the kernel boots up . The device trees have GPT3 and GPT4 disabled . What am i doing wrong or not doing ?

Labels (1)
Tags (2)
0 Kudos
5 Replies

969 Views
harish_g
Contributor III

Hi ,

      This is to inform that the apparent problem is rectified now .The problem was as we expected with the clocks . But it was not the problem we expected . It seems ,it is necessary to ensure that the module clock frequency after the Oscillator predivider , is less than or equal to half of the peripheral clock frequency . It is mentioned somewhere in the comments in the source code of the GPT driver .So if the peripheral clock is 24 MHz and the module clock is also 24 MHz , the Oscillator predivider must be atleast 1 ( Which will ensure that Module clock = 24 MHz is divided by 2 ) , so that module clock after the Oscillator predivider is exactly half of the peripheral clock satisfying the conditon . After ensuring this , I tried running with 4 to 5 different delays and it seems working for now . 

        But still , If this is the problem , then why did the program run without any problems , while linux is not booted ? Is there any interaction between them ?

Regards ,

G.Harish

0 Kudos

969 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Harish,

- Are you able to use the timers without RPMsg running and without your parser? If yes how are you running this test and how are you integrating the parser?

- Are you using the .dtb file for the M4?

Carlos

0 Kudos

969 Views
harish_g
Contributor III

1. Like i mentioned in the question itself , i am able to use the timer properly without linux booting . The parser comes into play only after linux boots up . Without the parser also , timer stops instantly near the instant of password prompt in linux . I ran and verified the parser by using software timer APIs and it works as expected . 

2. Yes , i am using the .dtb file that was given for M4 core integration . imx7d-sdb-m4.dtb . I decompiled the dtb and verified that the timer 3 and 4 which M4 uses is not enabled in the device tree .

0 Kudos

969 Views
Carlos_Musich
NXP Employee
NXP Employee

Hello harish,

it is possible that the M4 is setting clocks and when A9 starts Linux they are reconfigured. Please see the following thread.

I.MX6 SoloX M4 Problem 

Please also consider the recommendations here.

https://community.nxp.com/thread/454070 


Regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

969 Views
harish_g
Contributor III

Hi Carlos ,

                     I saw the above mentioned links . The things that were suggested in both the threads , were almost covered in the Official documentation of NXP . I have already tried things like adding uart_from_osc to the bootargs , and using the kernel device tree provided for M4 core ' imx7d-sdb-m4.dtb' . I have also checked the RDC registers values and all of them seem to comply with what they mention .

                     A recent observation though , We tried running the hardware timer with a low speed clock ( i.e. 20MHz ) , when compared to the previous one which used 392 MHz . In that case , when i try to set the Oscillator prescaler value to some value like 10 or 15 , instead of properly calculating those values, the timer runs properly and the messages are sent peridically , even when linux boots . But whenever we set the value by calculating , which happens to be 0 , the timer gets interrupted by linux boot .

                     We are suspecting problems with the root clock clashing with the clocks that linux environment configures . I ll keep this thread updated if i observe any improvements .

Regards ,
G.Harish

0 Kudos