Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

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