I am new to AUTOSAR
com module. I would like to perform some scenario to check specific messages in CAN FD. Here I want to block all the CAN FD
messages except one message (eg: ID: 0x22
) during some event occurred.
My idea is to loop all the CAN FD
PDU
ID's and check the corresponding message ID(0x22
). Here the problem is, I have to traverse through all the CAN FD
PDU
ID's. (If CAN FD PDU's are 200
, I have to loop 200
times.)
I would like to know, Is there any other good method to block all the CAN FD
message except some messages in AUTOSAR environment? Also where i have to block this PDU's ? Is it in COM
module or CANIf
module ? Please correct me if my understandings are wrong.
You can try to create several Tx ISignalIPduGroups in the SystemDescription/EcuExtract. You assign each ISignalIpdu to the according ISignalIPduGroup. Then you can enable/disable the necessary ISignalIPduGroup.
e.g.
IPduGroup_Tx_A - CommunicationDirection=OUT
ISignalIPdu_Tx1
ISignalIPdu_Tx2
IPduGroup_Tx_B - CommunicationDirection=OUT
ISignalIPdu_Tx3
ISignalIPdu_Tx4
IPduGroup_Rx_B - CommunicationDirection=IN
ISignalIPdu_Rx1
ISignalIPdu_Rx2
IPduGroup_Rx_B - CommunicationDirection=IN
ISignalIPdu_Rx3
ISignalIPdu_Rx4
You can either trigger it directly over Com
void MyCdd_MainFunction(void)
{
if (cond_tx_a == TRUE) {
Com_IpduGroupStart(COM_IPDUGROUP_TX_A, TRUE);
} else {
Com_IpduGroupStop(COM_IPDUGROUP_TX_A);
}
if (cond_tx_b == TRUE) {
Com_IPduGroupStart(COM_IPDUGROUP_TX_B, TRUE);
} else {
Com_IpduGroupStop(COM_IPDUGROUP_TX_B);
}
if (cond_rx_a == TRUE) {
Com_IpduGroupStart(COM_IPDUGROUP_RX_A, TRUE);
} else {
Com_IpduGroupStop(COM_IPDUGROUP_RX_A);
}
if (cond_rx_b == TRUE) {
Com_IPduGroupStart(COM_IPDUGROUP_RX_B, TRUE);
} else {
Com_IpduGroupStop(COM_IPDUGROUP_RX_B);
}
}
So, when cond_tx_a == TRUE
it will start the IPduGroup_TX_A
and therefore, the ISignalIPdu_Tx1
and ISignalIPdu_Tx2
will be transmitted now, but ISignalIPdu_Tx1
and ISignalIPdu_Tx2
will not be sent, unless cond_tx_b == TRUE
. The same is happening with the IPduGroup_RX_A
and IPduGroup_RX_B
and their mapped ISignalIPdus, except, for Rx PDUs, you actually disable to the reception, but actually the Deadline Monitoring of Rx ISignalIPdus.
You could also configure such switching of IPduGroups in BswM (see configuration BswMPduGroupSwitch
) without much writing direct code.
We had this with some OEM, where all messages had a assignment to a PowerSource, if transmitted or not.
IpduGroup_PowerSource_PlusB
IpduGroup_PowerSource_ACC
IPduGroup_PowerSource_IG1
IPduGroup_PowerSource_IG2
We had some rules generated out of the NetworkDescription, which automatically start/stop the Ipdus depending on, if they are mapped to the group or not. PowerStatus was the input to the BswM. BswM even has now BswMTimer support. So you could e.g. make rules, to:
The nice thing about BswM is, it is mostly configured, without actually writing one line of code manually. You could even update this in case of POSTBUILD configurations.