/r/embedded

Photograph via snooOG

This sub is dedicated to discussion and questions about embedded systems: "a controller programmed and controlled by a real-time operating system (RTOS) with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints."

Welcome to embeddit!

Description

This sub is dedicated to discussion and questions about embedded systems: "a controller programmed and controlled by a real-time operating system (RTOS) with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints."

FAQ

The FAQ is in the wiki.

On topic subjects

  • Hardware design that includes a micro
  • Low level software (e.g., C, assembly)
  • Homework help; but make it clear it's homework

Off topic subjects

Rules

  1. Be civil: do not insult; no all-caps, no excessive "!" and "?", please.
  2. Submissions must be on topic
  3. If asking a question, ask the actual question, fully yet concisely, right in the title
  4. No spam; no commercial posts, links to commercial pages (including crowd funding sites), no employment ads (job offers and requests go to the weekly thread), no self-promotion (*)
  5. No memes (pictures with superimposed text), shit posts

(*) At mods' discretion, certain self-promotion submissions from people who contribute to this sub in other ways may be allowed and tagged with the "Self-promo" flair

Complete rules:/r/embedded/about/rules/

Link flairs

After posting a submission, please select a flair:

  • General: not a question, yet on topic
  • Tech question
  • General question: any question that is not technical
  • Off-topic

After your question is answered, please change the flair to "Resolved".

Related sub-reddits:

/r/embedded

168,807 Subscribers

11

Why do different microcontroller families support running off of external flash or not?

As far as I can tell from reading documents: RP2040 requires external flash for user code. ESP32 typically wants external flash for user code. STM32 typically doesn't support external flash for user code, except a few higher end models. These are just examples that I happened to see.

The downstream effect seems to be that RP2040 and ESP32 boards very often provide anywhere from 2 MB to 16 MB of external flash, whereas STM32, at least for the STM32F4 line, seems to cap out at 2 MB onboard flash, and quite often has quite less, as low as 128 KB.

Are there reasons for these trends? Does one or the other involve tradeoffs? How often is the onboard few hundred KB sufficient for user firmware, versus how often is an external few MB needed? What's stopping other microcontroller models and families from support?

Excuse me that I'm a hobbyist, and looking in from outside, out of curiosity. Thanks in advance.

8 Comments
2024/04/28
06:23 UTC

2

STM32 and SIM7080 NB-IoT FOTA

Hey guys, I've been developing a remote system using an STM32G0 64Kb flash and a SIM7080G NB-IoT module. This system will be spread all over the country, the intention is until next year we have about 1k units running. I'm in the middle of the progress of having a definite design, I'm working now on the second version for the prototype. And I was thinking if it would be worth developing a FOTA functionality to it. My current firmware uses about half of the flash available. Honestly, I don't plan on making any significant changes on the firmware once the devices are delivered. But we never know, and that's the thing I wanted to ask you guy's opinion. And if it's worth it, what would be the best method of accomplishing it?

2 Comments
2024/04/28
04:29 UTC

4

The right way to self-teach Embedded Linux

Hi guys,

I am an embedded software/electronics engineer with 2+ years of experience. At the moment, my work mostly focuses on bare metal development, so I am self-teaching embedded Linux in my spare time.

I am currently learning to develop application on Raspberry Pi in the user space that involves reading sensor output, MQTT, BLE. I plan to learn how to use buildroot/Yocto for compiling my project as well.

Is it sufficient from the career perspective to just develop user space applications? Or should I learn how to write a kernel device driver as well? Do you guys mostly work on kernel or user space at work?

2 Comments
2024/04/28
02:17 UTC

3

Can a SAMD11C14 handle I2C, analog in, and host serial communications?

I'm a relatively experienced Arduino user but am very much new to bare metal embedded development. I am working on a system to read a value from an I2C sensor and also read an analog sensor, then spit out these values continuously over the USB-based serial port. To that end, I've created a board based on the SAMD11C14 and was hoping to use an Arduino bootloader to enable me to program this in the Arduino IDE.

Unfortunately, it seems that the SAMD11C14 can barely handle the analog sensor and serial comms with this approach. Attempting to integrate an I2C library puts me way over the edge in terms of flash memory. So, I've been investigating developing this in Microchip Studio. I've been able to do basic things like flash an LED, but even following examples, the ADC seems rather complicated. I've got a J-Link and adapter for the SWD interface.

