2011-06-09 01:22 PM
We are using the Atollic IDE. After setting up TIM2,TIM3, or TIM4 to clock continuously. We output the counter bits on PCx lines and monitor with a scope.
We read the registers directly using: adr=0x40000???; data=*((u16 *)(adr)); and then write the data to the PCx lines. We can read all regs. with no problems except for the counter status regs at 0x40000?10. If we read the status reg the counter stops. This is for all status registers and any counter. For example: if we read 0x40000810, the TIM4_SR, TIM2 will stop. This seems really odd. I might accept the fact that somehow reading TIM2_SR might mess with TIM2 but do not understand how it could mess with TIM4, etc. We are trying to monitor the UIF and TIF flags. Does anybody have any suggestions? #timer-status-reg2011-06-10 07:44 PM
It does sound rather odd. While I haven't tried your method, if this were truly the case it would break a lot of code. Do you have the timers generating interrupts?
Perhaps you should examine the code generated by the compiler, and confirm it's doing what you expect. You could post/attach a more complete example that demonstrates this phenomenon, which others could compile/test.2011-06-12 01:16 PM
Thanks clive1,
We looked at the disassembly, but it was exceedingly tedious and looked appropriate.
We then decided to strip everything from the code, including the stm32f10x headers.
We used only standard C include stdint.h for integer types.
We created everything from scratch including our own register address definitions.
Everything now works as it should; we can now read the timer status registers with no problem.
Our project has a short fuse and we will revisit the problem when time permits.
Thanks again!