pico-sdk
pico-sdk copied to clipboard
Enable UART on QSPI pins
Hi,
I'm doing tests with the UART bootloader, which is described in the datasheet of RP2350 (Chapter 5.8). The pins SD2 and SD3 of QSPI are used as TX and RX by the bootloader. It works very good, but it would make sense to use the same pins in 'user mode' for communication with another controller. However it looks like the SDK lacks any functions to switch UART to bank1 pins? So at the moment it's not possible to use the same pins as the bootloader uses in 'user mode', disregarding the possibility to manually set the registers to do so (but for that I'm too far away ...).
Would be great if there could be a solution in the long term :)
BR Thomas.
I think the example in https://github.com/raspberrypi/pico-examples/pull/571 does what you need? It uses qspi_gpio_set_function() to switch the pins to UART and then uses them to communicate with the RP2350 that booted it.
Wow, @burtyb thanks! :-) This exactly what I needed, and it works just great!
By the way, my code is here: https://codeberg.org/retsifp/rp2350_uart Didn't know about this pullrequest and found another solution to embed the 'remote' firmware in the 'main' firmware.
So can this issue be closed @retsifp , or is there still missing SDK functionality that you'd like to see added?
For me it's fine, can be closed if you want. I guess it would maybe make sense to have the possibility to set the QSPI pin functions with the SDK, but I don't know how much effort that would be :) Maybe it's as easy as integrating void qspi_gpio_set_function(...) in the SDK?
I'll close this as a duplicate of #1799 then 🙂
I'll leave this around, just because i thought (and maybe this isn't the case) that it might require changes to our UART code to make this friendly - if this is just a IO and FUNCSEL setup issue, then I guess we can indeed close - i just haven't looked at it in detail
i just haven't looked at it in detail
Me neither 😂 Pinging @will-v-pi as he wrote the previously-mentioned https://github.com/raspberrypi/pico-examples/pull/571
Yeah, it was just an io/pads issue - although stdio_uart_init might need modifications too if we wanted to support that
Hi, I was just using the example in here to setup the QSPI pins for UART use. However i could only get the TX side working. The RP2350 doesn't receive anything at all on the RX pin. I know the hardware connections are good because I use the UART bootloader to load the firmware onto the MCU.
int main() {
pico_led_init();
// SD2 is QSPI GPIO 3, SD3 is QSPI GPIO 4
qspi_gpio_set_function(3, GPIO_FUNC_UART_AUX);
qspi_gpio_set_function(4, GPIO_FUNC_UART_AUX);
uart_init(uart0, 1000000);
while (true) {
// This does not echo the data sent to the MCU. I expect the following to work though
while (uart_is_readable(uart0))
uart_putc(uart0, uart_getc(uart0));
// uart_puts(uart0, "Hello, world\n");
// pico_set_led(true);
// sleep_ms(LED_DELAY_MS);
// pico_set_led(false);
// sleep_ms(LED_DELAY_MS);
}
}
has anyone actually tried the RX side?
There is a known bug on that example which prevents RX from working - fixed by https://github.com/raspberrypi/pico-examples/pull/697