Skip to content

STM32F4 change stdio pins #6105

@pilotak

Description

@pilotak

When i try to change default STDIO pins through mbed.json as per STM32 example

{
  "config": {
    "stdio_uart_tx": {
      "value": "PA_2"
    },
    "stdio_uart_rx": {
      "value": "PA_3"
    }
  }
}

It doesn't work for me, which I think it would not work because macro MBED_CONF_TARGET_STDIO_UART_TX in PinNames.h is saying it should be in target_overrides section of mbed.json file. So the macro should be called MBED_CONF_APP_STDIO_UART_TX in PinNames.h if i'm right.
or
to leave it as it is I need to add to config section targets/target.json stdio_uart_tx and stdio_uart_rx

"NUCLEO_F412ZG": {
        "inherits": ["FAMILY_STM32"],
        "supported_form_factors": ["ARDUINO", "MORPHO"],
        "core": "Cortex-M4F",
        "extra_labels_add": ["STM32F4", "STM32F412xG", "STM32F412ZG"],
        "config": {
            "stdio_uart_tx": {
                "help": "Value PD_8",
                "value": "PD_8"
            },
            "stdio_uart_rx": {
                "help": "Value PD_9",
                "value": "PD_9"
            },
            "clock_source": {
                "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI",
                "value": "USE_PLL_HSE_EXTC|USE_PLL_HSI",
                "macro_name": "CLOCK_SOURCE"
            }
        },
        "detect_code": ["0826"],
        "macros_add": ["USB_STM_HAL", "USBHOST_OTHER"],
        "device_has_add": ["CAN", "LOWPOWERTIMER", "SERIAL_ASYNCH", "SERIAL_FC", "TRNG", "FLASH"],
        "release_versions": ["2", "5"],
        "device_name": "STM32F412ZG",
        "bootloader_supported": true
    },

and change mbed.json to

{
    "target_overrides": {
        "NUCLEO_F412ZG": {
            "target.stdio_uart_tx": "PA_9",
            "target.stdio_uart_rx": "PA_10"
        }
    }
}

It than works as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions