S12X: when using the re-routed SPI2 on port H[4:7], are the pin 4:7 on port P free to be used as GPIO?

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

S12X: when using the re-routed SPI2 on port H[4:7], are the pin 4:7 on port P free to be used as GPIO?

Jump to solution
911 Views
Rhapsody
Contributor III

I have thi doubt since by reading the datasheet it is stated that (2.3.45 Port P data register (PTP)):

 The SPI2 function takes precedence of the general purpose I/O function if the routed SPI2 is enabled.
When not used with the alternative functions, these pins can be used as general purpose I/O.

So, how have I to read this sentence? In my case I will enable SPI2 rerouting to port H, but I don't understand if that means that port P[4:7] will be freed to be used as GPIO..

Thanks in advance,

regards,

Ale

Tags (2)
0 Kudos
1 Solution
685 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

pastedImage_1.png

peripherals/functions presented in brackets are routable peripherals/functions. They are at the given pin only if the peripheral is routed to the pin. So, MISO2 is either at the PP4 or at the PH4 on the basis on given MODRR bit. The routing does not have any influence on the pin behavior. I mean, when you route SPI fro PP to PH then the PP pin are still available for all other functions. In the case of PP4, after routing SPI to PH4, it can be used still as GPIO/KWP4,

PWM4,

(TIMIOC4-if routed to this pin).

The same is valid for all other SPI pins. Note, entire SPI function pins are routed to all given pins in one port - PP or PH. There is no possibility to route some SPI2 pins to PP and some to PH port.

Have I answered you?

Best regrads,

Ladislav

View solution in original post

3 Replies
685 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

there is a table Table 1-10. Signal Properties Summary which presents functions at the pins. If the pin has more then one function then priority for functions is from left to right (smallest to largest). It means, theoretically, if you have all functions enabled at the pin the the function with the highest order number is connected to the pin and all others are not connected to the pin even they are enabled.

if you enable SPI at PH then the pins will be connected to the SPI peripheral and no GPIO R/W will be connected to the pins.

For example, let's imagine you will accidentally connect to PH4 MISO2 (Function 3rd) and RXD4 (function 4th) and GPIO is default then the function with highest order is RxD4 so it takes precedence over all other functions. So, all other function will be disconnected from the pin.

Note:

Do not forget that when you disable the function then smaller priority function (if enabled) is connected to the pin. For example, I have connected to the pin function which uses it in HighZ and connected to hard signal source.

Let's imagine, I accidentally set the data direction of the pin as output and put level 0 to the port. Nothing happens till I dissable the alternative function at the pin from any even accidental reason. So, if I disable the alternative function I have shortcut at the pin because GPIO function is immediately connected to the pin. In order to be sure it will never happen you should set the GPIO direction at the pins to input function.

Best regards,

Ladislav

0 Kudos
685 Views
Rhapsody
Contributor III

Dear Ladislav,

thank you for your reply.

You stated that: 

if you enable SPI at PH then the pins will be connected to the SPI peripheral and no GPIO R/W will be connected to the pins.

 

and that's ok, but since I have to route SPI to PH, while the default port is the PP, if I enable SPI at PH (via rerouting), can I use the PP pins as GPIO? SPI is enabled but rerouted to PH, so what about PP pins?

Is there something that I'm missing from your reply?

Thanks again,

regards,

ale

0 Kudos
686 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

pastedImage_1.png

peripherals/functions presented in brackets are routable peripherals/functions. They are at the given pin only if the peripheral is routed to the pin. So, MISO2 is either at the PP4 or at the PH4 on the basis on given MODRR bit. The routing does not have any influence on the pin behavior. I mean, when you route SPI fro PP to PH then the PP pin are still available for all other functions. In the case of PP4, after routing SPI to PH4, it can be used still as GPIO/KWP4,

PWM4,

(TIMIOC4-if routed to this pin).

The same is valid for all other SPI pins. Note, entire SPI function pins are routed to all given pins in one port - PP or PH. There is no possibility to route some SPI2 pins to PP and some to PH port.

Have I answered you?

Best regrads,

Ladislav