RT106x - Using GPIO and special function on the same pin at the same time

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

RT106x - Using GPIO and special function on the same pin at the same time

1,457 Views
carstengroen
Senior Contributor II

Hello,

I'm working on the software for a RT1064 design, and I'm having a hard time understanding the (complex) GPIO/MUX/PAD thing....

I have a device connected to LPSPI3, and I need to monitor the level of the LPSPI3 SDI input at some point during initialization of the SPI device.

I initialize the LPSPI3 SDI/SDO and SCK with this (I control the CS signals "manually"):

IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_13_LPSPI3_SDI, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK, 0U);

IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_13_LPSPI3_SDI, 0x10B0u);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO, 0x10B0u);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK, 0x10B0u);‍‍‍‍‍‍‍

and this works perfect (I have another device on the SPI bus which I can talk with)

Now, I also need to be able to do:

GPIO_PinRead(GPIO1, 29)‍‍‍

to monitor the level of the SDI pin.

What kind of initialization do I need to have both the GPIO_AD_B1_13 pin connected to the LPSPI3 SDI and the GPIO1.29 signal ?

Labels (2)
0 Kudos
7 Replies

1,165 Views
carstengroen
Senior Contributor II

Anyone ?

(or is it not possible to do what I describe?)

0 Kudos

1,165 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Carsten Groen,

    I don't think you can configure the GPIO and the LPSPI3_SDI together.

   Please check this register from the reference manual:

pastedImage_344.png

GPIO and LPSPI pin function have the difference ALT number.

So, maybe you can connect your SDI pin to another pin, then configure that pin as the GPIO function to detect your SDI status.

Wish it helps you!


Have a great day,
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 Kudos

1,165 Views
carstengroen
Senior Contributor II

Thanks kerryzhou‌,

I just thought that I read somewhere in the UM that it was possible to direct one pin to more than one module, but I guess not.

I will just re-configure the pin between GPIO and SDI when I need to read the physical level of the pin, no big deal. I just thought that the immense complex IOMUX would enable such a relatively simple task (like all the smaller processors in the LPC family does).

0 Kudos

1,165 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Carsten,

   You also can try the test on your side, just configure the pin as SDI in the pinmux, not the GPIO function.

   But in the main code, you can configure the GPIO function for GPIO1.29, try to  read GPIO1.29 directly, just test whether it is correct or not when you change the leave in SDI pin.

  Any test result on your side, please kindly let me know.


Have a great day,
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 Kudos

1,165 Views
carstengroen
Senior Contributor II

kerryzhou‌,

I actually tried that, but not working (as far as I could tell)...

0 Kudos

1,165 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Carsten,

   Thanks a lot for your updated information.

   Unfortunately, RT feature really can't support this function, in the kinetis chip also can use the GPIO to read the pin status even it is not the GPIO function.

   So, maybe, still as I recommend you, you need to connect it to another RT pin which is configured as GPIO function.

 


Have a great day,
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 Kudos

1,165 Views
carstengroen
Senior Contributor II

Kerry,

yes, its no big problem, I just found it strange that the RT devices didn't allow this relatively common feature. For now I have just selected to switch between GPIO and SDI functionality for the pin, works fine (although I could also as you say, just connect the SDI pin to a free GPIO pin, maybe I will do that in the next HW spin if I have enough free pins :smileywink: )

Thanks for you help!