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
