How to set GPIO pull-down resistor in the S32 SDK

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set GPIO pull-down resistor in the S32 SDK

1,465 Views
andibavaria
Contributor II

Hi,

am working with the MPC5748G DevKit and the S32 SDK.

In the "Component Inspector" (pin_mux:PinSettings) i'm able to set the GPIO's Input/Output (SIUL2 Mask)

The Pin component (pin_mux:PinSettings) is offering me some functions which i can drag'n drop into my code.

Now i want to set a GPIO resistor pull-down or no-pull, active high or active low.

Are there functions for GPIO settings? I can only find functions which handle Ports, like PINS_DRV_SetPullSel().

Or do I have to config the GPIO directly like SIUL2->GPDO[x] = SIUL2_GPDO_xxxxx

Thanks for Info!

Labels (1)
0 Kudos
3 Replies

553 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

you can configure GPIO pins behavior in processor expert -> Pin Mux settings -> Functional Properties 

pastedImage_1.png

For pins with external interrupt functionality also can be set interrupt edge. 

In runtime - you can drag and drop 

PINS_DRV_SetPullSel( PORTJ,0,PORT_INTERNAL_PULL_DOWN_ENABLED); 

function. In row above for PORTJ, pin 0 and Pull down. You need to fill up parameters manually. 

Hope it helps. 

Jiri 

0 Kudos

553 Views
andibavaria
Contributor II

Thanks Jiri.

I still have a question.

How can I config a GPIO (output) logic active high or low?

For example:

(GPIO128, output, no pull, active high)

// config GPIO 128, output, no pull -> like in processor expert -> Pin Mux settings -> Functional Properties

SIUL2->MSCR[128] = SIUL2_MSCR_OBE(1) | SIUL2_MSCR_IBE(0) | SIUL2_MSCR_PUE(0) | SIUL2_MSCR_PUS(0);

// config GPIO 128 active high

SIUL2->GPDO[128/4] = SUIL2_GPDO_PDO_4n3_MASK; // something like this?

0 Kudos

553 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

um, if you mean just set pin output (set the particular pin to High or Low) - you can use SDK functions

PINS_DRV_SetPins(PORT, PIN_NUM_MASK);

PINS_DRV_ClearPins(PORT, PIN_NUM_MASK);

for example:

PINS_DRV_SetPins(PTD, 1 << LED);

where led is connected to PTD PIN 1 ==> #define LED    1

If you mean some kind of negative logic - like if I wirte 1 to output buffer and  want physical output 0V on pin pad - I'm afraid that there is no such feature. Only some special I/O may have this settings (like I2C ... ). 

Jiri 

0 Kudos