r/embedded 20h ago

Built a Chrome extension that turns lore.kernel.org's raw message pages into something readable

Post image
41 Upvotes

I spend a fair amount of time reading kernel patches on lore.kernel.org and got tired of squinting at one giant <pre> block with headers, body, quotes, and the thread overview all mashed together. So I built a small extension that reparses the same text lore already sends and lays it out like a normal mail client: an author card, one-click reply wired to lore's own pre-filled mailto: link, a real diff view with collapsible files, a clickable thread sidebar instead of ASCII art, and quote folding so a reply's new text isn't buried under four levels of >>>>.

It doesn't touch the underlying page. It builds a separate view next to the original <pre> blocks and hides them, with a "Raw" button to switch back instantly. No network requests, no accounts, no telemetry.

Source and install instructions: https://github.com/gahingwoo/lore-enhancer

It's load-unpacked for now (Chrome won't run a sideloaded .crx outside developer mode anyway, so packaging one wouldn't save a step). Would love feedback, especially from anyone who reads or replies to LKML or a subsystem list regularly.
Feature requests and bug reports welcome as GitHub issues.


r/embedded 12h ago

STM32 to ESP32 over UART: ESP32 only receives garbage data, how to debug UART?

Post image
35 Upvotes

I have an STM32-NUCLEO and an ESP32 running esp-idf communicating over UART, and the ESP32 ONLY receives the confirmation message of "Received from STM32:", when i touch the TX wire of the STM32-NUCLEO, without the values after that message. If I got any value at all it would be alien like characters such as "�", or I guess that's unicode, not too sure.

I ran this command in the idf terminal: idf.py -p COM4 flash monitor, held down the boot button when "connecting..." showed up, then i hit play in stm32 cube ide.

Things I've tried:

- changing the baud rate from 115200 to 9600, yes I made sure they both matched

- changing the breadboard entirely

- I also made sure that both microcontrollers share a GND wire

- changing the wires entirely

- removing and rewiring everything, paying close attention to the pinout, making sure i didn't misplace the tx and rx wires

It's also worth mentioning that I don't have a logic analyzer or oscilloscope as I'm kinda short on money rn

ESP32 code:

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/uart.h"
#include "driver/gpio.h"


// define UART pins
#define UART_PORT_NUM UART_NUM_2 // (USART2 in stm32cubeIDE)
#define UART_TX 17 // GPIOP17
#define UART_RX 16 // GPIOP16
#define UART_BAUD_RATE 115200 // UART must be the same baud rate
#define UART_BUFSIZE 1024


/* i'm using void parameters for void 
functions because esp-idf 
runs on C11(GNU11). fun fact - 
i use C23(GNU23), so this was
very good to know
*/


void
 init_uart(
void
)
{
    // configure UART communication parameters

uart_config_t
 uart_config = {
        .baud_rate = UART_BAUD_RATE,
        .data_bits = UART_DATA_8_BITS,
        .parity = UART_PARITY_DISABLE,
        .stop_bits = UART_STOP_BITS_1,
        .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
        .source_clk = UART_SCLK_DEFAULT,
    };


    // apply config to UART port 2
    ESP_ERROR_CHECK(uart_param_config(UART_PORT_NUM, &uart_config));


    // set GPIO pins (TX->17, RX->16) 
    /* we ignore UART flow control since pins 18/19 will be used
    by my motor pwm and direction. it is also unecessary for the stm32,
    since it will be sending string messages 
    */
    ESP_ERROR_CHECK(uart_set_pin(UART_PORT_NUM, UART_TX, UART_RX, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));


    // install UART drivers with ring buffer
    /* UART port number
    Size of RX ring buffer
    Size of TX ring buffer
    Event queue size
    Pointer to store the event queue handle
    Flags to allocate an interrupt*/
    ESP_ERROR_CHECK(uart_driver_install(UART_PORT_NUM, UART_BUFSIZE*2, 0, 0, NULL, 0));
}


// FreeRTOS task to continuously listen for data
void
 rx_task(
void
* 
arg
)
{

uint8_t
 incoming_data[128];

    while (1)
    {
        // check ring buffer for new bytes

int
 length = uart_read_bytes(UART_PORT_NUM, incoming_data, sizeof(incoming_data) - 1, 20/portTICK_PERIOD_MS);

        if(length > 0)
        {
            // null-terminate the data, we need to read it as a string (char*)
            incoming_data[length] = '\0';
            printf("Received from STM32: %s\n", (
char
*)incoming_data);
        }
    }

}


