In which oscillator mode I can make clock out?
If you have POSCMD set to HS or XT, the pins OSCI and OSCO are I/O for an internal oscillator. You connect a crystal, and that's what you see. (Well, depending on the frequency and the crystal and the probe, it's possible that the crystal will even stop oscillating at all)
So, first of all, POSCMD must NOT be set to HS or XT. Setting it OFF is OK. Haven't tested EC, but I would guess it's OK.
Then, to get it work at all, FNOSC must not be set to PRI or PRIPLL. I mean, since the oscillator is off, selecting one of PRI options simply won't work. Period.
For sure: FRC, FRCDIV and FRCPLL will be OK. Haven't tested others.
I don't know why you are obsessing about measuring the operating frequency directly on the CLK0 pin. You simply can't measure it directly on that
pin if you are operating in one of the crystal modes. Period.
I told you a way to verify the approximate operating frequency. Since using __delay_ms() or __delay_us() in a loop will not give an exact cycle-correct overall delay between output changes, it will be off by a few instruction cycle times, but it won't be off by, say, a factor of 2 or 4 (which are, I think, the most likely errors that people make).
And, by the way, if your design doesn't use the REFO pin for anything else, just keep reading Section 8.7:
Data Sheet, DS39940D, with emphasis added by davekw7x
In addition to the CLKO output (FOSC/2) available in certain
oscillator modes, the device clock in the
PIC24FJ64GB004 family devices can also be configured
to provide a reference clock output signal to a port pin.
This feature is available in all oscillator configurations
and allows the user to select a greater range of clock
submultiples to drive external devices in the application
So, maybe you can read about REFO pin and how to get a reference clock on that pin.
post edited by davekw7x - 2018/01/14 13:07:30