Implementing XCP Basic Driver with S32 SDK

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

Implementing XCP Basic Driver with S32 SDK

7,636 Views
chuluezhong
Contributor II

Vector Informatik offers a free implementation of XCP for MCUs that allows for DAQ (data acquisition) and STIM (data stimulation) here. My understanding from the technical reference manual is:

  1. The main driver functionality is given in XcpBasic.c and XcpBasic.h and should not be edited.
  2. xcp_par.c, xcp_par.h and xcp_cfg.h are to be customized to the desired MCU specifications and XCP functionality. In my case, I am using the MPC5744P so Big Endian mode should be enabled, for instance. DAQ should also be enabled.
  3. Code that links to FlexCAN message transmission and reception should be written (can be done with assistance of S32 SDK).
  4. Other driver code may be inserted to improve performance (e.g. DMA transfers).

I have so far tried to integrate the driver code but I cannot get the code to compile. I had to initially redefine some typedefs because the driver does not use the same semantics as in the C99 standard (so 'vuint32' instead of 'volatile uint32_t' or 'vuint32_t' for 'volatile unsigned long int').

After all of the corretions, I get the error 'make: *** [makefile:68: Executable.elf] Error 1', which does not point to any specifc C error, making it extremely hard to trace.

In the makefile itself, line 68 contains the GCC compile command 'powerpc-eabivle-gcc -o "Executable.elf" "@Executable.args" ...' so I doubt the error is in there. In addition, the makefile is autogenerated on compilation, which, I suppose, should not be edited manually.

I have tried cleaning and rebuilding the project to see if the error goes away but it does not.

Since I am not using XCP Professional or related configuration software, the code integration is done manually and there does not seem to be a lot of support on Vector's side for the free version hence I am wondering if someone has successfully integrated these libraries and if they had to overcome the above bolded error.

Thanks.

Labels (1)
8 Replies

5,736 Views
nilutawri
Contributor I

Hello there,

Is there XCPonCAN sample basic project available for mpc5744p DevKit board?

Thanks for your help in advance.

 

0 Kudos

6,690 Views
chuluezhong
Contributor II

I have managed to implement the XCP Driver (with linker suppression of multiple definitions) and DAQ mode is working, to an extent. I was able to connect to the MPC5744P-DEVKIT using MATLAB as XCP Master, however, the data is wrongly scaled. For testing, a basic model is implemented:

uint32_t model(uint32_t res) {
    if (res < 2000)
        return res * 2 + modelOffset; // modelOffset set to 2.
    else
        return 0;
}

This model is once each iteration in the main while(1) loop. However, on reading the results in MATLAB via XCP, the data range is scaled:

XCP_DAQ_WrongScales1.png

I provide the code as well as the MATLAB script used to talk to the DEVKIT. The A2L file was generated using Vector CANape 15.

0 Kudos

684 Views
chrisab
Contributor I

Hello im using also xcp basic driver but i found some limitations i can just read one daq and one odt with totale size 8 byte, i want to increase the size to measure more variables, i ve located the issue on max dto/cto i ve changed the value in the code and in the master tool(CANape but in canape it's always 8 byte i cannot changed ), i need some help 

0 Kudos

6,690 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

I'm afraid that this question is out of scope for this community subspace. You can try ask on https://community.nxp.com/community/mbdt 

Anyway - it may be caused by big-endian architecture of PowerPC (you are using multi byte numbers). But it is just guess. 

Jiri

6,690 Views
chuluezhong
Contributor II

Yes, I have attached the project. The main function however contains only dummy calls, some of which are commented out. I have just been trying to see if the project could even compile without me performing the necessary driver hooks such as actually reading from the FlexCAN drivers.

0 Kudos

6,690 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

you have bunch of multiple definitions in your project (I didn't look for reason).  With -z multdefs linker option your project can be build, but I didn't test the functionality: 

pastedImage_1.png

Hope it helps. 

Jiri 

6,690 Views
chuluezhong
Contributor II

Thanks for this. The linker command -z muldefs does indeed remedy the problem.

I have tried surrounding all my definitions with #ifndef ... #endif guards without the band-aid linker command and the above error still appears suggesting that multiple definitions are to be found within the supplied XCP driver code.

0 Kudos

6,690 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

can you please share your project? 

Jiri

0 Kudos