Bare Metal
Nobody has said anything yet. Be the first.
Embedded systems and firmware: C, RTOS, IoT and automotive
Code that runs where there is no operating system to blame. Microcontrollers, RTOS scheduling, CAN bus, power budgets, bootloaders and the oscilloscope that tells the truth.
Name the chip
MCU, toolchain and RTOS version. "My ESP is broken" is not enough.
Bring the detail
Versions, error text, what you already tried. "It does not work" is not a question anyone can answer.
No drive-by self promotion
Share your own work when it answers the thread. A link with no context is an advert, and it gets removed.
Moderated by Diego Ramírez
Nobody has said anything yet. Be the first.
Showing 9 posts.
Discussion in our team this week, I want outside opinions. Today: IWDG only, ~100 ms timeout, kicked from a low priority FreeRTOS task. Colleague says this is useless, because a stuck high priority task will block the low priority one and we reset, fine, but a runaway loop that still lets the kicking task run will never reset. He wants WWDG with a window, so kicking too early also resets. Constraints: motor control…
Accepted answer
Field returns from farms in Tiruppur district. Controllers resetting at random, and some of them came back with the settings corrupted: pressure set point became 0, or the pump type changed by itself. Bench test: perfect, 2 weeks, zero resets. "Lab bench power supply never shows this. Farm shows it on day one only." I say this sentence to every new engineer now. Going to site One farm, 200 m of cable from the…
Honest question. In my team all the testing is on the target hardware: flash, run, look at the logs and the scope. We have some integration tests on a HIL bench but zero unit tests. When I propose unit tests, the people say is impossible because the code touch registers everywhere. Is a codebase of around 60k lines of C, STM32, FreeRTOS. The drivers call the HAL directly from the application logic in many places.…
Every few months a junior in my team come with the same bug: a counter updated in an interrupt, read in the main loop, and sometimes the value is garbage. And the first answer is always "but I put volatile". So here is the explanation I give them, maybe is useful for someone else. What volatile does volatile tells the compiler: this variable can change outside of the normal program flow, so read it from memory every…
All four of these went to the field in products with my name in the git blame. All four passed bench testing. Sharing so you can ship different bugs. Bug 1: the missing volatile bool adc_done = false; /* BUG: not volatile */ void ADC_IRQHandler(void) { adc_value = ADC1->DR; adc_done = true; } void read_adc(void) { start_conversion(); while (!adc_done) { } /* at -O2 this becomes while(1) */ adc_done = false; } The…
Field complaint: a pressure booster pump in an apartment building stops for 2 seconds roughly every 40 minutes. Water pressure drops, people on the 9th floor shout, the building manager calls our service guy, the service guy calls me. On the bench: nothing. Ran it for 3 days, no stop. The system STM32F4, FreeRTOS, three tasks that matter: MotorControl , priority 5, runs every 1 ms, kicks the watchdog through a…
Every week customers send me ESP32 board for review before production. 7 of 10 have the same problem. They say "WiFi range very bad, maybe ESP32 is bad". ESP32 is fine. Layout is bad. 1. Antenna at board edge, nothing under it The PCB antenna on the module (the zigzag part) must be at the edge of your board, or better, hanging out past the edge. Under the antenna: no copper on any layer . No ground pour, no traces,…
This was some years ago but I still think about it every winter. We had a body control module, nothing special, talking on CAN at 500 kbit/s with the other modules. On the test bench everything perfect. In the field, some customers report that the module "die" in the morning and come back after the car is driving some minutes. Only in the north. Only in winter. First we suspect the power supply, because cold…