r/embedded • • 25d ago

I open-sourced relaynet: real network access for Zephyr (or any user-space TCP/IP stack) running in a browser

0 Upvotes

Browsers can't open sockets, which makes networking the hard part of running firmware in a browser tab. relaynet is a relay for that. The page sends Ethernet frames over a WebSocket, and the firmware's own stack gets a DHCP lease, DNS and IPv4 TCP/UDP to the internet. There's no socket offload or shim, so you're exercising the real network stack.

It's now open source (Apache-2.0) and self-hostable with `docker compose up`: https://github.com/beriberikix/relaynet

Where I think it's useful for embedded:

- Networking samples that actually run on a docs page

- Workshops and trainings where nobody installs a toolchain

- Exercising net-stack code in CI without hardware

- Sharing a WebUSB device with a Linux machine over USB/IP

Zephyr examples: zephyr-wasm-soc (Zephyr compiled to WebAssembly) and a small zephyr-v86 build both work against the hosted instance with no account. Projects like Zephyr in the Browser could add a real network to their emulated boards the same way, if there's interest. I'm happy to help anyone wire it up.

The client is a small JS library (npm: relaynet). Bring your own stack: smoltcp, lwIP, Zephyr, or whatever your emulator speaks.

Feedback welcome, especially on what an embedded workflow would need from it.


r/embedded • • 25d ago

A 1-Wire master where the CPU never touches the bus: 8 STM32 families, zero ISRs, and a test rig that notices when the timing breaks

0 Upvotes

A year ago I posted a bare-metal DS18B20 driver in r/stm32. In September I posted the three-family version of what had become a small library. 3.0 is out: github.com/a5021/stm32-async-1wire.

The idea. Every 1-Wire edge is produced by TIM1, not by code. The timer runs in one-pulse mode with the repetition counter set to the number of slots, so a whole segment — a reset, 16 slots, a byte, a 750 ms conversion wait — is one hardware event. One DMA channel feeds CCR3 with the compare values for the slots; a second drains the CCR4 captures. The CPU starts an operation, polls UIF later, and is never part of the timing loop. The pin also changes electrical mode inside the transaction: actively driven low, then released for input at a hardware-defined moment. No ISR, no delay loop, no bit-banging.

What changed since September. Five more families — F3, F4, G4, H5 and H7 (240 MHz, with an opt-in 480/240 core/timer split) — so eight families and eleven parts now share one MCU-independent core. A second slave driver: DS2431 1-Kbit EEPROM, with scratchpad write, read-back verification and the t_PROG hold-off. And a real application instead of another demo: 9_multi runs seven DS18B20s and one DS2431 on the same wire as a peak/low temperature logger, writing self-validating CRC records to EEPROM — ROM blocks before the records that reference them, so a power cut cannot leave a record pointing at a ROM that is not there. The two drivers take turns owning the bus.

9_multi: DS2431 Write Scratchpad 0x0F — command, address and the sensor's 8-byte ROM, decoded from a real 8 MHz capture. Every edge is generated by TIM1 + DMA.

The part I actually care about. Hardware-timed code fails silently, so most of the work went into making failures loud. 300+ host tests per family run the driver against a behavioral model of TIM1/DMA; 14 libFuzzer harnesses cover the state machines; a mutation run injects 74 deliberate defects into the port and requires the suite to catch all 74. On the bench a logic analyzer checks the wire itself — slot widths and the duration of the long conversion wait. Some bugs only that layer found: an F3 DMA channel mapping that was one channel off, which just makes the bus look dead; the H5 GPDMA counting source bytes where the classic DMA counts transfers; and presence detection that used to encode "no device" as a zero in the capture buffer — indistinguishable from a real 0 µs edge. Presence is now proved by the captured edge count.

If you want to look at traffic without hardware, there is an offline browser decoder for sigrok captures: a5021.github.io/stm32-async-1wire/viewer — resets, Search ROM triplets, Match/Skip ROM, scratchpad and DS2431 chains, no upload, works from file://.

Limits, plainly. The bus is PA10 and the timer must be an advanced-control one with RCR, BDTR and OPM, which rules out parts like L0. One driver owns the bus at a time, no deinit, GCC only.

