cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G474 temperature sensor always reads same value in continuous mode

liampwll
Associate III

I'm trying to read the internal temperature sensor of a G474 with ADC5 in continuous mode, but the value of RDATA never seems to change even though ADSTART is set to 1. I know that the code is otherwise correct as if I turn off continuous mode and start the conversion manually in a loop the value is updated. The only thing I can find in the RM that could cause continuous mode to stop is AUTDLY, which is set to 0 here. What am I missing?

 

Below is a dump of the relevant ADC5 registers:

 

CR:
(ADEN => TRUE,
ADDIS => FALSE,
ADSTART => TRUE,
JADSTART => FALSE,
ADSTP => FALSE,
JADSTP => FALSE,
RESERVED_6_27 => 0,
ADVREGEN => TRUE,
DEEPPWD => FALSE,
ADCALDIF => FALSE,
ADCAL => FALSE)

CCR:
(DUAL => 0,
RESERVED_5_7 => 0,
DELAY_K => 0,
RESERVED_12_12 => 0,
DMACFG => FALSE,
MDMA => 0,
CKMODE => 1,
PRESC => 0,
VREFEN => TRUE,
VSENSESEL => TRUE,
VBATSEL => FALSE,
RESERVED_25_31 => 0)

CFGR:
(DMAEN => FALSE,
DMACFG => FALSE,
RESERVED_2_2 => 0,
RES => 0,
EXTSEL => 0,
EXTEN => 0,
OVRMOD => FALSE,
CONT => TRUE,
AUTDLY => FALSE,
ALIGN => FALSE,
DISCEN => FALSE,
DISCNUM => 0,
JDISCEN => FALSE,
JQM => FALSE,
AWD1SGL => FALSE,
AWD1EN => FALSE,
JAWD1EN => FALSE,
JAUTO => FALSE,
AWD1CH => 0,
JQDIS => TRUE)

SQR1:
(L => 0,
RESERVED_4_5 => 0,
SQ1 => 4,
RESERVED_11_11 => 0,
SQ2 => 0,
RESERVED_17_17 => 0,
SQ3 => 0,
RESERVED_23_23 => 0,
SQ4 => 0,
RESERVED_29_31 => 0)

1 ACCEPTED SOLUTION

Accepted Solutions

Do you read it in debugger only? You may want to set ADC5_CFGR.OVRMOD, see ADC overrun (OVR, OVRMOD) subchapter of ADC chapter in RM.

JW

View solution in original post

2 REPLIES 2

Do you read it in debugger only? You may want to set ADC5_CFGR.OVRMOD, see ADC overrun (OVR, OVRMOD) subchapter of ADC chapter in RM.

JW

liampwll
Associate III

I was assuming that OVR got reset automatically when the data is read, but I can see that's not the case after looking at it again. Thanks.