Unable to read eTPU pin as input mode

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Unable to read eTPU pin as input mode

1,208件の閲覧回数
rahulmankumbare
Contributor II

Hi,

We are using MPC5777C. S32DS v1.2.

We want to make ETPUA4 pin 118 as an input.

We are using etpu GPIO code generated from etpu function selector as a reference.

We have managed to make ETPUA4 in output mode & able to make it high & low.

But when we confugure it in input mode. We are not able to read the pin status.

fs_etpu_init( my_etpu_config, (uint32_t *)etpu_code, sizeof(etpu_code), \
(uint32_t *)etpu_globals, sizeof(etpu_globals));

my_system_etpu_start();

SIU.PCR[118].B.IBE = 1; // ETPUA4 as an input pin
SIU.PCR[118].B.PA = 1; // primary function as ETPUA4

fs_etpu_gpio_init(4,FS_ETPU_PRIORITY_HIGH);

 

fs_etpu_gpio_input_immed(4);
if(eTPU->CHAN[4].SCR.B.IPS==1) // read status register
{
 SIU.GPDO[154].B.PDOn = 1; // USER LED OFF
}
else
{
 SIU.GPDO[154].B.PDOn = 0; // USER led ON
}

Above is the code that we are using to read the pin status.

Please suggest if anything is missing.

Thanks.

Rahul.

0 件の賞賛
返信
4 返答(返信)

981件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, it is needed to add

pinstate = fs_etpu_gpio_pin_history (4);

Function fs_etpu_gpio_input_immed only latches the pin value into variable PINSTATE.

0 件の賞賛
返信

981件の閲覧回数
rahulmankumbare
Contributor II

 Hi,

Now we have tried with following code but still pinstate variable haviong value 0 only.

I am connecting a switch to GPIO1 & pressing it, so that value on GPIO1 gets changed.

while(1)
{
fs_etpu_gpio_input_immed (GPIO1);
while(eTPU->CHAN[GPIO1].SCR.B.CIS == 0); /* wait for eTPU_A Channel 1 interrupt status bit to be set */
eTPU->CHAN[GPIO1].SCR.B.CIS = 1;
eTPU->CHAN[GPIO1].SCR.B.DTRS =1;

pinstate = fs_etpu_gpio_pin_history (GPIO1);

delay();

}

Please suggest.

Thanks.

Rahul

0 件の賞賛
返信

981件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

And this way you don't see valid result in LSB bit of pinstate variable? Do you have properly setup SIU_PCR register for this pin?

981件の閲覧回数
rahulmankumbare
Contributor II

Hi,

SIU.PCR[118].B.IBE = 1; // ETPUA4 as an input pin
SIU.PCR[118].B.PA = 1; // primary function as ETPUA4

Above is the SIU_PCR register setting.

Thanks.

Rahul

0 件の賞賛
返信