Timing measurement

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Timing measurement

Jump to solution
704 Views
juliancox
Contributor V

I am using a comparator to measure the time for a capacitor to charge up through a resistor, the other end of which is tied to a port pin. The time measured is then used to determine the value of the resistor (actually a NTC thermistor) and hence the temperature. The comparator uses component CMP1 with the on-chip bandgap voltage as the + input. I am using FC161:GetTicks16 to measure the time taken for the comparator to switch. Using the DEMOQE board everything worked fine and I was getting values of 19000 @ 25 degs and 300 @ 150 degs (comparable to results on a different processor type). I then moved over to a target board (S08SH4) which used identical components, but the values were 390 and 250. The comparator input waveforms were the same in both cases and I could see that the comparator tripped at the same point in time and voltage. It would appear that there is a timing issue as not only are the values different but the %ag change is also different.

Any help would be gratefully received.

Tags (2)
0 Kudos
1 Solution
523 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Julian,

Please notice that the Bandgap Voltage Reference for the S08QE MCU has a typical value of 1.17 V (factory trimmed at VDD = 3.0 V) and the S08SH MCU has a typical value of 1.20 V (factory trimmed at VDD = 5.0 V) so you will not have the same reference voltage in the compataros CPM1 + pin. Regarding the timer, are you selecting the same clock
source and prescale factor? Also, are you trimming both devices to the same frequency?

Best Regards,
Carlos Mendoza
Technical Support Engineer

View solution in original post

0 Kudos
2 Replies
523 Views
juliancox
Contributor V

Perhaps I should make my problem a little simpler: -

I have a capacitor being charged through a resistor. The resistor is fed by a port pin. and the capacitor voltage is fed to Comparator CPM1 - pin and the + pin is connected to the internal bandage supply. 

I calculate that the time for the comparator to switch should be approx. 9ms and when I measure the time on an oscilloscope it is approx. 9ms.

When I activate the charging process I also reset and start component FC161:FreeCntr16. In the comparator ISR I read register TPM1CNT.

Using my DEMOQE I read approximately 18000 ticks which, with a 4MHz clock gives a tick frequency of 2MHz, which equates to 18000 ticks for 9ms. So far - so good.

Using my target S08SH4 board the comparator switches after 9ms, but I only get a tick count of 350.

I have checked everything I can, but where do I go next 

0 Kudos
524 Views
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Julian,

Please notice that the Bandgap Voltage Reference for the S08QE MCU has a typical value of 1.17 V (factory trimmed at VDD = 3.0 V) and the S08SH MCU has a typical value of 1.20 V (factory trimmed at VDD = 5.0 V) so you will not have the same reference voltage in the compataros CPM1 + pin. Regarding the timer, are you selecting the same clock
source and prescale factor? Also, are you trimming both devices to the same frequency?

Best Regards,
Carlos Mendoza
Technical Support Engineer

0 Kudos