The Timing of the pin change, and _time_delay through MQX

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

The Timing of the pin change, and _time_delay through MQX

765 Views
MichaelDavid
Contributor III

1. I'm using the GPIO through the MQX and it goes very slow, (through debug mode - FLASH - CW) about 6us to change pin state, I need it 100 time faster! 

2. I'm using the original TWR-K60N512 BSP, when I use the _time_delay(1) I get 10ms delay. why? It should be only 1ms! 

Please Help,

Michael David.

0 Kudos
2 Replies

534 Views
konrada_anton
Contributor III

You can still program the GPIO pins directly:

  1. Switch on clock for the PORT module in SIM_SCGC5
  2. Assign your pin for GPIO in the MUX field of PORTx_PCRn
  3. Set suitable GPIOx_PDDR bits to 1 for output
  4. Write suitable bits to GPIOx_PDOR, GPIOx_PSOR, GPIOx_PCOR, or GPIOx_PTOR to change your pin's state.

 

0 Kudos

534 Views
MichaelDavid
Contributor III

Thanks for your answer. I tried it before reading your reply

1.Using I/o directly gave me the wanted results.

2. the BSP has a const that the delay uses, it should be set to 1000 not to 100 to get ms.(BSP_ALARM_FREQUENCY)

0 Kudos