---
title: "Getting Started With Zephyr: Using GDB To Fix a Driver Bug"
url: https://daily.dev/posts/getting-started-with-zephyr-using-gdb-to-fix-a-driver-bug-b1e5k4qsg
source_url: https://www.embeddedrelated.com/showarticle/1753.php
type: article
source: "EmbeddedRelated"
published: 2026-05-31T07:47:57.833Z
updated: 2026-06-04T02:17:09.259Z
tags: ["embedded", "stm32"]
reading_time: 10
upvotes: 0
comments: 0
language: 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.

# Getting Started With Zephyr: Using GDB To Fix a Driver Bug

**[EmbeddedRelated](https://daily.dev/sources/embeddedrelated)** · 10 min read · 0 upvotes · 0 comments

## Summary

A walkthrough of debugging a TSL2591 light sensor driver initialization failure on an STM32L4 Discovery IoT node running Zephyr RTOS. Using `west debug` and GDB, the author traces the failure from the sensor init function down through Zephyr's I2C subsystem into the STM32 I2C controller driver. Disabling compiler optimizations (`CONFIG_NO_OPTIMIZATIONS=y`) makes stepping reliable. Inspecting the `data` struct reveals `is_nack=1` after a software reset write — the device doesn't ACK immediately after reset. The fix treats the post-reset NACK as non-fatal by ignoring the return code, consistent with Adafruit's Arduino driver and the Linux kernel driver. The fix was submitted as a PR and accepted upstream into the Zephyr project.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.embeddedrelated.com/showarticle/1753.php>

## Similar posts on daily.dev

- [Simplifying Embedded System Design with a Modern Software Ecosystem](https://daily.dev/posts/simplifying-embedded-system-design-with-a-modern-software-ecosystem-jr0ummxbk) · Embedded.com · 0 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/getting-started-with-zephyr-using-gdb-to-fix-a-driver-bug-b1e5k4qsg)
