Hi,EveryOne,
I purchased a S12ZVML-MINIBRD.When I try to develop software with S12ZVML-MINIBRD_BLDC_Sensorless_CW_IDE project, i can not import the S12ZVML-MINIBRD_BLDC_Sensorless_CW_IDE project with CW10.6 because there is no any .MCP file in the folder 'S12ZVML-MINIBRD_BLDC_Sensorless_CW_IDE' . Then I create a project, add all necessary file and load .elf file. Unfortunately the program does not work at all.
when I comment the code following, it works,
.......
initCPMU(); |
initGPIO();
initTIM();
initPMF();
initPTU();
initADC();
initSCI();
initGDU();
// initInt();
......
The I step into the code of initInt which is listed,
// set PTU Trigger 1 ISR (0x0E0) priority to 6 |
// 0xE0 / 4 = 0x38 => reg. value = 0x38 + offset 0
INT_CFADDR = 0x38;
INT_CFDATA0 = 6;
// set ADC 0 done ISR (0x184) priority to 6
// 0x184 / 4 = 0x61 => reg. 0x60, offset 1
INT_CFADDR = 0x60;
INT_CFDATA1 = 6;
// set Commutation ISR (0x1CC) priority to 5
// 0x1CC / 4 = 0x73 => reg. value = 0x70 + offset 3
INT_CFADDR = 0x70;
INT_CFDATA3 = 5;
// set Speed control loop ISR (0x1C0) to 4
// 0x1C0 / 4 = 0x70 => reg. value = 0x70 + offset 0
INT_CFADDR = 0x70;
INT_CFDATA0 = 4;
I am so confused: there is no 0x184 interrupt vector number according to the mc9s12zvml128.h file.
The max. interrupt vector number is 123.
When I read the datasheet, i am confused the interrupt priority configuration,
Interrupt Request Configuration Data Register Select Bits — These bits determine which of the 128
configuration data registers are accessible in the 8 register window at INT_CFDATA0–7.
The hexadecimal value written to this register corresponds to the upper 4 bits of the vector number
(multiply with 4 to get the vector address offset).
If, for example, the value 0x70 is written to this register, the configuration data register block for the 8
interrupt vector requests starting with vector at address (vector base + (0x70*4 = 0x0001C0)) is selected
and can be accessed as INT_CFDATA0–7.
If the hexadecimal value written to this register is the vector number with 4, then INT_CFDATA4–7 is unneccesary!
How can I make the project work?
Thanks a lot!
Hi Guoqiang,
The CW10 (and other Eclipse IDEs) use project defined by a file in *.xml format instead proprietary solution with *.mcp file.
The CW10 has the cool feature that you could simply drag the folder with your project and drop it into CodeWarrior Projects window. The CW will import it into the workspace. This way you could import several projects.
The next option is menu-File-Import-General-Existing Projects into Workspace-Select directory with your project(s).
I hope it helps you. If not, or if you will have any other question, please contact us.
PS: This service request will auto close in 7 days upon no reply.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I got the answer of interrupt priority configuration:
The result is the vector offset right shift 4, then mod 8, the remain is INT_CFDATA number, and result minus remain is INT_CFADDR value.
But the modified code dose not work. Here is the code:
void main(void)
{
unsigned long i;
char OutStat = 0;
initCPMU();
initGPIO();
initTIM();
initPMF();
initPTU();
initADC();
initSCI();
initGDU();
initInt();
FMSTR_Init();
EnableInterrupts;
// AppInit();
// AdcCalibration();
// Run the BLDC motor
//driveDemandRemote.bit.StopRun = 1;
PTP_PTP0 = 0;
PTP_PTP0 = 1;
for(;;)
{
// FMSTR_Poll();
// AppStateMachine[appState]();
// CheckFaults();
i++;
if(i>500000)
{
i = 0;
if(0==OutStat)
{
OutStat = 1;
}
else
{
OutStat = 0;
}
PTP_PTP0 = OutStat;
}
}
}