Problem when I try to implement a delay (Timer)

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

Problem when I try to implement a delay (Timer)

763 Views
JonAnder_Amante
Contributor I

Hi,

I am trying to implement a TestDelay but I don´t achieve nothing. I want a bucle that stay on it for 10 seconds. I have added diferent functions but I don´t achieve my target. I have also sent the configuration of the clocks. I want to enter to the bucle and if I push the button in this time, the variable "result" is True. 

The problem is that the I don´t know the number I have to implement in "TestDelay()". Moreover, the function makes different stranges things because comes to "Boot_IsRequest" function. I need a reply as soon as possible as I have to send the project very soon. 

 

Thank you for all,

JonAnder_Amante_0-1715934354426.pngJonAnder_Amante_1-1715934403853.png

JonAnder_Amante_2-1715934753560.pngJonAnder_Amante_3-1715934765412.pngJonAnder_Amante_4-1715934779716.pngJonAnder_Amante_5-1715934788421.png

 

 

0 Kudos
Reply
6 Replies

721 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @JonAnder_Amante,

This SW delay will never be precise, it depends on many things.

ARM does not specify execution time of the instructions, there is the cache, etc.

The compiler can optimize it out.

Have you considered using a HW timer?

 

BR, Daniel

0 Kudos
Reply

711 Views
JonAnder_Amante
Contributor I

Hi,

I want a timer each 1 second, I don´t know how I have to implement a timer through Hardware. Could you give me the steps to achieve the purpose. You must take into account I want to use with the functions that I sent you previouly. 

Thank you for all, 

0 Kudos
Reply

703 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @JonAnder_Amante,

If you use RTD driver, you can use the system clock for it. The drivers use OSIF for timeouts. There are APIs like OsIf_GetCounter().

Or the RTC can be used.

It depends on what precision you need.

What is the delay in your project now? Can you use GPIOs to measure it?

 

BR, Daniel

 

0 Kudos
Reply

678 Views
JonAnder_Amante
Contributor I

Hi, 

I haven´t achieved the purpose of the interrupt. I have two questions.

1. Could you take me steps ta achieve the target, I can´t look the gpios with the oscilloscope. 

2. Another important point is that finally I want to do a change. I want to check that I have received a specific message trough CAN. I have tried different options with the function receive but I can´t check nothing because the PCAN appear as BUSHEAVY. Could you take me steps to check if the pc is receiving this message "04 31 01 F5 18" (The message is sent through PCAN).

 

Thank you for all,

0 Kudos
Reply

654 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @JonAnder_Amante,

Regarding the CAN, please create a new thread.

 

Thank you

0 Kudos
Reply

642 Views
JonAnder_Amante
Contributor I

Hi, 

I have created a new thread.

I hope your answer as soon as possible.

Thank you for all,

0 Kudos
Reply