Might anyone be able to point me to a solid Microchip Studio tutorial for someone with as little experience as I have? Based on your understanding of my limited experience, should I just respin a new board based on a more capable MCU? Is there any hope that the SAMD11C14 will be able to handle what I need to do?

Please advise on what additional information you need to answer these questions. Schematic is below if that helps.

12 Comments
2024/04/28
01:43 UTC

6

What materials should I get before I head back to my country??

I am a second year compe student and I wanted to spend this summer tinkering and learning about hardware. I am hoping that after much practice and tinkering I can build projects along the way that I can list on my resume. I know arduino is beginner friendly so I am considering that, but it also seems to be looked down on in professional fields. So I was thinking of getting a STM32 Nucleo board so I can practice with it after learning about arduino first. But I have also been looking at possible projects I want to do and I find WiFi/Bluetooth projects really interesting, so I was considering also getting an ESP32 board..

Problem is I have a limited budget lol so I think I need to decide between the STM32 and ESP32 because the arduino comes with a kit of peripheral components I want to use( also because I want to learn arduino first too)..But anyway I have just been reading and watching videos about this and I need advice as to what I should be getting..

Oh and I am going back to my country pretty soon for summer so I want to buy the kits and boards from amazon as soon as possible because I won't find these materials where I am from.. Advice would be appreciated! thanks!

12 Comments
2024/04/27
23:10 UTC

13

Pull up resistor for i2c

Hi,

I’m having a hard time understanding the pull up resistor for i2c. I understand that as bus capacitance increases it takes longer for the bus to transition between high and low, thus reducing the pull up resistor will speed up the transition between low and high but from what I understand the pull up resistor won’t affect the fall time? Isn’t fall time just as important as rise time? So I’m stuck on what the point of changing the pull up resistor value is if eventually if it doesn’t change the fall time and eventually we just have to limit the bus capacitance anyways, can’t we just limit the bus capacitance without changing pull up resistor values?

7 Comments
2024/04/27
23:00 UTC

2

booting bbb manually from uboot

Hi guys

I am learning uboot and trying to boot linux manually from uboot. I got stucked on calling the init process (from initrd??)

These are my uboot command:

# load initrd
load mmc 1:1 0x88080000 /boot/initrd.img-5.10.168-ti-r77 

# load kernel 
load mmc 1:1 0x82000000 /boot/vmlinuz-5.10.168-ti-r77 

# load device tree 
load mmc 1:1 0x88000000 /boot/dtbs/5.10.168-ti-r77/am335x-boneblack-uboot-univ.dtb 

# load and apply emmc device tree overlay 
fdt addr 0x88000000 
fdt resize 2048 
load mmc 1:1 0x88400000 /boot/dtbs/5.10.168-ti-r77/overlays/BB-BONE-eMMC1-01-00A0.dtbo fdt apply 0x88400000 

# set bootargs setenv bootargs console=ttyS0,115200n8 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait 

# boot linux 
bootz 0x82000000 0x88080000:7a5dfa 88000000

There are my error logs, it seems to failed to call init (from initrd??)

[   15.213081] Run /init as init process
[   15.217479] Failed to execute /init (error -2)
[   15.222121] Run /sbin/init as init process
[   15.226664] Run /etc/init as init process
[   15.231036] Run /bin/init as init process
[   15.235625] Run /bin/sh as init process
[   15.239782] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[   15.254048] ---[ end Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]---

How do I config uboot to call this init process correctly??

PS:

0 Comments
2024/04/27
22:23 UTC

2

Intel Legacy Galileo Board

I have an old Intel Galileo, is it worth spending time on it or should I just let it go?

2 Comments
2024/04/27
21:38 UTC

0

Advice, books? training? I am a full-stack software engineer IN TEST turning into an embedded Test Engineer

Hello everyone, I start a new job as a Test Engineer in about a week. I have been a full-stack software engineer in test (I say that to emphasize the type of work I did) for about 2 years.

I am entirely new to the embedded testing world. I was very very transparent with the team that interviewed me and they are more than happy to bring me on board.

