I modified this code for the file named MC9S12ZVML128_PMSM.c because I found the demo project downloaded from
NXP official website use the external oscillator but not the internal one. And after reading the miniboard schematic I found the MCU chip of MC9S12ZVML128 use its own internal oscillator. And the external oscillator connected to a 8 bit MCU of NXP. Thus, it is necessary to modify the MC9S12ZVML128_PMSM.c file initcup() function to switch from NXP original external oscillator to the internal one.

The external oscillator for the 8 bit MCU for downloading purpose:

I added a defination instruction to the file named MC9S12ZVML128_PMSM.c:
#define _INTERNAL_CLOCK.
Also I modifed the source code for init the MCU of MC9S12ZVML
void initCPMU(void)
{
// Wait for stable supply after power up
while (GDUF_GLVLSF)
GDUF_GLVLSF = 1;
CPMUREFDIV_REFDIV = CPMU_REFDIV;
CPMUREFDIV_REFFRQ = CPMU_REFFRQ;
CPMUSYNR_SYNDIV = CPMU_SYNDIV;
CPMUSYNR_VCOFRQ = CPMU_VCOFRQ;
CPMUPOSTDIV_POSTDIV = CPMU_POSTDIV;
//#ifdef _EXTERNAL_CLOCK // I commented these 3 lines because ML128 Miniboard does not have external oscillator to use.
//CPMUOSC_OSCE = 1; //The original demo project named MC9S12ZVML128_PMSM does define CPMUOSC_OSCE, so that it always use external oscillator but in fact there is no external oscillator in the schematic.
while (CPMUIFLG_UPOSC == 0) {}; // Wait for oscillator to start up (UPOSC=1) and PLL to lock (LOCK=1)
//#endif
while (CPMUIFLG_LOCK == 0) {};
CPMURFLG = 0x60; //Clear PORF and LVRF
return;
}
I have no idea if this defination can make internal oscillator works or not.
After I modifed this source code of MC9S12ZVML128_PMSM.c in the demo project, I redownload it to MC9S12ZVML
However, I found the internal oscillator still does not work at all.
Please let me know if you have the exactly correct demo project for Mini ML128 board which can drive a single shunt resistor FOC motor.
Need your help, you are welcome to give demo projects for single foc motor or http links for single foc motor.
Many thanks!