Can I change the ping functionality on the fly?

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

Can I change the ping functionality on the fly?

641 次查看
amol_kulkarni1
Contributor II

Hi,

I am using MAGNIV (9S12ZVCF0VKHR) series microcontroller.

 

I would like to know if I can change the functionality of a pin on the fly.

 

That is as described below.

  1. I have PS1 which has following functionalities PS1 / KWS1 / MOSI0 / (SCL0) / (TXD0) / (CPTXD0
  2. When the controller is up by default I would configure this pin to SPI0 (MOSI0).
  3. Based on some command I have to put this MAGNIV in low power mode so I would like to change the pin to GPIO and enable the interrupt.
  4. Once I get the wake up signal then I want the pin configured back to SPI0

 

As per my understanding

  1. By default “MODRR0” configures to SPI0.
  2. If I Enable the SPI0 module this pin will work as SPIO else it works as GPIO.
  3. So when ever I want to push MAGNIV in low power mode I would disable SPI0 so that PS1 can work as GPIO and enable the interrupt for wakeup.
  4. Once I get the wakeup signal on this ping I would initialize the SPI0 again, so that this pin works as MOSI0

 

Please advise me on this also let me know if any adverse impact of this.

Regards

Amol

0 项奖励
3 回复数

632 次查看
StanoA
NXP TechSupport
NXP TechSupport

Hi Amol,

Yes, you are right with your understanding. If you enable the peripheral function it takes over the GPIO functionality. Be sure for GPIO wake-up to enable the pull-up resistor and interrupt.

Best Regards,

Stano.

0 项奖励

628 次查看
amol_kulkarni1
Contributor II

@StanoA 

Thanks for confirming, 

couple of things.

1. Once the CPU wakes from low power mode ISR is not executed the instruction next to wait or stop is executed. that means I dont have to write the ISR for this.

2. Just curious what is the interrupt routine for PS1. I am new to this so dont know how do i define interrupt routine.

0 项奖励

624 次查看
StanoA
NXP TechSupport
NXP TechSupport

Hi Amol,

In case you want to use interrupt, you need set the Port Interrupt Enable register. Please see the whole Section 2.3.3 and concentrate to 2.3.3.5 to 2.3.3.7 and also on 2.4.4 to properly set interrupts. The look at Chapter 5 too about Interrupt module.

Best Regards,

Stano.

0 项奖励