I've been brushing up on certain topics of knowledge, but essentially I have ZERO hardware/embedded experience whatsoever.

I have gained some great info from this sub. Lots of really great people and I am very excited to be moving my career in a different direction.

I am particularly interested in books to read, I love books. I have some udemy courses but I tend to collect those and make less use of them sometimes.

I will be using a lot of Python, Linux, and a tool called LabView. Eventually I'll be moving into using c and c++ if I can get into the engineering side of things.

I was told to learn about rf and dB, and most likely I'll need a better grasp of electrical engineering concepts. The last topic I've been doing my best to get my feet wet with, but I am not an electrical engineer and I'm busy enough as it is lol

2 Comments
2024/04/27
21:06 UTC

11

ADC time conversion in STM32

When I used the ADC in the STM32F446RE and configured it using STM32CubeMX with the settings shown in the image, and with a clock frequency of 180MHz and APB2 frequency of 90MHz, I tried to measure the duration of the ADC conversion. I set the pin high before the ADC conversion and then reset it low afterward to calculate the duration of time it was high using an oscilloscope. I found that the duration was approximately 50μs, which is higher than expected. I tried to find the reason for this prolonged conversion time, but I couldn't identify the cause. However, I noticed that the function HAL_ADC_Start is the one taking a long time. Can anyone help me understand the reason for this and how to reduce its duration?

11 Comments
2024/04/27
16:02 UTC

0

Noob questions about SPI and how to replicate its signals?

I have 2 devices, one spa control system the other is a display to control it. The two are connected through SPI (I think?), I would like to replicate the commands sent by display to control system to be able to make my own controller (some kind of wireless device).
So my questions are.
1- How can I go about doing that?
2- Who is slave and who is master in this situation
3- On idle using logic analyzer I got this

https://preview.redd.it/32dvfa9uk1xc1.png?width=980&format=png&auto=webp&s=7124e11f16b653930069b32bf9a309a5ccdb7a61

And when sending a command from display...

https://preview.redd.it/vzuhq9k7l1xc1.png?width=980&format=png&auto=webp&s=71dd6e59df059e6d0eb89e6edd4357cd35989856

Is this SPI? and is orange MISO, and blue MOSI?

2 Comments
2024/04/27
15:45 UTC

8

Is it possible to port software from ESP32 to ARM cortex M?

Can you tell me the challenges, What should i put into consideration, etc?

8 Comments
2024/04/27
14:06 UTC

65

Hate for AUTOSAR

I'm an entry-level Embedded Software engineer. I recently read a post which basically said that a sizeable chunk of the r/embedded community hates the Automotive industry (something about how the industry takes the power from the Software Developers to the System Engineers).

Can someone please explain what that means? And why exactly does the hate exist?

Does it have something to do with the standards followed in the Automotive industry? If so, what's wrong with the standards?

69 Comments
2024/04/27
13:54 UTC

6

Automotive vs other fields

I understand that this community kinda hates AUTOSAR but I am still gonna ask for an unbiased opinion.

I have been working in Automotive for 3 years now - Legacy project - Base Software, hand-written codes, semi-AUTOSAR- little to no code generation. I do share the dislike of AUTOSAR/generational tools of the community and I want to steer away from this because I will be using full-on AUTOSAR if I continue. But automotive industry seems stable. I donot see, in the near future, automotive going down. Is it same for other industries in embedded?

Context: Now I am in the middle of a switch and I have an offer to join a startup company where they make BMS(Battery Management Systems) for vehicles(kinda automotive too but it is baremetal here). I also have other offers from Automotive companies.

The market is tough right now and I want to know if I am making a mistake steering away from automotive industry.

1 Comment
2024/04/27
13:11 UTC

0

Is having a bachelors in Software Engineering a disadvantage when applying to embedded jobs?

Even if one had managed to learn the required skills to work in the field.

10 Comments
2024/04/27
10:50 UTC

9

Why do I2C and SPI require more than one wire? Since full-duplex communication over one wire is possible, what is the factor that limits having full-duplex using only one wire?

We could use FDMA or CDMA to be able to put more signals in a single medium. So we could do it to send CLK, txA and txB. So what's the limiting factor which is instead let us use I2C and SPI?

