Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8609

General • Re: Redirect UART from pico debug probe to gpio 16 and 17

$
0
0
I think there is a confusion in the interpretation of that comment.

Code:

    // Use some the various UART functions to send out data    // In a default system, printf will also output via the default UART
printf uses sdtio/stdout which then goes to whatever interfaces bound ('enabled').
hello_uart example does not initialize stdio, neither uses it, it writes directly to the UART driver.

These functions are different:

uart_init = Initialise a UART.

stdio_uart_init = Explicitly initialize stdin/stdout over UART and add it to the current set of stdin/stdout drivers.

2.7.1. Standard Input/Output (stdio) Support
The SDK provides infrastructure for routing stdout and stdin to various hardware interfaces, which is provided by the
pico_stdio library.
• A UART interface specified by a board configuration header. The default for Raspberry Pi Pico is 115200 baud on
GPIO0 (TX) and GPIO1 (RX)
• A USB CDC ACM virtual serial port, using TinyUSB’s CDC support. The virtual serial device can be accessed
through the RP-series microcontrollers' dedicated USB hardware interface, in Device mode
• Minimal semihosting support to direct stdout to an external debug host connected via the Serial Wire Debug link on
the RP-series microcontroller
• Segger RTT

The support is used via the standard calls like printf, puts, getchar, found in the standard <stdio.h> header. By default,
stdout converts bare linefeed characters to carriage return plus linefeed, for better display in a terminal emulator. This
can be disabled at runtime, at build time, or the CR-LF support can be completely removed.

stdout is broadcast to all interfaces that are enabled, and stdin is collected from all interfaces which are enabled and
support input. Since some of the interfaces, particularly USB, have heavy runtime and binary size cost, only the UART
interface is included by default. You can add/remove interfaces for a given program at build time with e.g.
pico_enable_stdio_usb(target_name, 1) # enable USB CDC stdio for TARGET target_name

Statistics: Posted by gmx — Wed Jan 21, 2026 11:38 pm



Viewing all articles
Browse latest Browse all 8609

Trending Articles