How much time will MKL16 take when Check IO high input?

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

How much time will MKL16 take when Check IO high input?

Jump to solution
3,844 Views
jiannianli
Contributor II

Hi ,

I need to wait PTD4 to high  ,and then use timer to do something  .

follows is my code :

TestIO_00;   // Set Test IO  low

//other codes

while((GPIOD_PDIR&0x00000010)==0){};  //wait the PTD4 to High , this code will take different                                                                                     //time, and this is my question

TestIO_11;  // Set Test IO High

//other codes

 

I found that when the PTD4 turn to high ,  the MKL16 take different time to check .  Now the CoreClock is 2MHz   , BusClock is 1MHz .

folows are my two records ,and you can find that the time of check PTD4 high is not same . So, how to make the check time same ?

 
 

 

0 Kudos
1 Solution
3,768 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi jiannianli,

   You can use the FGPIO to control the GPIO output and the read the input, or use the interrupt to read the PTD4 input, it will be more quick than your polling mode.

   In fact, even you just toggle the GPIO output, it will also need the times, FGPIO toggle frequency can reach to the core clock /2.

   Your test result time in fact include two part, detect the PTD4 time, and the GPIO output time. Obout the test IO output time, you can toggle it directly in the code and test it, then use your orginal test time minus the GPIO output time, it is your PTD4 detect time.

 

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

-----------------------------------------------------------------------------

View solution in original post

0 Kudos
6 Replies
3,837 Views
jiannianli
Contributor II

the record picture are:

111.jpg2222.jpg

0 Kudos
3,829 Views
Anonymous
Deactivated User

Hi,

 

 Above two images show same time difference Bx-Ax = 960 ns. Please refer data sheet section  2.3.2 General switching specifications for GPIO operation time.

 

 

 

Thanks 

 

Kalaimani Arumugam

0 Kudos
3,824 Views
jiannianli
Contributor II

Hi Kalaimani ,

thanks for you reply.

the two picture show that Bx-Ax=9.6 us .  I had make a new test  pitcure ( put the two test into one picture ) . you can find that the different time is 1.88us ,and is too large for our project now.

333.jpg 

0 Kudos
3,769 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi jiannianli,

   You can use the FGPIO to control the GPIO output and the read the input, or use the interrupt to read the PTD4 input, it will be more quick than your polling mode.

   In fact, even you just toggle the GPIO output, it will also need the times, FGPIO toggle frequency can reach to the core clock /2.

   Your test result time in fact include two part, detect the PTD4 time, and the GPIO output time. Obout the test IO output time, you can toggle it directly in the code and test it, then use your orginal test time minus the GPIO output time, it is your PTD4 detect time.

 

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

-----------------------------------------------------------------------------

0 Kudos
3,765 Views
jiannianli
Contributor II

Hi Kerry,

thanks for your reply ,and maybe I know how to do . than you.

0 Kudos
3,752 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi jiannianli,

  You are welcome!

   If you have any new questions in the future, welcome to create the new question post. \

 

Best Regards,

Kerry

0 Kudos