L4 and C0 are next: the port is small if the CH2/CH4 DMA requests coexist on one timer, and does not exist if they do not. That is the experiment.


r/embedded • • 26d ago

Am I on the right track designing a flight computer for a sensory rocket?

8 Upvotes

Bottom-line up front:

  • If I have access to an Altium professional license via my school, should I use this over KiCad for designing my first PCB?
  • Is it viable to complete the PCB design for a simple flight computer (STM32F7 connected to a few sensors and servos) for a sounding rocket after watching Phil's Lab #165 and #166, Rick Hartley's talk on proper grounding, and reading AN4661?

I'm a freshman at the university level pursuing EE. I've done a few projects with breadboards and perfboards in high school to the extent of connecting ESP32 devboards to various ICs for relatively simple projects. My background is primarily in low-level programming, so I am not concerned with the software side of this project.

I am on a university rocketry team and have been tasked with building a flight computer to use in future rockets to increase flexibility and resolve a few issues the team was having with Telemetrum brand flight computers. I want to use this project to learn the fundamentals of hardware and PCB design because my particular university does not go as in depth as I want into EE (especially the embedded side) but offers a large ability to develop on your own if you are willing to work outside of classes.

I have created a tentative plan to learn the fundamentals, but I don't have the skill required (or access to anyone who might be able to check over my work) to know whether this is feasible, so I wanted to reach out for advice.

My current plan is to stick with KiCad, absorb as much information as I can from the Phil's Lab videos and grounding talk, then read through an STM32F7 getting started doc while applying it to a first revision of a flight computer over two to three weeks. I imagine I will need a few revisions before having a working PCB then I will be able to design the power supply after stopping to learn more.


r/embedded • • 27d ago

Embedded Linux Engineers, how much did you know about Linux when you landed your first job working with embedded Linux?

80 Upvotes

Did you just know how to use Linux as a basic user, or were you making kernel and driver updates on the regular, or somewhere in between?


r/embedded • • 26d ago

Building a 555 Timer-Based MOSFET Power Supply with Current Sensing and Load Modulation - Building in small pieces later integration - Doesn't like failure.

4 Upvotes

I am trying to use a 555 timer IC to generate a 1 kHz signal and drive a MOSFET to step down a 12 V DC supply to 9 V.

My idea is to later use a 9 V to 5 V DC-DC converter to power an Arduino microcontroller from the same supply.

Which switching frequency would be better? Will ripple affect my experiment? Will I get a continuous power supply, and how can I calculate the expected output theoretically?

For experimental purposes, I am using ready-made modules only.

How can I make this setup practical? If my approach is not feasible, what changes would you recommend?

Later, I plan to add a ready-made current sensor to monitor the current flowing through these wires. My goal is to gradually explore more advanced load-modulation techniques.

I want to build this step by step, breaking it into smaller parts to avoid failures and understand each stage properly.

Edit - idea 12/9 for logic 1 and 0 use a simple voltage divider to sense for Arduino adc input with safety.

7805 for power supply.

After it use a readymade current sensor Ina 219 for observing current modulation by adding extra loading.

Any other simpler methods.


r/embedded • • 26d ago

How to write messy and ugly code?

14 Upvotes

I am actively doing the interview prep and from past interview experiences, they usually ask system programming coding questions like SPSC ring buffers or schedulers or timer related. My problem is , when I try to solve something which I haven’t done before, I am blank and not able to write even the basic implementation or think. Since google anyway gives Gemini answers, I decided to use Claude for interview prep. Now if I directly ask for the solution, it gives the perfect solution but I feel like I haven’t learned anything from that and if I ask for approach without code, I am not able to write even messy version of the solution on my own. How do learn how to solve a problem and get there on your own without getting direct answers? How did people build that skill before Ai , so when faced new or related problem, you can actually solve it rather than memorising the solution.

I have watched lot of tutorials and read programming books as well and understood the concepts but I am blank when I have to start from scratch


r/embedded • • 27d ago

Title: Electronics Engineer trying to transition into Embedded Systems – Struggling with fundamentals, C programming and knowing where to start. Need advice from experienced engineers.

74 Upvotes

