cancel
Showing results for 
Search instead for 
Did you mean: 

I want to develop PVD to generate interrupt if voltage in STM32G030 using ADC Analog Watchdog (AWD)

HBavi.1
Associate III

I've a question related to how AWD works in case of STM32G030 controller. As per my understanding, AWD analog watchdog status bit is set if the analog voltage converted by the ADC is below a low threshold or above a high threshold. These thresholds are programmed in the 12 least significant bits of the ADC_HTR and ADC_LTR 16-bit registers. An interrupt can be enabled by using the AWDIE bit in the ADC_CR1 register.

However, STM32Cube IDE doesn't allow to configure low threshold value other than 0 and according to parameter description "low threshold value must be set to 0". In that case how STM32G030 generates an interrupt if it goes below 2.5V?

0693W00000D23J7QAJ.png

9 REPLIES 9
TDK
Guru

Seems like it's a CubeMX bug. You can adjust the lower threshold on AWD 2 and 3, but the UI tries to be smart and won't let you set LT above HT, or HT below LT. Maybe the AWD 1 HT field is missing an event which updates the range of LT.

If you feel a post has answered your question, please click "Accept as Solution".
Amel NASRI
ST Employee

Hi @HBavi.1​  & @TDK​ ,

It seems that some restrictions related to thresholds setup for analog watchdog 1 are wrongly implemented. The implementation has to be aligned with the description provided in the table "Analog watchdog comparison" of RM0454.

In this table, we see that values of LT & HT depend on the resolution, mainly when it is less than 12-bit:

0693W00000Dq7HPQAZ.pngThat conditions aren't applicable for AWD2 & AWD3, that is why there is no such issue for both ones.

I add our STM32CubeMX @Khouloud ZEMMELI​ and @Khouloud OTHMAN​  on the loop of this discussion and, I kindly ask them to take care to report this issue to development team.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @HBavi.1​ , @TDK​  & @Amel NASRI​ ,

Thanks for your feedbacks, You're right the issue is related to the STM32CubeMX tool implementing wrong restrictions for analog watchdog 1. This is reported internally to be fixed. I'll keep you posted with the updates.

Thanks for you contribution.

Internal ticket number: 112268  (PS: This is an internal tracking number and is not accessible or usable by customers). 

Khouloud.

Hi,

any update on when the lower threshold issue is planned to be fixed?

It is still present in STM32CubeIDE v1.9.0 and STM32CubeMX v6.5.0.

Kind regards,

Steinar

Hello,

Any update on this?

I seem to have the same problem in STM32CubeIDE v1.10.1 with STM32CubeMX v6.6.1.

Best regards,

Patrik

Don't be so impatient - it's just a little more than a year have passed...

Hello @PMind.1​ 

The issue was fixed since the 6.4.0 release.

I also done a test on the latest version available the 6.7.0 and it works fine.

Best regards,

Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello,

I created a new example project where I manually edited the ioc file to set the ADC low threshold to 100 as an example: https://github.com/Durza007/awd_low_showcase/blob/main/adc_low.ioc#L5

If I open that file in STM32CubeIDE v1.11.0 with STM32CubeMX v6.7.0 it gives me an error that the value is invalid, see attached image below.

Is this working as it should? The low threshold does seem to work as it should when running on the actual hardware so I think the UI is wrong here.

Best regards,

Patrik

0693W00000WJpt8QAD.png

Hello @PMind.1​ 

Yes, you are right about it.

In fact, when I have made the test, it was on a G0 MCU as it is the one the OP has used; and it work fine for the G0 series.

But after your reply I checked the L0, and the issue exist.

This is reported internally to be fixed. I'll keep you posted with the updates.

Thanks for your contribution. 

Internal ticket number: 140378 (PS: This is an internal tracking number and is not accessible or usable by customers). 

Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.