52 Comments
2024/04/27
09:43 UTC

8

Wondering about the work culture in Embedded vs SWE. Should I transition out?

8 years of being an Embedded engineer and I love the work. I've worked on some cool products at their very initial stages. Built firmware stacks from scratch for multiple hardware startups. Also worked at big companies on known products like Amazon Astro and Echo family.

Although I am never really satisfied with what I get in terms of working environment and culture at these places. The more I work in Embedded the more I come across old school work environments — conformity based top-down culture, incompetent management, little flexibility to work remote even if it's possible, and simply anti-social work culture.

On the other hand, I frequently hear all these stories from my SWE friends in the Bay Area and elsewhere. Their managers seem much more easygoing than the ones I've had throughout my career. Basic things I would feel lucky to get in embedded/hardware industry seem to be the norm in SWE — coworkers working and traveling frequently without issues, company parties (good ones), team offsites, social and friendly coworkers, payscale, good promo and raises, un-enforced RTOs, etc.

If I even attempt to fight for one of these in the hardware industry I look like a weirdo, like "who does that?"

I love Embedded, which is why I got into it despite the steep learning curve. But I am realizing that investing the same time and effort in SWE instead will end up getting me a much better lifestyle.

Am I just unlucky and working at bad companies?

11 Comments
2024/04/27
08:38 UTC

1

GET embedded engineer role in TATA technologies. I want to know how i should prepare for interview any recent experience is shared that could be a great help. So how should I prepare ?

I have been shortlisted for GET Embedded engineer role in tata technologies. So how should i Prepare for the interview and what are the topics and coding questions I should look into?

1 Comment
2024/04/27
07:42 UTC

3 Comments
2024/04/27
06:57 UTC

5

Why does my RNDIS device expose itself as a gateway on host PC?

I have an embedded Linux device with a USB port. I set up RNDIS so that if I connect my PC to this device, the device automatically gets added as an RNDIS device. It has an IP address. I can SSH and everything works fine. However, I'm finding that this device also adds itself as a gateway, which means I lose internet access (since my device isn't connected to the internet).

How do I get my RNDIS device to stop adding itself as a gateway on my host PC?

3 Comments
2024/04/27
05:18 UTC

8

Wireless real time streaming

Hi all. My first post here and I could use some advice.

I have an application that is essentially real time (or as close to real time wireless can give you) positional data streaming. The high level info is I will have roughly a 20-25 byte payload that I need to transmit around at least a 1KHz rate.

I have been looking into BLE as it seems to be the gold standard of BT communication at the moment. It is perfect for the small positional packets I am looking to send. However from my research it seems extremely unlikely it can support a 1KHz update rate. And I don't blame it, real time streaming applications are not its intended use.

I would love some insights on other potential solutions. Bluetooth Classic came to mind as you can constantly send information and do not have connection intervals like you do in BLE. But I have a really hard time finding good Bluetooth Classic chips to develop on and it seems like pretty much everything points you towards BLE.

The only other viable solution I could think of was wifi or wifi peer to peer. This has the opposite problem as it has a much larger bandwidth but expects bigger packets. My idea would be to set the MTU to the lowest possible value and send out the packets as fast as possible. It seems like even a conservative throughput of 5Mbits/second with say a 128 byte MTU would still result in a ~5KHz update rate.

For positional tracking, any other position other than the current position is of little value to me. That is why I would opt to set small MTUs and send them out quick. Buffering 10 positions in a packet doesn't do me much good if I only care about the most recent one.

I would absolutely love to use BLE. A wifi chip would obviously increase power draw substantially. I would love any input or suggestions you all may have. Maybe there is a protocol I am not thinking of. Or maybe my approaches outlined here dont make sense.

Thanks

14 Comments
2024/04/27
03:17 UTC

0

Saleae logic analyzer clone: Do I have to re-load the fx2lafw firmware every time I plug it in?

I picked up one of those cheap USB logic analyzers, a "HiLetgo USB Logic Analyzer Device", and I'm finding my way around the tools. I got it working with PulseView on Windows, but there's something that has me puzzled.