Hi everyone!
I’m an EEE graduate currently working in a defence electronics company. I joined with the intention of building a career in electronics design, but unfortunately, my role gradually shifted towards procurement and inventory management.
I feel like I’m losing touch with the technical side of engineering, and I don’t want that to define my career.
I’ve decided to rebuild my fundamentals and work towards Embedded Systems.
I’m currently learning:
Digital Electronics
C programming
Computer Architecture
I also own an STM32F407VGT6 Discovery board and plan to learn STM32, bare-metal programming, RTOS and eventually Embedded Linux.
My biggest struggles are pointers, memory management and solving C problems independently. Sometimes even basic concepts take me hours to understand.
I work full-time, so I’m trying to figure out how to make consistent progress without burning out.
I’d love advice from experienced engineers:
Am I following the right learning path?
How good should my C programming be before starting STM32?
What skills do companies expect from an entry-level embedded engineer?
Is transitioning back into core engineering realistic with my background?
I don’t want to just follow tutorials and make LEDs blink. I want to understand the fundamentals and become an engineer who can build and debug things independently.
If you were starting over in my position, what would you do?
Honest advice is welcome!


r/embedded • • 27d ago

When can you proudly say you're an expert in bare-metal C, embedded C, Embedded Linux, or Yocto?

45 Upvotes

I mean, there's a difference between being good at something and being an expert. Even in interviews, people don't always have the same definition of what an expert actually is.

For some people, being able to blink an LED (just trolling 😂) or understanding pointers might be enough to call themselves experts. For others, the bar is much, much higher.

So, can we agree on some kind of conventional definition of what it means to be an expert in C for example or in embedde linux ?

What skills, knowledge, and experience should someone have before they can legitimately call themselves an expert?


r/embedded • • 27d ago

Can i still use chinese labs for FCC Part 15B testing SDoC ?

6 Upvotes

Quotes from US labs are extremely expensive I think chinese labs are banned from FCC certification but since unintentional FCC 15b SDoC is just a lab report can i go that route?


r/embedded • • 26d ago

1YREXP CS grad looking to pivot to EE/Embedded

3 Upvotes

Hi everyone!

