Accessing normal UART interrupts with USB-serial-JTAG with
Posted: Sun Sep 08, 2024 9:39 am
I would like to use the USB-serial-JTAG component of the S3 modules to process data coming in from the serial port, but not standard ASCII text UART. It is a protocol where I need to align on the packets to make sure i'm receiving the full set of data. The suggested way to receive data with this component from the documentation is to call `usb_serial_jtag_read_bytes` with the # of bytes expected. This does not work for my use-case because:
* if I call it with the full byte count of the expected packet, if my device boots in the middle of a streaming packet then it will always be receiving incorrect data (i.e. the second half of one packet and the first half of the following packet)
* if I call it with a byte count of 1, I have no way to distinguish when one packet starts and one ends (this protocol does not mandate a minimum time between packets that I could use a timer to measure)
The standard way of parsing this protocol is to wait for the BREAK condition at the start of the packet, then receive the correct amount of bytes. The esp32 UART peripheral has a break(1) interrupt that works properly. However, I cannot seem to find a way to enable and handle regular UART interrupts when using the USB-serial-JTAG component. In the component source code, I can see a call to `esp_intr_alloc` and the ISR (2), but it's handling a set of interrupts specific to the component.
Because this is a separate peripheral (USB-based) than a standard UART, is it not possible to process standard UART interrupts since it's coming over USB and not a serial connection?
(1) https://github.com/espressif/esp-idf/bl ... t_ll.h#L47
(2) https://github.com/espressif/esp-idf/bl ... jtag.c#L58
* if I call it with the full byte count of the expected packet, if my device boots in the middle of a streaming packet then it will always be receiving incorrect data (i.e. the second half of one packet and the first half of the following packet)
* if I call it with a byte count of 1, I have no way to distinguish when one packet starts and one ends (this protocol does not mandate a minimum time between packets that I could use a timer to measure)
The standard way of parsing this protocol is to wait for the BREAK condition at the start of the packet, then receive the correct amount of bytes. The esp32 UART peripheral has a break(1) interrupt that works properly. However, I cannot seem to find a way to enable and handle regular UART interrupts when using the USB-serial-JTAG component. In the component source code, I can see a call to `esp_intr_alloc` and the ISR (2), but it's handling a set of interrupts specific to the component.
Because this is a separate peripheral (USB-based) than a standard UART, is it not possible to process standard UART interrupts since it's coming over USB and not a serial connection?
(1) https://github.com/espressif/esp-idf/bl ... t_ll.h#L47
(2) https://github.com/espressif/esp-idf/bl ... jtag.c#L58