Hi again,
I'm fiddling with Pins Tools (MCUXpresso 11.4.0) and example code "led_blinky" from the LPC5526 SDK.
I added another GPIO output with "Invert" set to "disabled" as follows:
Pins Tool generates this code (relevant parts only):
gpio_pin_config_t LED_RED_config = {
.pinDirection = kGPIO_DigitalOutput,
.outputLogic = 0U
};
/* Initialize GPIO functionality on pin PIO0_7 (pin 6) */
GPIO_PinInit(BOARD_INITPINS_LED_RED_GPIO, BOARD_INITPINS_LED_RED_PORT, BOARD_INITPINS_LED_RED_PIN, &LED_RED_config);
const uint32_t LED_RED = (/* Pin is configured as PIO0_7 */
IOCON_PIO_FUNC0 |
/* No addition pin function */
IOCON_PIO_MODE_INACT |
/* Standard mode, output slew rate control is enabled */
IOCON_PIO_SLEW_STANDARD |
/* Input function is not inverted */
IOCON_PIO_INV_DI |
/* Enables digital function */
IOCON_PIO_DIGITAL_EN |
/* Open drain is disabled */
IOCON_PIO_OPENDRAIN_DI);
/* PORT0 PIN7 (coords: 6) is configured as PIO0_7 */
IOCON_PinMuxSet(IOCON, BOARD_INITPINS_LED_RED_PORT, BOARD_INITPINS_LED_RED_PIN, LED_RED);
Now in Pins Tool I switch "Invert" to "Reset (Disabled)" (which should be the same configuration as before):
Spot the difference? Disabled is in italics now.
The generated code, however, looks mighty different:
IOCON->PIO[0][7] =
((IOCON->PIO[0][7] &
/* Mask bits to zero which are setting */
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_MODE_MASK | IOCON_PIO_SLEW_MASK | IOCON_PIO_DIGIMODE_MASK | IOCON_PIO_OD_MASK)))
/* Selects pin function.
* : PORT07 (pin 6) is configured as PIO0_7. */
| IOCON_PIO_FUNC(PIO0_7_FUNC_ALT0)
/* Selects function mode (on-chip pull-up/pull-down resistor control).
* : Inactive.
* Inactive (no pull-down/pull-up resistor enabled). */
| IOCON_PIO_MODE(PIO0_7_MODE_INACTIVE)
/* Driver slew rate.
* : Standard-mode, output slew rate is slower.
* More outputs can be switched simultaneously. */
| IOCON_PIO_SLEW(PIO0_7_SLEW_STANDARD)
/* Select Digital mode.
* : Enable Digital mode.
* Digital input is enabled. */
| IOCON_PIO_DIGIMODE(PIO0_7_DIGIMODE_DIGITAL)
/* Controls open-drain mode.
* : Normal.
* Normal push-pull output. */
| IOCON_PIO_OD(PIO0_7_OD_NORMAL));
I wonder why this is.
解決済! 解決策の投稿を見る。
Hi Daniel,
"Reset (Disabled)" means that configuration relies on after-reset value and does not affect the after reset configuration. This feature is not supported by "IOCON_PinMuxSet" function (this function always sets all bits), and so the generated code uses direct write to configuration register instead using SDK API.
Hope this helps
Regards,Marek
Hi Daniel,
"Reset (Disabled)" means that configuration relies on after-reset value and does not affect the after reset configuration. This feature is not supported by "IOCON_PinMuxSet" function (this function always sets all bits), and so the generated code uses direct write to configuration register instead using SDK API.
Hope this helps
Regards,Marek