2006-08-21 02:56 AM
2005-10-13 04:59 AM
Dear moderator! :-Y
I must say the datasheet on CAN controller of STR7 is very very poor! First: when CAN controller is in test mode with silent and loopback on it doesn't activate RxOk flag in CAN Status Register when message arrives, whic should not be so!? Question: why is in ST Library version 3.0 extended id etracted in this way: pCanMsg->Id = ((CAN->sMsgObj[1].A2R >> 2) & 0x07FF) | ((u32)CAN->sMsgObj[1].A1R << 11) | (((u32)CAN->sMsgObj[1].A2R & 0x0003) << 27); ? In documentation there states that A1R holds lower 16 bits of extended ID and A2R holds higher 13 bits of extended id, is this not so? Are there any known problems in receiving of extended id messages as upon reception content of A1R and A2R registers are all 0. Thank you.2005-10-13 07:47 AM
Well this is the thing,
I still think RxOk flag doesn't get activated in loopback silent mode! On extended identifiers it is perfectly ok to use A1R for lower 16 bits and A2R for upper 13 bits of extended identifier, I don't know why is all of that shifting done in library functions!2005-10-16 11:17 PM
Hello,
About the first point which is the assertion of the RxOK bit in the status register: this bit IS NOT asserted in loopback mode because the Rx pin is not monitored in this mode, only TxOK will be asserted when a transmission will occur. About the second point which is regarding to the Id of the message, it seems it could be 2 ways to understand the datasheet, here is the right one: when an extended Id is stocked, the 11 LSBs should be the ID[28:18] (which are the standard ID) (in A1R), the next higher bit are the ID[15:0] (in A2R) and the MSBs are ID[17:16] (in A1R). Perhaps a easier way would have to be done. This should explain the way the library extracts the Id. About the lack of information in datasheet, it seems the Ip came from a third party which gave a previous reference manual which was as ''poor'' as this one.2005-10-17 06:18 AM
Hallo,
thanks for the answers. I did not expect that RxOk is not asserted because it can't than be used for checking the interrupt routines, at least not correctly. For the extended identifier explanation now it is clear, but I think that if you asked a hundred people on what they think is written in datasheet I'm sure at least 90% would say that 16 LSB of id are in A1R and remaining 13 of MSB are in A2R register. Anyways thanks.2005-10-18 12:04 AM
BTW, I think that in your second answer you mixed A1R and A2R, in A1R is 16 bits of ID, and in A2R is 13 bits.
2005-10-19 08:18 AM
You are wrong on extended identifiers, it is like so 16 LSB of ID are in A1R and remaining 13 bits are in A2R.
2005-12-08 11:38 PM
Std ID : ID[28:18]
Ext ID : ID[17:16] ID[15:0] ID[28:18] MSB-------------------------LSB or Std ID : ID[28:18] Ext ID : ID[28:18] ID[17:16] ID[15:0] MSB-------------------------LSB Which is true ?2005-12-09 12:11 AM
Quote:
On 19-10-2005 at 20:48, Anonymous wrote: You are wrong on extended identifiers, it is like so 16 LSB of ID are in A1R and remaining 13 bits are in A2R. I think, you are wrong. when an extended Id is stocked, the 11 LSBs should be the ID[28:18] (which are the standard ID) (in A2R), the next higher bit are the ID[15:0] (in A1R) and the MSBs are ID[17:16] (in A2R). Ext ID : ID[17:16] ID[15:0] ID[28:18] ---------MSB--------------------------LSB is it true ?2005-12-13 10:17 PM
All apologies, my previous message was wrong and A2R should be reversed with A1R.
And I added this in order to be clearer. The Id of a message depend of the point of view you take: physical CAN trame, arbitration registers and software buffer. With the protocol CAN 2.0B (extended Id), the arbitration part of the trame is transmitted as follows: STDID[10..0] EXTID[17..0] MSB-----LSB MSB-------LSB The CAN arbitration registers are: A2R[12..2] for the STDID MSB----LSB (ID[28..18] of A2R) A2R[1..0] A1R[15..0] for the extended part MSB---------------LSB (ID[17..16] of A2R and ID[15..0] of A1R) The pCanMsg->Id software buffer: bit[28..0] EXT Id part, STD id part MSB------------------LSB Maybe the last one should be coded differently.