5 years, 8 months ago.

How to disable UART STDIO / custom board/target configuration ?

Hello, I am creating new custom board based on nRF52832. I would like to create new Target (custom_targets.json) for offline mbed compile. I could not find any information on how to explicitly disable the STDIO UART output because my board does not have UART RX/TX pins. I would like to make sure that no GPIO is used by accident as UART output..

1 Answer

5 years, 8 months ago.

Hello Tomasz,

If the board does not support any UART then you just don't implement the HAL(Hardware abstraction library) function for UART. That way, even when UART is call, nothing will happen.

Please let me know if you have any questions!

- Peter, team Mbed

If this solved your question, please make sure to click the "Thanks" link below!

Hello Peter, thanks for your reply! :-) How can I "just don't implement the HAL function for UART"?

Target is nRF52832, so it has already all functions defined.. from what I saw from documentation I only need to define custom_targets.json, which looks like below.. this is almost the same as nRF52_DK but the build results are different.. and the Bluetooth does not work as opposed to nRF52_DK for the same firmware code..

{
    "MyTargetBoard" : {
        "inherits": ["MCU_NRF52832"],
        "release_versions": ["5"],
        "device_name": "nRF52832_xxAA"
    }
}

Is there any more detailed documentation on how can I add new board based on an existing Target CPU/MCU?

posted by Tomasz CEDRO 12 Jul 2018

Maybe I can ask this question in a different way.. is it possible to create local project wide configuration right next to firmware code for a custom board based on an exiting target MCU but only with some selected set of features (i.e. disable UART GPIO) that would not involve creating separate set of implementations that would have to become part of the mbed source tree?

I am working on a custom hardware design based on a nRF52832 that is already well supported by ARM MBED OS, so I would simply like to create set of defines/configurations that would allow me to make mbed compile build firmware for that particular custom board that does not necessarily become public because of its custom nature and only contains specific set of features (i.e. I would like to reuse existing nRF52832 configuration but explicitly disable UART STDIO)..

I would like that custom target configuration to be part of the firmware itself.. so the firmware can be compiled for a different hardware revisions of a custom hardware design.. and I would like to put available set of hardware defines and features in that custom target configuration..

posted by Tomasz CEDRO 12 Jul 2018

Example: 1. I would like to compile some firmware for nRF52_DK + shield (hardware revision 1) with UART STDIO enabled. Set mbed target nRF52_DK. 2. I would like to compile exactly the same firmware for custom device (hardware revision 2) with UART STDIO disabled. Set mbed target MyCustomBoard.

posted by Tomasz CEDRO 12 Jul 2018

So look for the file call serial_api.c inside of the folder mbed-os/targets/TARGET_NORDIC/TARGET_MCU_NRF51822. That where UART init function call is implemented. You can just comment all the code in the serial_init(), which initialize UART. Once you do that, UART will never be able to initialize.

-Peter, Team Mbed

posted by Peter Nguyen 13 Jul 2018