Hello everybody,
i want to make 3 consecutive readings of registers from ePWM registers, and i noticed that it takes a lot of time. I have to do there operations:
- read TBCTR register, from ePWM1
- read TBSTS register, from ePWM1
- read TBCTR register again, from ePWM1
performing these operation will require 16 ticks at 100MHz clock timing, and i would have expected 3 ticks only. Why? Here is my code. From my C software i call an asm function, which begins with:
_ePWMCouterRead: ;load periph. page MOVW DP,#_Perif ;periph value is 1a0h, address of ePWM1 regs ;read counter, 1 MOVZ AR0,@TBCTROff ;TBCTROff is 0 ;read direction MOVZ AR4,@TBSTSOff ;TBSTSOff is 1 ;read counter 1 MOVU ACC,@TBCTROff ...
My ePWM counter is configured as 100MHz counter, no prescalers, 1tick is 10ns. Why my value in ACC is alaways greater than value in AR0 by 16? I would have expected greater by 2 only, not 16. I can't understand this and can't undestand if i have some settings in my register, that slow reading from pheripheral registers. Also writing the same code with C, produces the same result. Please give hints, i have do read these values very quickly.
Best Regards
Emanuele Peruzzi