It seems that every time I plug in the device, it has to re-install the fx2lafw firmware when I fire up PulseView. I'm hoping it's possible to have it stay loaded on the device between uses, but maybe it's not. (I know, for $13, what am I complaining about?)

Anyway, so I got the USB driver installed for it using Zadig, and got it working in PulseView for the first time.

If I unplug the device and plug it back in, it shows up as "Unidentified device #1". It still has the WinUSB driver associated with it.

Then when I start PulseView, nothing seems to happen for about two full minutes. Finally, I hear the chime sound like I've plugged in a device. PulseView opens on the screen. And now, if I look in Device Manager, or in the system tray, or in Zadig, the device name has changed from "Unidentified device #1" to "fx2lafw", and I can use the logic analyzer.

If I close PulseView, the fx2lafw name stays, and I can re-open PulseView and still be good to go. Until I unplug the device. Then the next time I open PulseView, I have to repeat the 2-minute loading process before PulseView will open.

So it looks like what's probably happening is, PulseView is having to re-load the firmware to the logic analyzer every time I plug it in.

Maybe this is normal? Maybe the cheap device doesn't have any non-volatile memory? Or is there something I can do to make it stay loaded between uses?

Thanks in advance.

2 Comments
2024/04/26
21:27 UTC

3

Issues with PTP Implementation on STM32H743: Seeking Guidance

Hi everyone,

I'm currently working on implementing PTP (Precision Time Protocol) on an STM32H743 Nucleo board. I've diligently followed all the programming instructions outlined in the Reference Manual and configured lwIP accordingly to support PTP.

My setup seems to be functioning properly as I'm able to receive PTPv2 packets, and upon inspection with WireShark, they appear to be correct. However, I'm encountering instability with the offsetFromMaster parameter "locks around 300ms which is too much".

To tackle this, I've initialized the MACSSIR and MACTSAR registers using the equations provided in the reference manual (RM0433, page. 2837). Despite this, I find myself manually Fine-Tuning the addend register by hand, which I suspect isn't the intended approach.

Here are some details of my configuration:

  • SYSCLK = 400MHz
  • HCLK = 200MHz
  • MACSSIR = 43

I've calculated the Addend Register Value as follows:

  • (2^32 / (200MHz/50MHz))
  • Also attempted (2^63 / (200MHz * 43))

I'd appreciate any insights or suggestions on how to address this issue.

Thank you in advance for your help.

Reference repo: github-ptp-h7

1 Comment
2024/04/26
19:56 UTC

5

Embedded open source project for first time contributors

Firmware engineer in a storage based company. I want to start contributing to open source repo.

Looking for suggestions,

4 Comments
2024/04/26
18:27 UTC

2

Confused about Career in EU and in general

Hello, I wanna do computer engineering in university. I've been really interested in digital logic systems, C++ and how computers work fundamentally, i feel happy learning and interested in learning about them. I've been passionate about FPGAs and ASICS

If you dont have time you can just skip to my questions

Also importantly i wanna first do my bachelors then take a break for 2 years then go back into masters

But a few things are creating question marks in my head, firstly i've decided id probably go into the hardware-ish part of things because it is very well known that software is overly saturated right now, I decided that i would probably wanna go into 3 specific job fields, these being VLSI, ASIC and FPGAs, and less likely but still wouldnt mind, Embedded engineering/design.

But the thing i heard that these jobs have very low demand and in EU(Specifically Germany) the pay isnt that well. Of course doing something you enjoy is more important than pay, but i already enjoy all of them but worried about the employment and pay. A few good questions would be

1.What is the job availability in EU(germany) for VLSI,ASIC,FPGAs,Embedded?

2.What is the pay like for any of them (In EU)? Esspecially right out of school with bachelors

3.Anything extra you would like to tell me?

So, i would love to hear any experienced peoples opinions on this, Im choosing my degree next year.

8 Comments
2024/04/26
17:49 UTC

9

C++ Embedded Safe Error Handling

Hey all! Wanted to share an "embedded safe" error handling framework originally developed by a co-worker, and then modified/adapted to my specific taste over time. It's definitely not perfect, but it's given me a relatively sane way to handle errors in my program and figured I'd share.

