What is the INOUT option of PortPin Direction used for?

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

What is the INOUT option of PortPin Direction used for?

1,260件の閲覧回数
Lambert_Yang
NXP Employee
NXP Employee

In EB tresos 20.1, there is an option named PORT_PIN_INOUT of PortPin Direction configuration. What is it used for?

I supposed this option shall be used in an application where the port direction needs to change regularly, such as SDA pin of I2C, and you needn't call Port_SetPinDirection() in the run time. But this can't work as I thought.

So what exactly is this PORT_PIN_INOUT used for?

Capture.PNG

タグ(1)
4 返答(返信)

1,174件の閲覧回数
hungnguyenphi
NXP Employee
NXP Employee

Dear  Lambert Yang,

From my point of view, the PORT_PIN_INOUT used for setting up the pin need both in/out (EG: I2c_SDA) as you say.

0 件の賞賛
返信

1,174件の閲覧回数
Lambert_Yang
NXP Employee
NXP Employee

Hi Hung,

In I2C slave response phase, the master first writes high on SDA and checks if SDA is pulled low by the slave. If call Dio_WriteChannel(DioConf_DioChannel_I2C_SDA, STD_ON)  first and then call Dio_ReadChannel(DioConf_DioChannel_I2C_SDA), the result will always be high regardless of the fact the slave has responded . So I wonder whether the MCAL driver doesn't function well or I made stupid mistakes.

0 件の賞賛
返信

1,174件の閲覧回数
hungnguyenphi
NXP Employee
NXP Employee

Hi Lambert,

From my point of view, if you want to use  GPIO bit-bang to write I2C driver, we need to call Port_SetPinDirection() in the run time. Eg: after master note send data, it need to change the pin to "input" to release the bus.

The "PORT_IN_OUT" is used in case we use the I2c hardware(Eg: flexIO I2c) or data pin of module uSDHC,...

1,174件の閲覧回数
Lambert_Yang
NXP Employee
NXP Employee

Good answer! I got it. Thank you Hung.

0 件の賞賛
返信