Hi,
I am using the TMS570 Microcontroller Development Stick, with a TMS570LS20216 MCU (ASPGEQQ1).
I have a short NHET program to measure time periods:
P01 PCNT { next=P02,reqnum=0,request=GENREQ,irq=ON,type=FALL2FALL,pin=10,period=0,data=0,hr_data=0}
P02 BR {next=P01,cond_addr=P01,event=NOCOND}
I am getting data in the PCNT Data Field, but the data does not appear in bits 0 to 3. Looking at the Technical Reference Manual, this suggests that the lower 7 bits are for "HR Data", does this mean that I should shift my data right by 7 bits?
When I ignore the lower 4 bits (i.e. I shift the data right by 4 bits) and convert the hex data read to a decimal value and then multiply this by the period, calculated from 1/VCLK2, this gives me the measured count period in seconds. From this I can calculate the frequency, which seems to be the right number. If I have to shift the data (by 7 bits instead), the calculation will not work.
For example, I am using a 10kHz square wave, which is a period of 100microseconds. I have set VCLK2 to be 34MHz, so the period should be 2.9411E-08 (29.411ns).
My Prescale Factor Register is 0x00000300, which gives loop resolution =8 and high resolution = 1.
The data I read is D440, D44 converts to 3396. Multiplying this by the period gives 9.988E-05 seconds, which converts to 10000Hz.
Should I be shifting the data by 7 bits?