Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

50%
+0 −0
Q&A Communication with microcontroller via usart - using strings a good idea?

Regarding string-based common protocol vs binary, there are indisputable reasons why binary is simpler, faster (these days rarely limiting), and arguably less trouble prone up to the level of compl...

posted 1mo ago by Pete W‭

Answer
#1: Initial revision by user avatar Pete W‭ · 2026-08-14T18:56:40Z (about 1 month ago)
Regarding string-based common protocol vs binary, there are indisputable reasons why binary is simpler, faster (these days rarely limiting), and arguably less trouble prone up to the level of complexity implied by the OP's scenario. 

However a common scenario is that the data itself has string form, particularly metadata in systems with lots of configuration options. 

Especially when families of devices are created with configuration schema that are analogous yet not interchangeable, this can make _named parameters_ (eg "config.sensor[3].scale.min") nicer to work with than _numbered registers_ which have different mappings across product variations or versions. To be clear this is for in-house software integration and developer use, whereas if there is a customer facing protocol IME remains better off as the equivalent of "read register 3", "write register 5", just from simplicity.

Anyhow, if the scenario is one where you are transmitting string values, there isn't much reason not to go with string commands as well.

Regarding the implementation, I would suggest the bounded strncmp() rather than strcmp(). 

Regarding UART as a physical medium, the case where it can work out is serial-over-USB, where the physical length of raw UART signal is a few centimeters to a galvanically isolated USB interface section (or none at all if built into the MCU). In that scenario, any customer with a computer and generic terminal software can help you troubleshoot over phone/screenchat.

Also a mention to encodings like modbus ASCII, which are binary encoded into two characters per byte, with often fixed line length, and a checksum byte at the end  ... eg ":A2B2FCECC12523D5BF" . Tho this isn't exactly human readable, it remains accessible via terminal without dedicated software.