Trouble with configuring PIO0_16 as output LPC802

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

Trouble with configuring PIO0_16 as output LPC802

694 Views
asier
Contributor III

Hi,

I use Pin Configurator tool in my project with MCUXpresso v11.2.0_4120 IDE.

All was correct until I wanted to use a not using pin as output TEST port. So I configure that port (PIO0_16) as output and Logical 0 and generate code.

When I run code on my custom board, I can see that PIO0_16 port is input direction and not output as expected.

If I open the file generated by the tool pin_mux.c, we have next:

........

gpio_pin_config_t DISP_config = {
.pinDirection = kGPIO_DigitalOutput,
.outputLogic = 0U,
};
/* Initialize GPIO functionality on pin PIO0_11 (pin 9) */
GPIO_PinInit(BOARD_INITPINS_DISP_GPIO, BOARD_INITPINS_DISP_PORT, BOARD_INITPINS_DISP_PIN, &DISP_config);

gpio_pin_config_t X0_config = {
.pinDirection = kGPIO_DigitalInput,
.outputLogic = 0U,
};
/* Initialize GPIO functionality on pin PIO0_15 (pin 11) */
GPIO_PinInit(BOARD_INITPINS_X0_GPIO, BOARD_INITPINS_X0_PORT, BOARD_INITPINS_X0_PIN, &X0_config);

gpio_pin_config_t gpio0_pin0_16 = {
.pinDirection = kGPIO_DigitalOutput,
.outputLogic = 0U,
};
/* Initialize GPIO functionality on pin PIO0_16 (pin ) */
GPIO_PinInit(GPIO, 0U, 16U, &gpio0_pin0_16);

......

It seems ok but using of "0U" and "16U" numbers catches my attention. In other pin configuration code tags are using instead port pin direct numbers. So I was expecting next code:

gpio_pin_config_TEST_config = {
.pinDirection = kGPIO_DigitalOutput,
.outputLogic = 0U,
};
/* Initialize GPIO functionality on pin PIO0_16 (pin ) */
GPIO_PinInit(GPIO, BOARD_INITPINS_TEST_PORT, BOARD_INITPINS_TEST_PIN, &TEST_config);

I dont know if that bears relation with the trouble.

Any helping with that rare problem ?

thanks in advance,

Asier.

 

 

Labels (1)
0 Kudos
2 Replies

666 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello Asier,

I was checking the code generated with the SDK 2.8 version installed and the code is slightly different, but the configuration is ultimately the same.

    /* Initialize GPIO functionality on pin PIO0_16 (pin 1)  */

    GPIO_PinInit(BOARD_INITPINS_I2C_SCL_GPIO, BOARD_INITPINS_I2C_SCL_PORT, BOARD_INITPINS_I2C_SCL_PIN, &I2C_SCL_config);

}

Where BOARD_INITPINS_I2C_SCL_GPIO us defubed as “GPIO” (/*!<@brief GPIO device name: GPIO */)

BOARD_INITPINS_I2C_SCL_PORT is defined as “0U” (/*!<@brief PORT device index: 0 */)

and BOARD_INITPINS_I2C_SCL_PIN is defined as “16U” (/*!<@brief PIO0 GPIO pin index: 16 */)

The pin direction and output logic also look okay.

It is indeed a rare situation. How is it that you are seeing this pin as input instead of as output after the initialization? Maybe that can provide more information on what may be the problem.

Regards,
Gustavo

0 Kudos

660 Views
asier
Contributor III

Hello Gustavo,

I see that port is an input because I put my oscilloscope probe on that pin and signal behaves like a high impedance input. I test a new part to discard port was broken, but same occur.

I migrate my project from MCUxpresso IDE v11.0.0 to v11.1.0 and then to v11.2.0 and same happend in all IDEs.

It is not the first project that it happens to me that one pin configuration is not applied like in pin_mux.c appears. In both "corrupted" projects pin generator tool uses port and pin direct number instead of pin tags desbribed in pin_mux.h for the "corrupted" pin.

If I start a new project from zero and copy my source.c from wrong project to new one, then the problem dissapears.

I think that is some thing that I do which it leaves project wrong. Maybe the reason could be that I've been trying to write in read only pin_mux.c file ?

I will continue observing.

Asier.

 

0 Kudos