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

66%
+2 −0
Q&A How do I test firmware code for my embedded system that also controls hardware peripherals?

I am soon finished writing the firmware for a relay control board that will help us automate some of the electrical tests we run at the company I work. In essence, the board more or less just turns...

3 answers  ·  posted 1mo ago by Carl‭  ·  last activity 1mo ago by Lundin‭

Question embedded-systems firmware testing
#1: Initial revision by user avatar Carl‭ · 2026-08-13T06:56:51Z (about 1 month ago)
How do I test firmware code for my embedded system that also controls hardware peripherals?
I am soon finished writing the firmware for a relay control board that will help us automate some of the electrical tests we run at the company I work. In essence, the board more or less just turns relays on and off by communicating with an external PC via USART - simple enough.

The challenge I am facing now, is that I want to test the correctness of my firmware before we start deploying these boards around the facility, but I'm not sure how to do that. To me, firmware is special in that regard.

In hardware/analog electronics everything exists "outside" the PC. If I want to check if my low pass filter works correctly I apply an excitation waveform at the input, measure the output and test if it matches my expectation.

In software everything exists "inside" the PC. The variables, the memory, the commands and results are all available to see in the PC as long as you know where to peek.

But firmware is sort off in-between. Some things happen on the outside world (control of hardware, switches, interfaces ...) while some things happen inside the embedded system (incrementing counters, handling interrupts, controlling program flow and logic, etc.).

What are some of the ways I can test my firmware to see if it operates correctly?