Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RX and TX in use on QTPY ESP32S2 #5904

Closed
Neradoc opened this issue Jan 22, 2022 · 3 comments · Fixed by #6056
Closed

RX and TX in use on QTPY ESP32S2 #5904

Neradoc opened this issue Jan 22, 2022 · 3 comments · Fixed by #6056
Labels
bug espressif applies to multiple Espressif chips
Milestone

Comments

@Neradoc
Copy link

Neradoc commented Jan 22, 2022

Trying to use board.TX or board.RX, or board.UART raises a pin in use error. For example like this:

import board
uart = board.UART()
ValueError: TX in use

I assume that comes from #5894

#define DEBUG_UART_RX DEFAULT_UART_BUS_RX
#define DEBUG_UART_TX DEFAULT_UART_BUS_TX

@tannewt tannewt added bug espressif applies to multiple Espressif chips labels Jan 24, 2022
@tannewt tannewt added this to the Long term milestone Jan 24, 2022
@tannewt
Copy link
Member

tannewt commented Jan 24, 2022

This should only be the case on DEBUG=1 builds. Did you try a DEBUG=0 build?

@Neradoc
Copy link
Author

Neradoc commented Jan 24, 2022

That is with latest from S3. It doesn't look like there is any condition other than the pins definitions existing in supervisor/shared/serial.c. There's a few places in the file that test it. Am I missing something ?

void serial_early_init(void) {
#if defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX)
debug_uart.base.type = &busio_uart_type;
const mcu_pin_obj_t *rx = MP_OBJ_TO_PTR(DEBUG_UART_RX);
const mcu_pin_obj_t *tx = MP_OBJ_TO_PTR(DEBUG_UART_TX);
common_hal_busio_uart_construct(&debug_uart, tx, rx, NULL, NULL, NULL,
false, 115200, 8, BUSIO_UART_PARITY_NONE, 1, 1.0f, 64,
buf_array, true);
common_hal_busio_uart_never_reset(&debug_uart);
#endif
}

Should the pins definition for the QT PY be conditioned by the DEBUG level, or should it be changed in serial.c with something like that ?

#define CIRCUITPY_DEBUG_UART CIRCUITPY_DEBUG && defined(DEBUG_UART_TX) && defined(DEBUG_UART_RX)

@tannewt
Copy link
Member

tannewt commented Jan 25, 2022

Ah, you are right. Yes, I expect it to be conditioned on whether it is a debug build. I'm not sure where the best place is to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug espressif applies to multiple Espressif chips
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants