Hi maharaj,
I shortly looked at your code:
- I do not understood your command CPMUIFLG = 0x00;. Writing or writing 0 has no effect on CPMUIFLG register bits.
- COP is disabled after reset when your FPROT values in Flash are default (0xFF). Execution of CPMUCOP_REG = CPMUCOP_DISABLE_MASK; command will cause, that COP watchdog cannot be enabled until next reset – you cannot use it for software reset. I suppose that you don’t use COP for MCU reset. Correct?
- Your command CPMUCLKS = CPMUCLKS | COPOSCSEL0_MASK; do not make sense since it is placed below CPMUCOP_REG = CPMUCOP_DISABLE_MASK command. COPOSCSEL0 bit could be configured in normal mode only prior you enable/disable COP watchdog.
- CPMUIFLG_REG_ADDR and CPMUIFLG are defined twice.
- I suppose that CRGFLG is CPMURFLG register, but I do not understood why you write 0x00
- Your clock settings for 50MHz bus clock looks OK
- Command CPMUPLL = 0u; should be prior you start configure SYNR, REFDV, POSDIV registers. Write to CPMUPLL register clears the LOCK and UPOSC status bits.
As AMEY already mentioned we know about some BDM connection issues during stepping over PLL init code. The second link in AMEY’s post contains workaround.
Which BDM debugger you use? If I remember correctly there were some issues with USB Multilink Rev.C (USB-ML-12E) with very old firmware.
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!
-----------------------------------------------------------------------------------------------------------------------