Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Solving "ADC Reading 7FF (counts) After Power Cycle" Bug with STM32L0

The purpose of this forum post is to figure out why the internal temperature sensor on my STM32L0 processor is reading all 1’s (0x7FF) after a power cycle or software reset. I will try to include as much information as I can about my setup, the way I reproduce the problem, and all the different things I have tried to fix the problem so that anyone reading this can jump in at the same place I am in this investigation.

Device Setup:
I will start by describing the device I am using, all the debugging tools I have available, and the STMCubeMX settings for the internal temperature channel of the ADC.
Processor: STM32L051K8
Debugger: ST-Link/V2 (B 2018 15)
Power Supply: Variable Voltage Supply
Debug Equipment: Oscilloscope, DMM, Soldering Iron, Spare Wire (for snooping), Access to lab
IDE: System Workbench
Cube MX Settings:
1
2
3
4

Use Of Temperature Sensor In Code:
‘HAL-generated’ initialization of the adc
5
6
My code that reads temperature calibration points(defined in datasheet) from device ROM.
7
8
My code that triggers an ADC conversion, throws that first conversion away (per suggestion from device errata), performs a second conversion, then calculates temperature from that second conversion.
9
10
11
12
13

Reproducing The Error
Launching a debug session, flashing a release build of the firmware to the processor with system workbench, and using the ST-Link programming utility to flash the processor all allow the code to work correctly and convert temperature in the way I would expect. I get counts that make sense and convert them to roughly 25 degrees c which is reasonable for my room temperature.

The problem occurs if I power cycle the processor or perform a software reset after flashing the processor or launching a debug session. After either of these reset methods, my temperature calculation is always 601 degrees c which converts to 0x7FF in adc counts. As this is all ones, it seems like there is a problem with the ADC after a power cycle or software reset.

Any help or direction you can provide as to what is happening would be greatly appreciated.

If you are more interested in the ways I have tried to troubleshoot this issue, I have detailed my debugging in the following forum post.
https://www.openstm32.org/forumthread8413?topics_offset=0Question

 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs