Skip to main content
Skfir
Associate III
February 26, 2023
Question

UART escape sequences? NUCLEO-U575ZI

  • February 26, 2023
  • 4 replies
  • 1789 views

Hello everybody!

I want to implement a simple UART debug/diagnose tool for my application, using UART on NUCLEO-U575ZI -> Termite or whatever other PC terminal program. Could please someone help me with a link to a list of escape sequences that I can use in order to manage the output text on the terminal? Such as cursor movements, text color changes etc.

Thank you guyz!

This topic has been closed for replies.

4 replies

gbm
Lead III
February 26, 2023

Search the net for ANSI terminal or VT-100 control codes.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Piranha
Principal III
February 26, 2023
Skfir
SkfirAuthor
Associate III
February 27, 2023

Guys thank you very much for the answers. I have found several sources with the codes, however I am a bit confused. For example, one source states: "ESC [ <n> A Cursor up by <n>". Great! But this is not the way we right the program code in C, right? What is "ESC"? Turns out that "ESC" is "\u001b", so in the code the command will look something like "\u001b[{n}A" :( Oh my... So perhaps someone knows a reference for ANSI commands, written in C-code friendly way?

P.S. Seems to have found!!

https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797

Piranha
Principal III
February 27, 2023

Normally the ESC is '\x1B'. And the GCC/Clang additionally support a non-standard '\e'.

S.Ma
Principal
February 28, 2023

I am puzzled, I don't think using a usart with a PC terminal such as Teraterm is mostly used to draw text in 2D screen. If you need pseudo graphical and not making a pong game, explore Android App "Bluetooth Electronics" which turns your phone into a remote bluetooth serial display with interactive widgets.

An example for STM32C031 with screen capture and source code can be found here.

Dig SIF.C (serial interface) and BTELxxx.c (Bluetooth Electronics) source file.

Skfir
SkfirAuthor
Associate III
February 28, 2023

Thank you!