| Author | beginning argument ( Replies received: 3 ) |
| mykola.kyrylenko |
Posted 23-06-2008 at 04:23   |

Registered on : 02-25-2008
Messages : 8
OFF-Line
|
Hi,
I need to be able to both transmit and receive CAN extended and standard messages.
The transmit I can coordinate by changing the message object details, but I cannot predict the format of the incoming message.
According to the STR9 reference manual, there are up to 32 message objects that can be identified, but the functions CAN_SetRxMsgObj() and CAN_SetTxMsgObj() both call GetFreeIF() to allocate a message interface. GetFreeIF() only can allocate 2 interfaces (one each for Rx and Tx).
I have tried to configure both message objects as extended, but specify the message as standard, and this did not work in either direction.
Other CAN devices seem to have no problems accepting both standard and extended messages simultaneously, so I assume it must be possible with the STR912FW44 CAN interface.
Is it possible to allocate multiple message objects to a single interface?
If not, what would be the solution?
Thanks for the help,
Mykola
[I am using Raisonance Ride7 with the ST library version 2.0]
|
|
|
Profile
Quote
|
| mykola.kyrylenko |
Posted 23-06-2008 at 06:36   |

Registered on : 02-25-2008
Messages : 8
OFF-Line
|
Hi,
As per usual a solution was found after writing on the forum...
For receiving both standard and extended messages, in CAN_SetRxMsgObj() CAN_EXT_ID was passed as the parameter, but CAN_M2R_MXTD was not set in M2R register, and CAN_A2R_XTD was not set in the A2R register. [91x_can.c was edited]
For transmission, CAN_SetTxMsgObj() was called with either CAN_STD_ID or CAN_EXT_ID prior to calling CAN_SendMessage().
BTW, is there a 'neat' solution for receive message without editing the library?
Mykola
|
|
|
Profile
Quote
|
| rgreenthal |
Posted 07-07-2008 at 17:35   |

Registered on : 02-07-2008
Messages : 43
OFF-Line
|
Can you please post or send me the Lib fix
I also may need both STD & Extended CAN formats
Thanks,
Ralph
Email to : rgreenthal@inttechcorp.com
[ This message was edited by: rgreenthal on 07-07-2008 17:58 ]
|
|
|
Profile
Quote
|
| mykola.kyrylenko |
Posted 05-09-2008 at 09:34   |

Registered on : 02-25-2008
Messages : 8
OFF-Line
|
Attached is the dual format changes. [note the commented out lines...]
regards,
Mykola
ErrorStatus CAN_SetRxMsgObj(u32 msgobj, u32 idType, u32 idLow, u32 idHigh, bool singleOrFifoLast)
{
u32 msg_if=0;
if ((msg_if = GetFreeIF()) == 2)
{
return ERROR;
}
CAN->sMsgObj[msg_if].CMR = CAN_CMR_WRRD
| CAN_CMR_MASK
| CAN_CMR_ARB
| CAN_CMR_CONTROL
| CAN_CMR_DATAA
| CAN_CMR_DATAB;
if (idType == CAN_STD_ID)
{
CAN->sMsgObj[msg_if].M1R = 0xFFFF;
CAN->sMsgObj[msg_if].M2R = CAN_M2R_MXTD | STD_RANGE_ID_MSK(idLow, idHigh);
CAN->sMsgObj[msg_if].A1R = 0;
CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | STD_RANGE_ID_ARB(idLow, idHigh);
}
else
{
CAN->sMsgObj[msg_if].M1R = EXT_RANGE_ID_MSK_L(idLow, idHigh);
//CAN->sMsgObj[msg_if].M2R = CAN_M2R_MXTD | EXT_RANGE_ID_MSK_H(idLow, idHigh); //@@@@@
CAN->sMsgObj[msg_if].M2R = EXT_RANGE_ID_MSK_H(idLow, idHigh);
CAN->sMsgObj[msg_if].A1R = EXT_RANGE_ID_ARB_L(idLow, idHigh);
//CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | CAN_A2R_XTD | EXT_RANGE_ID_ARB_H(idLow, idHigh); //@@@@@
CAN->sMsgObj[msg_if].A2R = CAN_A2R_MSGVAL | EXT_RANGE_ID_ARB_H(idLow, idHigh);
}
CAN->sMsgObj[msg_if].MCR = CAN_MCR_RXIE | CAN_MCR_UMASK | (singleOrFifoLast ? CAN_MCR_EOB : 0);
CAN->sMsgObj[msg_if].DA1R = 0;
CAN->sMsgObj[msg_if].DA2R = 0;
CAN->sMsgObj[msg_if].DB1R = 0;
CAN->sMsgObj[msg_if].DB2R = 0;
CAN->sMsgObj[msg_if].CRR = 1 + msgobj;
return SUCCESS;
}
|
|
|
Profile
Quote
|