How to use the CCP Block in the MPC5643L Blocks from NXP?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use the CCP Block in the MPC5643L Blocks from NXP?

3,007 Views
edenli
Contributor V

Hi dumitru-daniel.popa,

    I wanna use the CCP block in the Motor control to calibrate the Parameters.I wanna implementation in two steps,

Frist: i wanna test the CCP Block in the Simulink;

Second: I wanna transplant the C-Code to My C-code Project of S32. 

My Calibration tool is ETAS-INCA,so we need to generate the *.hex and *.Map *.a2l  files.

Now i don't know how to do.

Daniel, Can you give me some advises?

0 Kudos
7 Replies

2,383 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi @Eden_Li, 

The CCP configuration tab is used to initialize the CCP stack. Once that CCP stack is get initialized then on a infinite loop there is a routine that waits for CAN calibration commands (e.g. from CANape). In fact the whole driver and stack was taken from Vector. You can find more information here.

So, basically once you configure the CAN instance to be used exclusively for CCP (from the config tab) there is nothing else you should do from the model - the microprocessor will sit and wait for calibration commands.

Hope this helps!

Daniel

0 Kudos

2,383 Views
edenli
Contributor V

Hi Daniel,

The Model about the CCP configure whether is right shown as below:

pastedImage_1.png

i wanna make sure whether we should add the CanConfigure Block shown as below:

pastedImage_2.png

Daniel, can you send me a exzample about the CCP model?

About your reply above,i make the summary shown as below whether is right?

1# i configure the CCP in the SImulink ,generate the C- code,and then transplant the my S32 project,it will run normally.

2# IF i add the CCP C-code in my project ,but The Calibrate tool is INCA,i need the *.hex and *.Map;How can i get them or find some replace files?

0 Kudos

2,383 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi edenli‌,

You do not need any extra CAN configuration/receive/transmit blocks. The CCP Setup will configure the CAN instance you have selected in the UI and will initialize all the CCP stack for you. Then that CCP stack which is called on the application main() function infinite loop will handle all the CAN communication for calibration.

Of course, you could use another CAN instance for other purposes if you need, but for the Calibration itself you should not reuse the CAN instance assigned for CCP.

I do not have any examples about this - in fact my knowledge about CAN calibration is very limited.

If you take the generated code and transplant it to the S32DS project it should work normally. Keep in mind that the Matlab toolbox is just generating some header file to pass the configuration parameters to the CCP stack (which in turn is something that Vector is providing for free) The alternative to Matlab generated code - would be to take the latest version from Vector and integrate it directly in your S32DS.

The MAP file can be found in the generated code folder.

By default the Toolbox is configured to generated the ELF and MOT format. INCA expects a Motorola S19 format and you can generate that file quite easy see this thread about how to do it: https://community.nxp.com/message/910795 

Hope it helps!

Daniel

0 Kudos

2,383 Views
edenli
Contributor V

Hi Daniel,

 Thank you for your reply!Now i have successfully tansplanted it to my project.Now I am Working for the *.a2l.

there is another question about the write address of the memory:

1#Can i configure the in the Calibration address in the ROM that is 0x0000 0000-0x2000 0000,that is right?

pastedImage_1.png

2#or i must configure the Calibration address in the the RAM?

that is 0x4000 0000-~pastedImage_9.png 

0 Kudos

2,383 Views
dumitru-daniel_
NXP Employee
NXP Employee

Should be RAM address since after boot-up all data are copied into RAM.

Best regards,

Daniel

0 Kudos

2,383 Views
edenli
Contributor V

Hi Daniel,

As you said, Calibrate the Param  in the rom,if i wanna Calibrate the Param from flash(ROM),we must first map the ROM Address to the RAM?

and i built the simulink model shown as below:

pastedImage_1.png

the *.MAP file shown as below:

pastedImage_2.png

Why the the address of Calibiate1 is not 0X4000001C?

0 Kudos

2,383 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi edenli‌,

That is not how the DataMemBlock works. Check the generated code and you will see something like:

/* Memory Address Write */
/* Memory Address : Base Address + Offset */
/* Memory Address : 0x4000001C; */
{
uint32_T * (write_mem_address);
write_mem_address = (uint32_T *)0x4000001C;
*(write_mem_address) = ***Calibiate1;
}

The Calibiate1 and others are data variables and they will be placed in the data sections as any other variables in your program.

The DataMemBlock just take the value carried by the variable/input signal and write it in the memory location.

You will have to do the memory management by yourself - making sure you are not overwriting other stuffs.

Right now your program most likely will crash since your are writing an area that might contain useful data for the program.

Best regards,
Daniel

0 Kudos