Hi Everybody!
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. I e i can initially set it but consequent writes to REFOCONbits.RODIV have no effect.
Also if I disable output (REFOCONbits.ROEN = 0;) then enable it again - it does not get re-enabled, there is no clock in the output, where it was there prior to disabling.
Maybe there is a config that prevents me from changing reference clock reprogramming? 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.Xinit 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 divisor?
Any help is greatly appreciated.