ADC analog watchdog for STM32F4xx

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
Posts: 113
Joined: Wed Feb 04, 2015 5:03 pm
Location: CITEC, Bielefeld University, germany
Has thanked: 11 times
Been thanked: 20 times

ADC analog watchdog for STM32F4xx

Postby Thargon » Wed Mar 04, 2015 12:57 pm

I managed to get the ADC analog watchdog running for the STM32F4xx platform.

The patch can be applied to ChibiOS/RT version 2.6.7 and changes the files
  • os/hal/platforms/STM32F4xx/adc_lld.h
  • os/hal/platforms/STM32F4xx/adc_lld.c

The adcerror_t enum was extended by the value ADC_ERR_WATCHDOG = 2
The ADCConversionGroup struct was extended by the two threshold registers htr and ltr.
Introduced two new macros (ADC_HTR(n) and ADC_LTR(n)) that limit given threshold values to the maximum possible value, thus overflows are omitted.

The IRQ handler now checks the status register for the ADC_SR_AWD bit and generates an error code, using the new ADC_ERR_WATCHDOG error.

As a result, it is now possible to set the ADC watchdog thresholds via the ADCConversionGroup. As soon as the measured value is out of bounds, the error callback function is called with the according error code.

Best regards,
(1.36 KiB) Downloaded 103 times

Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 2 guests