Combined UART Log messages w/binary data packets

p-rimes
Posts: 89
Joined: Thu Jun 08, 2017 6:20 pm

Combined UART Log messages w/binary data packets

Postby p-rimes » Tue Nov 20, 2018 9:12 pm

Hi Espressif/ESP32 users,

I am trying to use an ESP32 device to send custom messages to a computer via USB (e.g. CP2102<->UART), as well as be able to record all console messages (boot log, printf, etc) to display them on the computer and/or save them to a log file, etc.

I'd like to be able to use a single USB<->serial connection to send both my custom messages, and the log lines (maybe using multiple UARTs, but only if they can share the same USB port). Any suggestions on how to do this?

Some basic ideas I have thought of, but there might be a much better way:
  • Override esp-idf logging, convert everything to JSON (e.g. {level: "ESP_LOGI", msg: "blah"}), so custom messages would also be JSON alongside the regular logs.
  • Use some framing protocol (eg. SLIP encoding w/ begin/end) when switching between sending LOGS and MESSAGES.
  • I think this is what serial PPP is sometimes used for? Maybe esp-idf logging could be overridden to send PPP packets for each log message?

Who is online

Users browsing this forum: No registered users and 100 guests