Code generation issue with simple CAN communication test.

cancel
Showing results for 
Search instead for 
Did you mean: 

Code generation issue with simple CAN communication test.

Jump to solution
566 Views
mcgillformulael
Contributor I

Hello,

Our team is quite new with the Motor Control Toolbox. More recently, we have been doing several tests to learn how to work with this new tool. We are using an MPC5643L and we are currently doing the tests with the development board. 

We did a simple push button to LED model to test the digital inputs/outputs. We also did a simple logic with the dev board rotary potentiometer to control LEDs on the board.

We are now running into some problem taking an ADC input and sending it over CAN. In fact, when trying to generate code, one header file named DASH_TESTING_private.h is included in adc1_config.h but has not been created. This leads to an error since it cannot be found by Simulink. See picture attached.

Is this a common issue? Perhaps we are missing something when configuring the ADC or the CAN. I have also attached the simple model (R2017b) in case you want to run.

 

Thank you for your help.

Best,

Michael

pastedImage_1.png

Tags (3)
0 Kudos
1 Solution
304 Views
constantinrazva
NXP Employee
NXP Employee

Hi again mcgillformulaelectric‌,

The reason your model did not generate the <model_name>_private.h file is the selection of "File packaging format" to something other than "Modular". So for a quickfix, go to Code generation -> Code placement and set File packaging format to "Modular".

pastedImage_1.jpg

This option specifies whether code generation modularizes the code components into many files or compacts them into a few, in the following manner:

  1. The Modular selection outputs <model>_data.c, <model>_private.h and <model_types.h>, in addition to generating <model>.c and <model>.h. 
  2. Compact (with separate data file) selection outputs (conditionally) <model>_data.c in addition to <model.c> and <model>.h.
  3. Compact selection outputs <model>.c, including the contents of <model>_data.c, <model>_private.h and <model>_types.h.

We will update our toolbox to take into consideration the file packaging format - in this regard I opened (internally) a bug and will post a hotfix on the community.

Hope this helps,

Razvan.

View solution in original post

0 Kudos
3 Replies
305 Views
constantinrazva
NXP Employee
NXP Employee

Hi again mcgillformulaelectric‌,

The reason your model did not generate the <model_name>_private.h file is the selection of "File packaging format" to something other than "Modular". So for a quickfix, go to Code generation -> Code placement and set File packaging format to "Modular".

pastedImage_1.jpg

This option specifies whether code generation modularizes the code components into many files or compacts them into a few, in the following manner:

  1. The Modular selection outputs <model>_data.c, <model>_private.h and <model_types.h>, in addition to generating <model>.c and <model>.h. 
  2. Compact (with separate data file) selection outputs (conditionally) <model>_data.c in addition to <model.c> and <model>.h.
  3. Compact selection outputs <model>.c, including the contents of <model>_data.c, <model>_private.h and <model>_types.h.

We will update our toolbox to take into consideration the file packaging format - in this regard I opened (internally) a bug and will post a hotfix on the community.

Hope this helps,

Razvan.

0 Kudos
304 Views
mcgillformulael
Contributor I

Hi constantinrazvan.chivu ,

Thank you for your quick support. We tried it and it works. 

Thank you for your help.

Best,

Michael

McGill Formula Electric

0 Kudos
304 Views
constantinrazva
NXP Employee
NXP Employee

Hi mcgillformulaelectric‌,

<model_name>_private.h is a file that Simulink generates; it is a file that's used for some #includes, user data, etc. It seems the file was not generated - by default it should be, so there is an option enabled in Simulink so it does not generate that file. I will look into it and come back as soon as I have caught the option that is causing this. In the meanwhile, if you open an example from the Examples folder and have the same options selected from the "Code Generation" tab, the build will succeed.

I will write back shortly after finding out what option influences the generation of <model_name>_private.h .

Kind regards,

Razvan.

0 Kudos