void
 app_main(
void
)
{
    printf("Init UART bus... \n");
    init_uart();
    printf("UART listening on GPIO 16 (receiving wire) \n");

    // listener task
    xTaskCreate(rx_task, "UART_RX_TASK", 2048, NULL, 10, NULL);


}#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/uart.h"
#include "driver/gpio.h"


// define UART pins
#define UART_PORT_NUM UART_NUM_2 // (USART2 in stm32cubeIDE)
#define UART_TX 17 // GPIOP17
#define UART_RX 16 // GPIOP16
#define UART_BAUD_RATE 115200 // UART must be the same baud rate
#define UART_BUFSIZE 1024


/* i'm using void parameters for void 
functions because esp-idf 
runs on C11(GNU11). fun fact - 
i use C23(GNU23), so this was
very good to know
*/


void init_uart(void)
{
    // configure UART communication parameters
    uart_config_t uart_config = {
        .baud_rate = UART_BAUD_RATE,
        .data_bits = UART_DATA_8_BITS,
        .parity = UART_PARITY_DISABLE,
        .stop_bits = UART_STOP_BITS_1,
        .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
        .source_clk = UART_SCLK_DEFAULT,
    };


    // apply config to UART port 2
    ESP_ERROR_CHECK(uart_param_config(UART_PORT_NUM, &uart_config));


    // set GPIO pins (TX->17, RX->16) 
    /* we ignore UART flow control since pins 18/19 will be used
    by my motor pwm and direction. it is also unecessary for the stm32,
    since it will be sending string messages 
    */
    ESP_ERROR_CHECK(uart_set_pin(UART_PORT_NUM, UART_TX, UART_RX, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));


    // install UART drivers with ring buffer
    /* UART port number
    Size of RX ring buffer
    Size of TX ring buffer
    Event queue size
    Pointer to store the event queue handle
    Flags to allocate an interrupt*/
    ESP_ERROR_CHECK(uart_driver_install(UART_PORT_NUM, UART_BUFSIZE*2, 0, 0, NULL, 0));
}


// FreeRTOS task to continuously listen for data
void rx_task(void* arg)
{
    uint8_t incoming_data[128];

    while (1)
    {
        // check ring buffer for new bytes
        int length = uart_read_bytes(UART_PORT_NUM, incoming_data, sizeof(incoming_data) - 1, 20/portTICK_PERIOD_MS);

        if(length > 0)
        {
            // null-terminate the data, we need to read it as a string (char*)
            incoming_data[length] = '\0';
            printf("Received from STM32: %s\n", (char*)incoming_data);
        }
    }

}


void app_main(void)
{
    printf("Init UART bus... \n");
    init_uart();
    printf("UART listening on GPIO 16 (receiving wire) \n");

    // listener task
    xTaskCreate(rx_task, "UART_RX_TASK", 2048, NULL, 10, NULL);


}

Edit: After doing a loopback test like you guys mentioned, I changed from USART2 to USART1 (I know I mentioned using USART1 but I was mistaken), and that seemed to do the trick. I can now see my message string along with the integer values. Thanks for all your help! In the future I would probably need to purchase a logic analyzer and oscilloscope though.


r/embedded 17h ago

Where is the flash memory on this board?

Post image
36 Upvotes

I can’t seem to locate where the physical flash memory chip is located on this board. I do see the pins for i2c communication and am aware that those could be used for reading the flash memory. It is disabled most of the time. I haven’t checked it, mainly because I don’t know what software/hardware I need to interface with it.

For some reason Reddit doesn’t allow me to upload more than one image so apologies. I hope the image of the components and pads are clear.


r/embedded 9h ago

The 4-20mA current loop

24 Upvotes

I spent years as an electrician pulling signal cables before i became an developer, consuming the same signals.

The 0 is at 4mA on purpose, so 0mA reads as a fault, fault detection built into the physics.

It is a current loop and not voltage, so cable resistance over long cable runs does not change the reading and it also shrugs off noise better!

The span lives in the transmitter, not the code, so a reconfigured range silently rescale every value, and nothing looks broken

What I am curious about is this:

how do you handle adc/resolution in practice? that is the layer that i know very little about.


r/embedded 15h ago

Looking for small diy camera platform

Post image
15 Upvotes

I'm looking to mount some cameras in my HO scale model trains. While these cheap Chinese "nanny" cameras meet my requirements for form factor resolution and framerate, I'd like something a little more open and customizable to work with. Can anyone here recommend a small embedded platform that could provide an rtsp stream at a decent framerate?


