CodeWarrior 8- & 16-bit tools: CAN Bean on HC08AZ60

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CodeWarrior 8- & 16-bit tools: CAN Bean on HC08AZ60

2,239 Views
marc_paquette
Contributor V

To help you find solutions to problems that have already been solved, we have posted this message. It contains an entire topic ported from a separate forum. The original message and all replies are in this single message.

 

Posted: Sep 28, 2005 - 07:32 AM   

Hello,
I'm developing an application with CAN beam.
I set-up bit timing correctly bit-timing and I'm able to send messages with SendFrame but seems that OnFullRxBuffer event is never invoked, even OnReceiverErrorPassive/OnBusOff are invoked, instead OnFreeTxBuffer is called.

I'm sending two messages on bus with CANalyzer, this is CAN init :

void CAN1_Init(void)
{
/* CMCR0: ??=0,??=0,??=0,SYNCH=0,TLNKEN=0,SLPAK=0,SLPRQ=0,SFTRES=1 */
CMCR0 = 1; /* CAN reset */
/* CMCR1: ??=0,??=0,??=0,??=0,??=0,LOOPB=0,WUPM=0,CLKSRC=0 */
setReg8(CMCR1, 0);
/* CIDAC: IDAM1=0,IDAM0=0 */
clrReg8Bits(CIDAC, 4;
CIDAR0 = 0; /* Set the acceptance code, register CIDAR0 */
CIDAR1 = 0; /* Set the acceptance code, register CIDAR1 */
CIDAR2 = 0; /* Set the acceptance code, register CIDAR2 */
CIDAR3 = 0; /* Set the acceptance code, register CIDAR3 */
CIDMR0 = 0; /* Set the acceptance mask, register CIDMR0 */
CIDMR1 = 0; /* Set the acceptance mask, register CIDMR1 */
CIDMR2 = 0; /* Set the acceptance mask, register CIDMR2 */
CIDMR3 = 0; /* Set the acceptance mask, register CIDMR3 */
/* CBTR0: SJW1=1,SJW0=1,BRP5=0,BRP4=0,BRP3=0,BRP2=1,BRP1=0,BRP0=0 */
setReg8(CBTR0, 196);
/* CBTR1: SAMP=1,TSEG22=1,TSEG21=0,TSEG20=1,TSEG13=1,TSEG12=1,TSEG11=0,TSEG10=0 */
setReg8(CBTR1, 220);
CMCR1_CLKSRC=0; /* Select the clock source */
CMCR0 &= ~1; /* Start the device */
/* CRIER: WUPIE=0,RWRNIE=1,TWRNIE=1,RERRIE=1,TERRIE=1,BOFFIE=1,OVRIE=1,RXFIE=1 */
CRIER = 127; /* Enable interrupts */
}

as you can see RXFIE = 1 so RX interrupt is enabled, acceptable mask is zero, why is OnFullRxBuffer never called ?

Thanks a lof for any help.

Luis.


 

Posted: Oct 04, 2005 - 09:04 AM   

According CAN bean initialization the Acceptance code property is set to 0 and Acceptance mask is set to 0 too. It means that messages are accepted only if acceptance code is 0.

Please try to set Acceptance Mask to 0xFFFF value and any message should be accepted. 
 
 
 
Oct 04, 2005 - 11:45 AM   

PEXPERT wrote:
According CAN bean initialization the Acceptance code property is set to 0 and Acceptance mask is set to 0 too. It means that messages are accepted only if acceptance code is 0.

Please try to set Acceptance Mask to 0xFFFF value and any message should be accepted.


Yes, you are right, but when I tried to set mask to 0xFFFF I put wrong parameters in ReadFrame function inside OnFullRxBuffer function. This caused CAN communication to *freeze* and CANalyzer showed ErrorFrame, so I thought there was error in mask ...

Now it works correctly.

Thanks for your answer.

Luis.


 

Labels (1)
Tags (1)
0 Kudos
0 Replies