<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/why-did-my-microcontroller-crash--ibxxyejnh" -->

---
title: Why did my microcontroller crash? | daily.dev
description: A hands-on walkthrough of debugging a crashed ARM Cortex-M microcontroller running a marble game. Using GDB and VS Code with the cortex-debug extension, the...
canonical: https://daily.dev/posts/why-did-my-microcontroller-crash--ibxxyejnh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Why did my microcontroller crash? | daily.dev
og:description: A hands-on walkthrough of debugging a crashed ARM Cortex-M microcontroller running a marble game. Using GDB and VS Code with the cortex-debug extension, the...
og:url: https://daily.dev/posts/why-did-my-microcontroller-crash--ibxxyejnh
og:image: https://api.daily.dev/og/posts/IbXxyeJNh.png
og:image:alt: Why did my microcontroller crash?
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Why did my microcontroller crash?

**[Artful Bytes](https://daily.dev/sources/artfulbytes)** · 19 min read · 0 upvotes · 0 comments

## Summary

A hands-on walkthrough of debugging a crashed ARM Cortex-M microcontroller running a marble game. Using GDB and VS Code with the cortex-debug extension, the author connects to the debug probe without resetting the chip, reads CPU registers (PC, xPSR, hard fault status register, configurable fault status register) to identify a hard fault caused by an imprecise bus error — an out-of-bounds write to a frame buffer. The call stack is manually decoded from raw RAM contents and then verified via GDB backtrace, tracing the fault through count_pixel → plot_pixel → draw_ball → run → main. The root cause is drawing the ball before clamping its coordinates, allowing it to write past the end of the 1024-byte frame buffer. The post also covers stack corruption when writing off the top of the display, adding a custom hard fault handler to dump crash state over UART, and the simple one-line fix of moving the bounds check before the draw call.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=T59gwneacdk>

## Similar posts on daily.dev

- [My device crashed in the field. How do I figure out why?](https://daily.dev/posts/my-device-crashed-in-the-field-how-do-i-figure-out-why--kaigqs2zu) · EmbeddedRelated · 0 upvotes · 0 comments
- [When The Debugger Lies With Stale Cache Values](https://daily.dev/posts/when-the-debugger-lies-with-stale-cache-values-aedfpoaoy) · Hackaday · 0 upvotes · 0 comments
- [Using Tracealyzer for Embedded Systems Analysis](https://daily.dev/posts/using-tracealyzer-for-embedded-systems-analysis-sdtjm2ryk) · MCU on Eclipse · 1 upvotes · 0 comments
- [Math is hard](https://daily.dev/posts/math-is-hard-g7pgrr2pz) · Hacker News · 0 upvotes · 0 comments
- [Welcome to the machine: emulating a CPU — Bitfield Consulting](https://daily.dev/posts/welcome-to-the-machine-emulating-a-cpu-bitfield-consulting-rggljiotl) · Bitfield Consulting · 19 upvotes · 1 comments

---

Tags: [#embedded](https://daily.dev/tags/embedded)

[View this post on daily.dev](https://daily.dev/posts/why-did-my-microcontroller-crash--ibxxyejnh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Why did my microcontroller crash?","url":"https://daily.dev/posts/why-did-my-microcontroller-crash--ibxxyejnh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/why-did-my-microcontroller-crash--ibxxyejnh"},"datePublished":"2026-07-26T15:21:40.863Z","dateModified":"2026-07-26T15:21:59.235Z","description":"A hands-on walkthrough of debugging a crashed ARM Cortex-M microcontroller running a marble game. Using GDB and VS Code with the cortex-debug extension, the...","image":"https://i.ytimg.com/vi/T59gwneacdk/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/T59gwneacdk/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Artful Bytes","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Artful Bytes","logo":"https://media.daily.dev/image/upload/s--TkALwTxE--/f_auto/v1757228712/logos/artfulbytes","url":"https://daily.dev/sources/artfulbytes"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/why-did-my-microcontroller-crash--ibxxyejnh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"embedded","timeRequired":"PT19M","video":{"@type":"VideoObject","name":"Why did my microcontroller crash?","description":"A hands-on walkthrough of debugging a crashed ARM Cortex-M microcontroller running a marble game. Using GDB and VS Code with the cortex-debug extension, the...","thumbnailUrl":"https://i.ytimg.com/vi/T59gwneacdk/sddefault.jpg","uploadDate":"2026-07-26T15:21:40.863Z","duration":"PT19M","url":"https://api.daily.dev/r/IbXxyeJNh","embedUrl":"https://www.youtube.com/embed/T59gwneacdk"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Artful Bytes","item":"https://daily.dev/sources/artfulbytes"},{"@type":"ListItem","position":3,"name":"Why did my microcontroller crash?"}]}
```

