GPIO initial state = No init

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

GPIO initial state = No init

Jump to solution
1,799 Views
GuillaumeAudirac
NXP Employee
NXP Employee

I'm trying to generate pin_mux.c/h files for K64F with the Config Tools v4.1. When configuring GPIO outputs with no initial state (GPIO initial state = No init), the GPIOs pins are still initialized in the generated code.

Basically, there is no difference between "No init" and "Logical 0". I expected the GPIO_PinInit() function not to be called with "No init" setting.

Extract of pin_mux.c file (with "No init"):

    gpio_pin_config_t AIR_WAKEN_config = {
        .pinDirection = kGPIO_DigitalOutput,
        .outputLogic = 0U
    };
    /* Initialize GPIO functionality on pin PTA1 (pin J6)  */
    GPIO_PinInit(BOARD_INITPINS_AIR_WAKEN_GPIO, BOARD_INITPINS_AIR_WAKEN_PIN, &AIR_WAKEN_config);
Guillaume Audirac
Tags (2)
1 Solution
1,374 Views
Lukas_Heczko
NXP Employee
NXP Employee

Hi Guillaume,

thanks for your feedback!

The reason why you can see pin initialization code being generated is because of the underlying SDK pin initialization code: it combines initialization of pin initial state with initialization of pin direction. If pin direction is being configured then also pin initial state is expected to be passed to SDK GPIO_PinInit() function. As result, default pin initial state (Logical 0) is generated by Pins tool although related pin initial state is set to No init

I agree that the current state is confusing and I passed your feedback to the development team. If you need to get rid off the GPIO_PinInit() call completely, you have to set pin direction in Pins tool to Not specified

Regards,

Lukas

View solution in original post

4 Replies
1,374 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Guillaume Audirac,

There is a reset data (0) when no init the gpio pin of output .

The function of "GPIO_PinInit()" not only configure the data of gpio data, also configure direction .

If you don't want to call this function, I was wondering why do you configure GPIO , and what is the effect

when output is 0.


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
1,374 Views
GuillaumeAudirac
NXP Employee
NXP Employee

Thanks for the answer.

To explain the context: as the field for the initial state was not available in older version of the Config Tools (v4.0), GPIO_PinInit() was called in our application. Now, I intend to align the current pin_mux/peripherals/clock_config[.c/.h] files to the new version of the Config Tools (v4.1) but without changing the GPIO initialization code.

Now, can you please explain the difference between:

- No init ("Property will not be initialized - no code will be generated and no validations will be performed")

- Logical 0 ("Logical 0")

I cannot see any difference in terms of code generation. Moreover the tooltip statement "no code will be generated" seems wrong. So the code generation for "No init" looks to me like a bug in the Config Tools.

Guillaume Audirac
0 Kudos
1,375 Views
Lukas_Heczko
NXP Employee
NXP Employee

Hi Guillaume,

thanks for your feedback!

The reason why you can see pin initialization code being generated is because of the underlying SDK pin initialization code: it combines initialization of pin initial state with initialization of pin direction. If pin direction is being configured then also pin initial state is expected to be passed to SDK GPIO_PinInit() function. As result, default pin initial state (Logical 0) is generated by Pins tool although related pin initial state is set to No init

I agree that the current state is confusing and I passed your feedback to the development team. If you need to get rid off the GPIO_PinInit() call completely, you have to set pin direction in Pins tool to Not specified

Regards,

Lukas

1,374 Views
GuillaumeAudirac
NXP Employee
NXP Employee

Thanks a lot for the clear and helpful answer.

Thanks as well to have informed  the dev team to avoid confusing settings.

Guillaume Audirac
0 Kudos