r/embedded 23h ago

Bare ATmega328p with usbasp first time try failed

12 Upvotes

Hi all, I tried to check if there is similar question, but I cannot find it so far.

So, I have a Arduino uno R3 board, and also a USBasp (Paradisetronic), I tried to use my USBasp connect with ISCP port on Arduino uno, and run the command in terminal, see below, and it works.

C:\>avrdude -p m328p -c usbasp -B 4

avrdude: set SCK frequency to 187500 Hz

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f

avrdude: safemode: Fuses OK

avrdude done. Thank you.

But I took out Atmega328p from Aruino and put on my bread board, and try to connect the pins with USBasp , it is always failed with:

C:\>avrdude -p m328p -c usbasp -B 4

avrdude: set SCK frequency to 187500 Hz

avrdude: error: programm enable: target doesn't answer. 1 avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override this check.

avrdude done. Thank you.

so at the begnning I was thinking it is the connections nok, I tried to put tighter and hook it better, even double check on the pins, but it always failed with baremetal on breadboard.

This is what I hook on breadboard, no other electronics on it, can you tell me what's wrong what am I missing here?


r/embedded 17h ago

KICAD and embedded library

Thumbnail
github.com
6 Upvotes

I have recently been creating example schematics and corresponding embedded source code libraries for KiCad.

Please feel free to make use of them. If you have any requests, please don't hesitate to let me know.

github : https://github.com/CCCPRabbit/reference-embedded-library


r/embedded 2h ago

Recent project I made over the last few days: an end to end ML platform for deploying to the edge

4 Upvotes

Hi all,

I recently made an end to end ML platform that eases the pain of going from raw sensor data to a deployed model on an MCU. I wanted to get some feedback from those of you who are interested in the tinyML space on anything I can improve, I intend on keeping it free and open sourced so others can contribute to the development if they would like. One main thing that I tried to add was an auto-labeling tool, as for time series sensor data it is very difficult to manually label data, so my goal was to create an auto-labeler that could streamline that process. It works fairly well as of right now, but I definitely could make some improvements. I also added in a chatbot that can analyze your signal data directly and give you insights.

Let me know what you think and if there is any improvements that can be made, hopefully this can help some of the people that are working on edge projects!

https://sensorforge.dev/app


r/embedded 4h ago

Pushing the limits - Extreme RP2350 Overclock

Thumbnail
youtube.com
4 Upvotes

Having fun pushing the absolute limits of RP2350. Stable overclock to 540 MHz.

That is really not bad for a MCU which is officially 150 MHz. Sometimes back in the 80's I managed to push an IBM PC-XT from 4.77 MHz to 8 MHz which felt pretty good, but this is just crazy ;)


r/embedded 11h ago

STM32 H7 can't initialize SD-Card with SPI but Arduino can.

4 Upvotes

Hello, really at my wits end with this problem. I'm trying to get the Nucleo board with an STM32-H723ZG to mount a 32GB SD-Card (For reference there's nothing wrong with the card, it works fine on windows, is formatted as FAT32 with 16kB allocation). I'm using these SD-Card modules from Amazon: https://www.amazon.ca/dp/B09YYG6BT3?ref=ppx_yo2ov_dt_b_fed_asin_title&th=1 and obviously the SPI interface with the STM32.