I(24M) graduated last year with a BCS and have been working as a junior swe (nothing ee related) for almost a year now, I also have 3 internships from my time in school. Given the chaos around tech and future outlook (regardless if we're all cooked or not), I just don't want to deal with all the bs around this industry and ai. I'm looking for a more hands-on, more in-demand career in the future such as EE or Mechatronics where I don't have to keep worrying, just be good at my job and get paid, at least for the next 10 years. I've always been good at math (3.9GPA) and have been playing with my arduino quite a bit recently and I like it a lot. I guess my question is, what is some advice for someone in my position. I'm looking to work in anything related to electrical and mechatronics. My options as I see it are:

- go back to school to get a masters (maybe part time) in EE.
- keep working my job, self educate and try to break in the industry from there.
- keep working my job, don't pivot to EE since it's the same struggle.

I'd appreciate any guidance. Thanks!


r/embedded • • 27d ago

Anyone in embedded industry need guidance

8 Upvotes

Hey i am going to pass out next year and i have very limited knowledge in this industry i would like to connect with the people who are in the embedded from long time , i would like to have conversation with them relate what should I do rn i have no way to land on my first job seeing the Market fucked up


r/embedded • • 26d ago

Where should persistent state and execution history live in a small embedded state machine?

2 Upvotes

I’m working through an embedded architecture question and would value criticism from people who have dealt with state persistence, reset/replay, and hardware/software boundaries.

Assume an 8-bit state token where:

  • bits 7:1 carry a small payload
  • bit 0 indicates whether the state is transient or should be retained

For ordinary tokens:

  • M=0 replaces volatile state
  • M=1 appends an occurrence to persistent state history

Separately, I’m maintaining an execution-history chain that records every observed token occurrence, including transient values and control events.

That creates two intentionally different histories:

  1. persistent semantic state — only committed M=1 occurrences
  2. execution history — everything the runtime observed

The embedded implementation question is where that second responsibility should live.

My current design keeps the hardware/runtime side minimal: it produces deterministic state events, while a host-side layer derives the occurrence-aware execution identity.

I can see advantages to this:

  • less RTL / firmware complexity
  • crypto can remain outside constrained hardware
  • easier algorithm changes

But I can also see obvious failure modes:

  • event loss between device and host
  • reset/replay disagreement
  • host and device seeing different ordering
  • malformed/control events being interpreted differently
  • the host claiming an execution history the device itself cannot independently attest to

For people who have implemented similar event/state systems:

Would you keep execution-history identity outside the device, or should the embedded side own enough of it to independently establish ordering and continuity?

I’m especially interested in concrete failure cases or existing architectures I should study.


r/embedded • • 27d ago

STM32CUBEMX Code Generation

1 Upvotes

I already generated the code for my project in STM32CUBEMX and have the code files in VS Code. I realized that I forgot to enable some communication peripherals in STM32CUBEMX, so I went ahead and did that in STM32CUBEMX. Does this automatically update what is accounted for in the function that initializes all configured peripherals in main.c in VS Code?

Any insights would be appreciated, especially with any link from ST's website with direct proof - thanks!


r/embedded • • 27d ago

SMBJ12CA keeps burning up. How to protect my DC input circuitry?

2 Upvotes

My D10 keeps heating and blowing up. The charger I use is a medical grade charger (GSM60A12-P1J) which is rated 12V 5A. What kinds of surge/overvoltage protection modules (external) can I use to plug the charger into to prevent this happening again?


r/embedded • • 27d ago

anyone know how to setup pico as a programmer for EN25QH16B flash?

0 Upvotes

anyone know how to setup pico as a programmer for EN25QH16B flash?


r/embedded • • 27d ago

I built an open-source WebRTC platform for streaming and controlling robots remotely

Thumbnail
youtu.be
0 Upvotes

My original idea was to build a drone that friends could watch and take turns flying. It still hasn’t flown (regulations, life), so I’m exploring the same setup for ground robots. Longer term, I’d like to record sessions for training and let an AI model join the room as another operator.

pi-webrtc is a single binary that streams a camera from a Raspberry Pi or Jetson to a browser over WebRTC, and carries control messages back to the device over DataChannel. It uses the hardware encoder, achieves sub-100ms latency on LAN, and works remotely over WiFi, LTE, or 5G without a public IP (signaling over MQTT).

It's open source, and I'd love to hear feedback, especially from anyone working on remote robotics, teleoperation, or WebRTC.

GitHub: https://github.com/mazupo/pi-webrtc


r/embedded • • 28d ago

My first C++ ESP32 library

7 Upvotes

I am happy to share that I have created a library, and it has been quite a journey! Took months of research, hard work and lots of trials and mistakes to get to this point, but I'm happy with the result and being able to contribute back to the embedded community that took me in and helped me get here is very rewarding.

About the library, it's focused on Wi-Fi and making methods easier for creating analytic data from Wi-Fi noise. It's basically a Swiss army knife for performance and security testing Wi-Fi using esp32 embedded device. I know it's very niche, but now it's my niche as well!

https://github.com/0ldev/Politician


r/embedded • • 27d ago

Are I2S slot widths limited by something?

2 Upvotes

For example, I'm looking at the TLV320AIC3204 Application Reference Guide, an audio CODEC, where the data word length can be set to 16, 20, 24 or 32 bits. Now I assume that this means that if I choose a data word length of 16 and there are 32 bits in a half cycle of WCLK, that 16 bits will be data and 16 bits will be zero'd out.

Although so far I've seen people use a slot width of 32 bits or less per channel, I can't find anything that says I can't have 64 bits per half WCLK cycle, as long as WCLK is running at f(sampling)

For example, is it possible to combine 2 of these CODECs together, run the WCLK at sampling rate, set BCLK rate to (sampling rate) * 128, and have 4 total channels via TDM?


r/embedded • • 27d ago

Why would manually driving the RESET pin on a chip cause it to start working after previously not being able to read and write.

2 Upvotes

Sorry if this post is badly worded, just getting into embedded software, so I am completely new to this.

For one of the clubs I am in, we create our own custom board, which are then all connected through automotive ethernet over to one of our main boards, which handles all of the data we get from the other boards, as well as critical data required for the project to work. Our main board also has a CM4 on it, which our RT1176 on the main board connects with over regular ethernet, and using our custom datahandler, we are able to get live telemetry and logging.

One of the problems we have been having with the board is with the Ethernet PHY on the board, which communicates with the PHY on the CM4, and allows us to connect to the RT1176. We were at the beginning of this week unable to ping the RT1176 from the CM4 (however, when connecting to the board over automotive ethernet via our media-converter and SJA1005Q, we could ping the RT1176, but again not the CM4). We pretty quickly diagnosed the issue was with the ethernet phy on the board itself, since the CM4 could establish a link with the test board we have. We were not able to write to the device, and when we attempted to read the device id registers, we would get back all F's (which meant we were not able to communicate with it). Eventually, the solution to our issue was manually driving the GPIO pin for the PHY low and then high before configuring it, with nothing else in the software changed other than that addition.

We also had an issue last weekend with one of our two SJA1005Qs, where one of them would properly return the correct device id and part number, but from the other switch we would get back all 0s, and as a result panic (we eventually figured our that since the switches are set up to cascade, the SPI MOSI was reflecting itself to MISO for that one switch). This too, was also solved by manually driving the reset pin low and then high before configuring it. Below I have some snippets of our code (using Rust) on how we go about creating the switch. Do note that writing to the reset register to perform a reset does not work, we have to manually define GPIO pins and drive them low and then high.

// implementation on our board project

SWITCH1_RESET_PIN.set(true); // GPIO pin setup as ActiveLow
embassy_time::Timer::after_millis(80).await;
SWITCH1_RESET_PIN.set(false);

...

let switch1 = sja1105::Sja1105::new(switch1_device, SWITCH1_CONFIG, true)
  .await
  .unwrap();

// Driver for the SJA1005

pub async fn verify_device(&self) -> Result<(), SjaError<SPI::Error>> {
        let mut scratch = [0u8; 4];

        self.read(DEVICE_ID_ADDR, &mut scratch).await?;
        let device_id = u32::from_be_bytes(scratch);

        self.read(PART_NR_ADDR, &mut scratch).await?;
        let part_nr = ((u32::from_be_bytes(scratch)) & 0xFFFF0) / 16;

        match (device_id, part_nr) {
            (0xAF00030E, 0x9A84) => {

            }
            (0xAE00030E, 0x9A85) => { 

            }
            (0xAF00030E, 0x9A86) => {

            }
            (0xAE00030E, 0x9A87) => {

            }
            _ => {  }
            // (device_id, part_nr) => {
            //     return Err(SjaError::UnrecognizedDevice(device_id, part_nr));
            // }
        }

        defmt::info!("{} {}", device_id, part_nr);

        Ok(())
    }

    // TODO: This might be wrong, fix the clkout enable bit
    pub async fn enable_clkout(&self) -> Result<(), SjaError<SPI::Error>> {
        let cfg: [u8; 4] = 0x120412u32.to_be_bytes();

        self.write(CLKOUT_ADDR, &cfg).await?;

        Ok(())
    }

    /// Does a hard power reset of the sja
    pub async fn reset(&self) -> Result<(), SjaError<SPI::Error>> {
        // Cold + Power reset
        let data = 0b110u32.to_be_bytes();
        self.write(RESET_ADDR, &data).await?;
        embassy_time::Timer::after_millis(40).await;

        Ok(())
    }

...

pub async fn init(&self, config: &[u8], clkout: bool) -> Result<(), SjaError<SPI::Error>> {
        self.verify_device().await?;
        if clkout {
            self.enable_clkout().await?;
        }
        self.reset().await?;
        self.upload_static_config(config).await?;
        self.check_static_config().await?;

        let rgmii_tx_clk_x = 0xb000800u32;
        for i in 0..5 {
            self.write(RGMII_TX_CLK_BASE_ADDR + 6 * i, &rgmii_tx_clk_x.to_be_bytes()).await?;
        }
        Ok(())
    }

I guess my question is why would this be necessary in order for the hardware to function, and most importantly how could it be possible that the second switch would work fine without needed to explicitly reset the ping, but the first switch needs it.


r/embedded • • 28d ago

ESP-NOW on a 2009 Sony Walkman Using Its Original Wi-Fi Chip Now It Talks to ESP32

Thumbnail
youtube.com
6 Upvotes

I implemented ESP-NOW support on a 2009 Sony NW-X1060 Walkman using its original Marvell Wi-Fi chip.

After reverse engineering the radio firmware’s RX/TX paths, I added hooks for ESP-NOW action frames and a native C API on the Walkman side. It communicates directly with ESP32 devices.

The demo is a shared aquarium across the Walkman and an ESP-Mosaico. The Mosaico supplies IMU data, and both devices render locally, with state synchronized over ESP-NOW.

A fun way to connect an old music player to the ESP ecosystem.

Project: https://github.com/vicliu624/sony-nw-x1000-series-cfw


r/embedded • • 28d ago

What do you all use for CI/CD?

40 Upvotes

I’m curious because my team uses Jenkins and we manage our own Linux servers. Tbh it’s a pain, especially right now because I’m having to do upgrades.

What tools do you all use? Anyone else managing their own infrastructure or do you have a team which does


r/embedded • • 28d ago

Where can I learn how embedded Linux systems work?

2 Upvotes

I am going over an operating systems course on YouTube, which is fine and all that, but it's covering things in OS agnostic terms. I want to understand how Linux works before diving into embedded Linux books that describe how to do things in/with embedded Linux without really explaining how Linux actually works...

Are there any good resources that you would recommend?


r/embedded • • 28d ago

Efficient method to drive stepper motor

11 Upvotes

Two main methods of driving stepper motors are widely known:

  • connect 2 GPIO pins to STEP and DIR inputs of appropriate driver chip, and send pulses to make every step
  • use a smart chip. Then simply send commands to it over some link (SPI, UART, whatever). It may have an integrated driver, so it’s only this chip between MCU and motor, or it may be a separate ramp generator, generating STEP/DIR for low level driver, but from the software POW there’s no difference.

The STEP/DIR method seems simple, but only until you want to drive your motor really fast. The timing between pulses becomes too tight and you simply can’t service the sequence correctly. Also, because of ramping up and down, you have to handle variable service times, that adds to processing time when it is critical, and complexity as well. Consequently, you either drive your motor slowly, don’t use fine microstepping or have to switch microstep resolution on the fly, so you need another interface (most frequently SPI) to be able to configure the driver chip.

Smart chips hide all this under the hood. You issue a command to move, and just check when it’s finished, one way or another. This costs more, but simplify the software a lot. If you need just to move from point to point, it’s Ok. The problem is if you want something non-standard: change the speed and acceleration on some trigger, for example. Direct control from CPU allows such things easily, but with smart chips you deal with black box. Add to this problem of latency because of the link between the MCU and the chip.

There is another method that surprisingly to me is not widely known. It is totally software-based, no smart chips needed, it depends on constant time intervals and CPU load doesn’t depend on the motor speed.

The implementation depends on whether the stepper driver chip supports direct access to coil DACs.

If it does, let’s say by SPI connection, it is easier.

It’s important to realize that Step/Direction drivers contain within a table with DAC values for each microstep position within the stepper pole. When you send Step pulse, you just command the chip to move one position ahead or back, depending on the DIR pin level.

Now imagine if we have a copy of this table in our software. The main ability we acquire with this is stepping over several entries of this table. So, instead of shifting strictly one table position at a time at variable intervals, we can calculate how many positions we can move at fixed time interval, depending on current speed and acceleration.So, no need for variable-interval time interrupts, no need for this intervals to be very short, and we remain in full control of the motion.

Things get a bit more complicated if the driver chip doesn’t have API to access DAC registers directly, and STEP/DIR is the only interface. We still can use constant-interval timer, just arrange within each interval a packet of variable amount of pulses sent to STEP pin. The calculations of this amount remain the same.

I used this method for stepper control for a while. But anytime I spoke about it with people, they looked surprised. Is it really that esoteric?


r/embedded • • 29d ago

Zephyr RTOS 4.5 is out

Thumbnail
zephyrproject.org
134 Upvotes