Unable to change REFOCONbits.RODIV
I'm trying to make programmable clock divider based on PIC24F08KL301 .
I have external clock supplied to pin 7 and I have divided clock coming in out of pin 18.
the "rate" consists from 3 lower bits which represent division, with 4th bit representing external relay switching XTAL.
Everything works great except that i cannot change clock division.
Writes to REFOCONbits.RODIV do not change the output.
I tried different combination, to the point of completely removing all logic and changing division twice - it does not work.
Also if I disable output (REFOCONbits.ROEN = 0;) then enable it again - it does not get reenabled.
Maybe there is a config that prevents me from changing divisor? Did not find anything in dox. Errata does not have anything related to this issue.
my project sources:https://gitlab.com/aleynikov/daccontrol/-/tree/Forum/DACcontrol.X
init is done in DACmain.c lines 86 - 93
clock change is done in dac.c line 74
What am i doing wrong and how can I change divider?
Any help is greatly appreciated.