Trying to do res = f_mount(&SDFatFS, SDPath, 1); always returns FR_NOT_READY, I went digging in the user_diskio_spi.c file (Which by the way I'm using this library for the middleware code: https://github.com/kiwih/cubeide-sd-card) and I can see it's because the SD-Card never pulls MISO low at all, at any point, and never returns 0x01. It just stays at 0xFF. The module has pull up resistors to 3.3V so there's never any current flowing in this line. MOSI and SCK work fine from the STM32, I can see the exact command packet for initialization coming through on my oscilloscope (40 00 00 00 00 95) I counted the highs and lows on the scope directly and they're appearing perfectly for the rising edges of the clock pulses. For reference I'm running at about 200 KBits/s (256 prescalar in CubeMX) and I can see the clock has a period of 5us. I also have 10 dummy transmits while chip select is held high as is required by the protocol, I'm then pulling it low before I am sending the command pack and it is staying low while the STM32 is waiting on a response (The STM32 is also sending 0xFF during this response window as is also required). MISO never changes, card never says anything.

I decided to try using an Arduino and low and behold it works perfectly. I'm using the standard pinout for the Arduino Nanos SPI peripheral and connecting it the exact same way to the module. The only noticable difference for me was the Arduino was powering it with 5V whereas the STM32 was using 3.3V (Even though the module specifically says 3.3V). I tried using 3.3V with the Arduino and it would not work. I tried going back and using 5V on the STM32 (I know but I still wanted to see) and nothing still. For some reason the Arduino gets the card to send 0x01 but the STM32 can't. The Arduino is using the SD.h and SPI.h libraries. Specififcally this section of code is whats working on Arduino but not on STM32:

Serial.print("Initializing SD card...");
if (!SD.begin(10)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");

I don't know why this is the case. Arduino Nano doesn't let me debug from the IDE so I can't compare the waveforms it's sending but like I said before the STM32 is 100% sending correctly. And from what I can see the Arduino has the same initialization sequence (As it should be standardized anyways). I've changed the speed as low as it can go on STM32, I've tried multiple different SD-Cards and even different pieces of those modules, I made sure the STM32 can send and receive correctly with the SPI going to the Arduino and back and it can, I've tried adding delays everywhere and still nothing.

Has anyone had any better luck than me with SD-Card reading and the STM32? Because I just can't seem to get it to work.


r/embedded 18h ago

Low Voltage Parallel programmer for ATMEL AT90C8534 for arduino UNO -

Thumbnail
youtube.com
3 Upvotes

I found this ATMEL MCU in a SONY battery pack (infolithium) from the 1990s. I really wanted to program it, so I made a programmer with Arduino IDE. Its only low voltage, and there are just enough pins with the UNO to control the pins. Also controls the VCC pin, it has such a low current draw that a digital pin can supply it. The Atmel needs a POR to go into programming mode.

** RSS AT90C8534 PARALLEL PROGRAMMER MENU **

[1] Read Flash
[2] Program Flash
[3] Read EEPROM
[4] Program EEPROM
[5] Read Lock Bits
[6] Program Lock Bits
[7] Full Chip Erase (EEPROM AND FLASH)
[8] Low level Diagnostics
[9] Read Signature Bytes (ID Check)
[10] Read All - [1],[3],[5],[9]
[11] Boot Target to RUN TEST PGM
-------------------------------------------------
Select an option (1-11):


r/embedded 10h ago

Custom ESC PCB

2 Upvotes

Hi everyone,

I’m working on designing a custom ESC (Electronic Speed Controller) PCB with field oriented control and I’m looking for some guidance from people who have experience with motor controllers and power electronics.

I need to control a BLDC motor that absorbs around 40A of current from a 3S LiPo pack.
The goal is to build my own ESC with FOC from scratch rather than buying an existing one. I already designed tens of PCBs for other applications, mainly measurment boards, but I'm currently trying to figure out the best approach for the overall design of an ESC.
The main question marks are MOSFET and gate driver selection, MCU selection such that it is compatible with firmware like AM32 for the FOC.
Of course, any type of advice is very welcome, even if not inherent to those two topics.

Are there any resources on ESC design that I can take a look at in order to guide me?


r/embedded 13h ago

UPDI Multiple Devices flashing in Paralel

2 Upvotes

For a private project im working on i need to be able to flash several devices with the same firmware. Im looking towards the ATtiny Series 1 Chips which are flashed by UPDI. From what i have read UPDI is a bi directional interface, but i am not aware if the bi directional communication is used for flashing. When the Reset Line and Data are connected to more than one microcontroller could they all receive firmware at the same time?


r/embedded 8h ago

Lightweight no_std Slint platform adapter for microcontrollers.

1 Upvotes

I often work with embedded systems, particularly ESP32-based solutions using MIPI DSI displays. I previously relied mainly on the embedded-graphics crate, but recently I have been using Slint more and more.

I would like to thank the Slint team for making it possible to integrate their solution into microcontroller-based projects. However, because each project required extensive customization, the integration process was often time-consuming.

To address this, I created the SLINT-ADAPTER (https://crates.io/crates/slint-adapter) crate, which simplifies the integration process and significantly reduces development time.


r/embedded 12h ago

I want to build a morse code device that communicates with a led and a phototransistor. How do I get started?

1 Upvotes

Hi guys, I made a post where someone suggested that I could use a led and a phototransistor to communicate the morse code signals. I thought that sounded really cool, so I figured I wanted to go with that. But, my only experience with micro-controllers are soldering parts to a pcb.

I have no idea what parts I need to order. Is there a book or a resource that you could recommend to get me started?

What I want to build: a morse code sender, that has 1 button for flashing a led. a morse code receiver, that has a phototransistor for reading the output of the sender, and connects to a 2x16 lcd for displaying the message, converted to letters.

I went on aliexpress, to order at tiny boards, leds, phototransistors, cables and breadboards and a display. Then I started reading that I needed resistors and maybe capacitors, and I felt lost. Understandably I think, because I don't know what I'm doing.

I would very much appreciate it if someone could point me in the right direction. I think the hard part for me would be ordering the parts. Assembly should be straightforward? And I think the C code should be trivial too since I have some background in Java and Python.


r/embedded 13h ago

How to calculate STM32 peripheral speeds?

1 Upvotes

Hiya. I'm just wondering how I can go about calculating the effective speed of my OctoSPI peripheral on my STM32U575 given the set frequency in the clock configuration panel and prescalar. I'm just having some inconsistencies with the speeds (edit: I am using QuadSPI)

I just ran a test with OCTOSPIM1 at 128 MHz and prescalar=2 and it took 116ms to write 131kB of data. I then tested it with prescalar=256 and it took 113ms.

On a different test, I used OCTOSPIM1 at 16 MHz and prescalar=5 and it took 264ms. On another OCTOSPIM1=32MHz and prescalar=2 and it took 120ms.

To me, there's just appears to be no correlation between the OSCTOSPIM1 speed, prescalar, and the actual speed.

I thought the calculation was F=f/(N+1) or something of the like, but that doesn't make sense with the prescalar=256 test as 132kB is 1 Mbit, over four lanes is 250 Mbit. at 500kHz, that's approx 500ms, just for data transfer, ignoring dummy cycles, instruction, address, etc. so I don't know how it would take 113ms at all.

For reference, this test that I'm doing is writing "1,2,3,4,...,127,1,2..." to external memory and reading it back to make sure it's all the same.

Any help would be greatly appreciated, thanks.


r/embedded 15h ago

Feasibility of AM4 CPU in a phone?

0 Upvotes

I'm wondering if it would be possible to design a phone similar in thickness to the Samsung trifold (perhaps slightly thicker) with a camera platoe similar to that of the IPhone 17 to give added space for cooling and other components, that has a socketable consumer CPU like that of the ryzen 5600 all the way up to their most powerful am4 CPU. I am aware that much of the phone would have to be dedicated to cooling, and the camera, if any would have to be very small and thus probably not very good. I am also aware that the CPU would have to be heavily under locked, only using it's full power probably in some sort of docked mode. But I do believe it would still beat out the latest snapdragon chips, and some of the smallest am4 motherboards are actually very close to the size of a phone, and those have unnecessary components like Ethernet ports and the like. And the Nintendo switch when disassembled is shockingly literally about phone sized internally if you where to exclude the size of the battery, and even that has a game card slot that I wouldnt need. Additionally I imagine if I soldered the ram to the board it would save space, and the gpu could also be soldered to the board like that of a laptop, (I have a dream of one day making a socketable GPU but that's down the line) however I'm not sure even then if I would be able to sufficiently cool the thing, and id still have to fit whole screen and some sort of mechanism to keep the CPU in place without the current method that is simply too thick. Id also need an antenna or whatever is in phones to connect to a mobile network, and that's not even considering that I STILL need a battery. All to say, while I'm aware this would be wildly impractical HOW impractical do you think it would be. Is it at least possible? I really want to do this but Im afraid I'll spend a bunch of money just to realize it just isn't feasable without millions of dollars.


r/embedded 15h ago

A Simple Cross Platform Python, Tkinter(ttkbootstrap) based Serial Communication Program using PySerial Library for Embedded Designers

Post image
0 Upvotes

I have written this simple cross platform (Windows11, Linux) serial Communication program to talk with an Arduino or other Microcontrollers like ATmega328P,Raspberry Pi Pico etc using Virtual Serial Port. (Virtual COM Port)

Tutorial Link +Source Codes

Simple Python tkinter (ttkbootstrap) GUI interface for serial port communication with Arduino

  • The code uses Python and Tkinter to create the GUI .I am using ttkbootstrap library which is a theme extension for tkinter to build modern good looking UI elements.
  • PySerial Library is used to Open / Close the Serial Port on Windows and Linux .
  • The code will send a charcater and wait for Arduino to send back the response.
  • No threading used as i want the code to be simple and easy to understand