Hi,
I did some initial experiments with calibration of PFS154.
Here my measurements + notes:
1st experiment: Use PADAUK IDE, let WRITER calibrate the IC and then use our calibration loop and measure:
- .ADJUST_IC SYSCLK=IHRC/2, IHRC=16MHz, VDD=5.0V;
- use IHRC 16MHz @ 5.0V @ 20°C
- SYSCLK = IHRC/2 => IC runs instructions @8 MHz (clkmd = 0x34, IDE calculated this value)
- our calibration loop toggles a pin on / off within 8 clocks (7 instructions => 7 clocks + 1 extra clock from goto)
=> 1 MHz output on pin expected when measured with oscilloscope
measured: 1.0021 MHz - 1.0029 MHz (slight temp up/down like put finger or blow over it: 1.0015 - 1.0036 MHz)
notes:
@7ED start val for IHRCR on PFS154: 0x80
@7EE start val for BGTR on PFS154: 0x5A
@7FE IHRCR value from WRITER: 0x81 (used for normal execution)
2nd experiment: Use PADAUK IDE, disable any calibration from WRITER and then use our calibration loop and measure:
- .ADJUST_IC DISABLE;
- use IHRC 16MHz @ 5.0V @ 20°C
- SYSCLK = IHRC/2 => IC runs instructions @8 MHz (clkmd = 0x34, IDE calculated this value)
- our calibration loop toggles a pin on / off within 8 clocks (7 instructions => 7 clocks + 1 extra clock from goto)
=> 1 MHz output on pin expected when measured with oscilloscope
measured: 591.3 - 591.6 kHz
![Confused :-//](https://www.eevblog.com/forum/Smileys/default/confused0024.gif)
So it looks like we really need calibration or at least use the standard value of 0x80 for IHRCR on PFS154.
Unfortunately the PADAUK IDE does not allow to compile a program which sets IHRCR (error: "The 'IHRCR' not be supported at User Mode") so I'm stuck here.
=> Time to focus on the PC program to send data to easy pdk programmer for easy flashing of sdcc generated programs.
JS
UPDATE:
After some more experiments, the following IHRCR values for the specific PFS154 I try this with results in this values:
IHRCR
0x00 => 591.4 kHz
...
0x80 => 990.5 kHz
0x81 => 1002.5 kHz
...
0xFF => 1490.8 kHz
WOW, almost 1.5 MHz which translates to approx 12MHz sysclock (24MHz IHRC)