rbei-etas / busmaster

BUSMASTER is an Open Source Software tool to simulate, analyze and test data bus systems such as CAN. BUSMASTER was conceptualized, designed and implemented by Robert Bosch Engineering and Business Solutions (RBEI). Presently it is a joint project of RBEI and ETAS GmbH.
http://rbei-etas.github.com/busmaster/
GNU General Public License v3.0
951 stars 502 forks source link

Channel Specific Message Types #335

Open Bosch-JakobLichterfeld opened 12 years ago

Bosch-JakobLichterfeld commented 12 years ago

Hi there, it will be great, if some of you could implement Channel Specific Message Types.

What I intended to do: Same as in capl, I want to receive all messages on channel 1 and route them all to channel 2, so for example the ES581.3 is connected to the ECU at channel 1 and to the rest at channel 2. The goal is to change only one bit in one specific message. This could not be made by node simulation, I think.

When trying to convert a capl file doing the stuff, there will be a warning like this: "Channel Specific (message CAN1.*) Message Types are not supported yet.".

I am looking forward to see this great improvement soon, so I am able to use open source software for my daily work.

Best regards J. Lichterfeld

etas-lorenz commented 12 years ago

CAPL has such an event handler with "on message CAN2.*" that reacts to all messages received by CAN2 chip.

So we should support this also, I agree.

RBEI-ArunKumar commented 12 years ago

With existing node simulation, the channel wise routing is possible. This can be achieved by addition of message handlers in node simulation. Here is a sample message handler which upon reception on message ID 0x100 from channel 1, modifies databyte 1 to 0x20 and routes it to channel 2.

/* Start BUSMASTER generated function - OnMsgID_100 */ void OnMsgID_100(STCAN_MSG RxMsg) { //If message comes from channel 1 if (RxMsg.m_ucChannel == 1) { //Set Databyte 1 to 0x20 RxMsg.m_aucData[0]= 0x20;

//Change channel No to 2
RxMsg.m_ucChannel = 2;

//Send back message on channel 2
SendMsg(RxMsg);

} }/* End BUSMASTER generated function - OnMsgID_100 */

etas-lorenz commented 12 years ago

@Jakob: Is does this fulfill your requirements?

@Arun: Does our CAPL-Import filter take care of this? If not, we should implement it accordingly.

Bosch-JakobLichterfeld commented 12 years ago

@etas-lorenz: I hope that I can test it today and then give you feedback.

Bosch-JakobLichterfeld commented 12 years ago

@RBEI-ArunKumar

I tried it as follows (I changed the names and the structure), but of course it fails, because SendMsg expected STCAN_MSG but the automated generate function only give Test1...

/* Start BUSMASTER generated function - OnMsg_All */ void OnMsg_All(STCAN_MSG RxMsg) { //If message comes from channel 1 if (RxMsg.m_ucChannel == 1) { //Change channel No to 2 RxMsg.m_ucChannel = 2;

    //Send back message on channel 2
    SendMsg(RxMsg);

}

}/* End BUSMASTER generated function - OnMsg_All */

/* Start BUSMASTER generated function - OnMsgName_Test1 */ void OnMsgName_Test1(Test1 RxMsg) { Test1 sMsgStruct = { 0x1, 1, 0, 2, 1, { 0, 0, 0, 0, 0, 0, 0, 0 },1 }; //If message comes from channel 1 if (RxMsg.m_ucChannel == 1) { //modify message RxMsg.m_sWhichBit.TestBit1 = "true";

    //Change channel No to 2
    RxMsg.m_ucChannel = 2;

    //Send back message on channel 2
    SendMsg(RxMsg);
}

//If message comes from channel 2
if (RxMsg.m_ucChannel == 2)
{
    //modify message
    RxMsg.m_sWhichBit.TestBit1 = "true";

    //Change channel No to 1
    RxMsg.m_ucChannel = 1;

    //Send back message on channel 1
    SendMsg(RxMsg);
}

}/* End BUSMASTER generated function - OnMsgName_Test1 */

RBEI-ArunKumar commented 12 years ago

Hi,

Please use the following type conversion for SenMsg() API while using database message handlers.

SendMsg(_((STCANMSG)&RxMsg));

Bosch-JakobLichterfeld commented 12 years ago

Hi, today I finally was able to test it, and the routing from channel 1 to channel 2 and vice versa. Thats great, but it only works with Vector CANCaseXL, the ETAS ES581.3 doesn't work, I get only a lot of bus errors.

So I hope, that there will be a graphic solution for routing in future, best with compiling so timing will be no problem.

etas-lorenz commented 12 years ago

Great!

I also expect that our CAPL importer supports this, so converts "message CAN1.*" to "if (RxMsg.m_ucChannel == 1)".

I'm closing this issue.

Bosch-JakobLichterfeld commented 12 years ago

Sorry, but when I try to convert a CAPL File, the log says:

Conversion is Completed With 1 Error(s) and 0 Warning(s)

Errors Occured in Conversion:(1 Error(s)) 
    Channel Specific (message CAN1.*) Message Types are not supported yet.

The conversion of "message CAN1.* m;" fails, it returns "ChannelSpecificMsg m;;" so the title of this bug is correct, Channel Specific Message Types are not supported yet...

etas-lorenz commented 12 years ago

Ok, then we should support this in the CAPL importer.

Bosch-JakobLichterfeld commented 12 years ago

Yeah, that will be great. By the way: "on message CAN2.*" is correctly converted into "if( RxMsg.m_ucChannel == 2 )"

dani1479 commented 8 years ago

Have you implemented this feature?