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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
6,143 次查看
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 项奖励
回复
1 解答
6,067 次查看
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 项奖励
回复
6 回复数
6,136 次查看
jiannianli
Contributor II

the record picture are:

111.jpg2222.jpg

0 项奖励
回复
6,127 次查看
Anonymous
不适用

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 项奖励
回复
6,122 次查看
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 项奖励
回复
6,068 次查看
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 项奖励
回复
6,063 次查看
jiannianli
Contributor II

Hi Kerry,

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

0 项奖励
回复
6,050 次查看
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 项奖励
回复