Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 07-16-2014, 01:31 PM   #1
LQ Newbie
Registered: Oct 2009
Posts: 13

Rep: Reputation: 0
XCP over CAN did run ok BUT now it runs on host + NOTon target !!!


Kindly, I'd like to ask who have a background in XCP or CAN or a similar issue for help ...

* In short: I develop an embedded Linux application that relies on XCP over CAN. The program reads Hexa addresses of ECU variables from a csv file, then it gets the values of these variables from the addresses. By debugging the code (on host), there is no problems. Further, I get +ve responses & the correct values from the ECU. However, after cross-compiling & running the program, I get -ve responses .... I made sure that cross compilation & csv file & its parsing are fine.

*** For mor clarification: I uploaded a snapshot demonstrates the difference between the correct frames & values (left-hand side, on HOST), vs. the wrong / -ve frames (right-hand side, on TARGET).

* The issue is more details:
1- I initialize & construct the XCPoverCAN frames as following:

struct CSVContents CSVrecord;
/* NOTE: the same CSVrecord will be re-used over & over for every "&frXCP_WRITEDAQ_", JUST change the "name" & "frXCP_WRITEDAQ_NUMBER" of the variable every new usage */

CanXCP_SetTXFrame(&frXCP_SETDAQPTR_000,0xe2,0x00,0x00,0x00,0x00,0x00,0x00,0x00); // channel_select;0x40;0x00;0x20;0x04
// CanXCP_SetTXFrame(&frXCP_WRITEDAQ_000, 0xe1,0xff,0x01,0x00,0x40,0x00,0x00,0xF1);
// CanXCP_SetTXFrame(&frXCP_WRITEDAQ_000, 0xe1,0xff,0x01,0x00,0x00,0x00,0x00,0x00);
ReadAddress (&CSVrecord, WriteDAQ, &frXCP_WRITEDAQ_000);

2- That “ReadAddresses” functions is like:

struct CSVContents
unsigned int programVersion;
char* variableName;
unsigned char* Address;
} ;

enum command {NONE,WriteDAQ};

void ReadAddress (struct CSVContents* CSVrecord, enum command cmd, struct can_frame* OutFrame)
FILE* stream = fopen("/home/board/addresses", "r");

// ….... some OK logic ….................... //

OutFrame->can_dlc =8;
OutFrame->can_id =0x20;

unsigned char cmdByte0, cmdByte1, cmdByte2, cmdByte3;
if (cmd==WriteDAQ)

// Also, assign the width of the variable

} // END: if (cmd==WriteDAQ)

// …...... some printfs to ensure correct values assigned to the frame ….......//


3- I write the DAQ lists (XCP lists), and read the response frames. If the response frame == FF then it's +ve , else it's -ve response.

//******************************* Explaining the problem *******************************//

When assigning the addresses statically (using the function “setTxFrame” ), the responses & values were right. But after reading dynamically from addresses.csv (which I'm sure is formatted correctly & has been read correctly) I get the following results:

A. On HOST (opensuse x86):
I get +ve responses & correct values.

I get -ver response, which causes stopping sending more frames.

Thank you in advance
Attached Thumbnails
Click image for larger version

Name:	results_comparison.jpg
Views:	20
Size:	248.7 KB
ID:	15926  

Last edited by engmeshmesh1; 07-16-2014 at 01:37 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run the program from host on to the target ?? hemanth1989 Linux - Networking 34 01-01-2014 12:06 PM
Transfering modified kernel from host to target Ralph058 Linux - Kernel 1 08-15-2012 10:15 PM
[SOLVED] help with GCC build/host/target entz Linux - Software 4 07-17-2011 04:52 PM
What build host target combinations to use? abelian0987 Linux - Software 0 07-12-2011 05:27 AM
Explaining --build --host --target gnashley Slackware 2 12-14-2006 02:27 PM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 12:27 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration