LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
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.

Notices


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

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


Hello,

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;
CSVrecord.programVersion=PROGRAM_VERSION;
/* 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);
CSVrecord.variableName="channel_select";
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)
{
//cmdByte0=0xE1;
//cmdByte1=0xFF;

OutFrame->data[0]=0xE1;
OutFrame->data[1]=0xFF;
// Also, assign the width of the variable
OutFrame->data[2]=variableWidth;

} // 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.

B. On TARGET (ARM9):
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:	2
Size:	248.7 KB
ID:	15926  

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


Reply


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 11:06 AM
Transfering modified kernel from host to target Ralph058 Linux - Kernel 1 08-15-2012 09:15 PM
[SOLVED] help with GCC build/host/target entz Linux - Software 4 07-17-2011 03:52 PM
What build host target combinations to use? abelian0987 Linux - Software 0 07-12-2011 04:27 AM
Explaining --build --host --target gnashley Slackware 2 12-14-2006 01:27 PM


All times are GMT -5. The time now is 11:22 AM.

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