2015-10-21 12:21 PM
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 ofSDADC_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 #ad2015-10-21 12:38 PM
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.2015-10-21 01:02 PM