The pros:

  • Relatively lightweight, uses integers and const char* under the hood to provide error codes/error messages for descriptive error logging
  • When using the convenience macros, filename/line number are stored at the point where the error is set which is really handy when you want to "bubble up" your error to the caller and preserve the exact location it happened
  • The bool operator makes error checking easy with if(err)...
  • Easy to convert C API's error codes into an Error object
  • Provides an easy way to check and log "unrecoverable errors", which should stop firmware execution

The cons:

  • More boilerplate to remember:
    • if(err) {return;}
    • An extra function input parameter for any function that can produce an error (int someFunc(int a, int b, Error &err))
  • Have to remember to pass Error by reference to functions, otherwise behavior is not at all what you expect :)
  • In a non-void returning function, there's nothing to stop you from using the return value and NOT checking if there was an error condition

An example gist demonstrating use:
https://gist.github.com/haydenridd/bd5cc9d5b6a1dfa3074adbc20bf75d34

And the same thing but run online:
https://onlinegdb.com/567-imV2l

Note that if you want to use this in your embedded system you would need to supply your own logging/unrecoverable error handling strategies! I use exit() and printf() system calls for demonstration purposes which are definitely not "embedded safe" :)

Also interested to see how y'all handle errors in embedded C++ where the "default" error handling strategy (exceptions) is persona non grata.

7 Comments
2024/04/26
17:22 UTC

4

Software Engineering student wanting to go into embedded software

Hello, I am going to be pursuing a software engineering MS

https://catalog.uhcl.edu/preview_program.php?catoid=19&poid=4864

What electives should I take, or what hardware / electronics do I need to learn for embedded software engineering jobs? My bachelors was in IT and I focused on mostly web application development, so I im not to worried about picking up c/c++ However I am a ittle worried that, I did not see more then precal in mathematics. And my knowledge of hardware, circuits and things like that is basically zero. I essentially want to work with embedded but in the software side but i want to work with real time projects and products. I am also young (24) for some people lol, so I have thought about doing a post-bacc in Computer Engineering or Computer Engineering Technology, but I feel this is more being and embedded systems engineering not embedded software.

https://catalog.uhcl.edu/preview_program.php?catoid=19&poid=4835

https://publications.uh.edu/preview_program.php?catoid=44&poid=15528

12 Comments
2024/04/26
16:20 UTC

0

dsPIC 30F4011 - Port B set as Digital Output pins

This is a code I wrote for generating pulses. PortB is set as digital output pins and while in debugging mode, I can see the pulses being generated. But when I run it on hardware, I get no output at all. Why is it so? Anything I'm missing? (By the way, when I configure PortD as output, I do get properpulses as output on hardware). Any help would be greatly appreciated.thanks in advance.

#include <xc.h>

#include <p30f4011.h>

void main()

{

ADPCFG = 0x01FF;

TRISB = 0;

PORTB = 0;

int i,j;

while(1)

{

for(i = 0; i <= 248; i++)

{

for(j = 0; j <= 248; j++);

}

PORTB = ~PORTB;

}

}

1 Comment
2024/04/26
15:32 UTC

2

Nvidia Jetson Nano - How can I load modules for Wifi/Bluetooth?

I am working on a project and I am kind of a novice still. Not sure if this is the right place to ask, but I am a bit confused and wondering if someone can at least guide me to the right direction where I can figure this out. I used Yocto to build an image for my Jetson Nano Devkit 4GB from Linux 4 Tegra and I was successfully able to build with recipes including python3, git, bluez5, iw, UVC, and a bunch of other recipes. I have a Wifi/Bluetooth NIC module from Intel installed that the device recognizes. I previously flashed this Jetson Nano with an image provided by Nvidia via SDK Manager and was able to use wifi, but for the purpose of my project I want to get this to work with my custom Yocto build.
When I use lsmod I don't see iw or bluez. What am I missing?

2 Comments
2024/04/26
15:23 UTC

234

Guys/girls.. the job market is waking up again!

I'm seeing a steady increase of LinkedIn recruiter messages hitting my mail box lately after 5-6 months of almost complete silence.

Mostly super senior jobs (like writing DSP stuff for 400GE). But also a few junior-esque positions.

This started ~2 weeks ago. Heads up!

(Central Europe)

78 Comments
2024/04/26
15:12 UTC

Back To Top