cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F373 - Strange sigma-delta AD behaviour

matic
Associate III
Posted on October 21, 2015 at 21:21

My colleague uses STM32F373 and he found a strange behaviour with SD AD. Actually, this behaviour is described in ref. manual, but I am just curious why it is like that...

He starts SD AD conversion with software command. After that he writes a content of 

SDADC_RDATAR register to a variable. It works fine, if SFR windows in IDE are not opened. If SFRs are open, then the value of AD conversion in SFR becomes correct, but after that, variable doesn't change - it stays at zero. We found out (in ref. manual), that 

SDADC_RDATAR is cleared as soon as it is read. Thus, when SFR read (update) its value, the register is cleared and then variable is written with 0.

This behaviour is quite distracting. If you have SFRs opened while debugging, program doesn't work. This behaviour is not typical for normal (not sigma-delta) AD. There, DR register is not cleared when it is read.

Can anyone explain, why this is needed with sigma-delta AD??

Thanks

#sigma-delta #ad
2 REPLIES 2
Posted on October 21, 2015 at 21:38

You understand that the SFR windows in the debugger are highly invasive, right? There is no magic access method that is transparent to the peripheral, so it uses regular memory reads with all the same side-effects those have with reading data registers, and clearing status bits. The peripherals are a black box, there may be unanticipated interactions between registers, DMA holding registers/sequencers, that may not be directly related to the current mode of operation.

They will break USART and SPI devices also.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
matic
Associate III
Posted on October 21, 2015 at 22:02

I understand that. What I don't understand is that, why data register of SD AD is cleared after read and data register of regular AD is not. My opinion is that, it is better, if DR is not automatically cleared after read. And this is not something impossible, if this is the case of normal AD.

Just my thoughts.