Hi Ray,
Note about PLL clock:
You selected fVCO=26MHz, unfortunately this is out of any valid ranges.
For 13MHz bus clock, please use these values:
CPMUSYNR=0x59; //SYNDIV=0x19, VCOFRQ=0x01
CPMUREFDIV=0x00;
CPMUPOSTDIV=0x01;
For 16MHz bus clock, please use these values:
CPMUSYNR=0x0F; //SYNDIV=0x0F, VCOFRQ=0x00
CPMUREFDIV=0x00;
CPMUPOSTDIV=0x00;
For 25MHz bus clock, please use these values:
CPMUSYNR=0x58; //SYNDIV=0x18, VCOFRQ=0x01
CPMUREFDIV=0x00;
CPMUPOSTDIV=0x00;
In attachment you can find PLL calculator. Please select S12P (it has also CPMU module), input clock frequency and requested bus clock.
I would like to note that you can use PLL (based on IRC oscillator) as clock for CAN module only for debugging purposes. In most of cases, PLL accuracy isn’t sufficient for CAN communication.
About programming:
EEPROM_Program() function calls EEPROM_Erase_Verify_Section() function. EEPROM_Erase_Verify_Section() function has critical part which has to be executed from RAM. Any interruption (when interrupt routine is located in P-flash) could cause that EEPROM will be not read correctly. Therefore I would like to recommend disable interrupts prior this critical section and enable after that. For example:
DisableInterrupts;
asm JSR Send_Command;
EnableInterrupts;
Except this I do not see any reason why it should not work in normal mode.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------