Re: CW CAN Bean for HC908AZ60



Luisfr15 wrote:

>
> --------------------------------------------------------------------------
>
> Hello,
> I'm (trying ...) developing an application with CAN Bean and I'm not
> an expert of CAN ...
> I set-up bit timing correctly (20uS) and I'm able to send messages
> with SendFrame but seems that OnFullRxBuffer event is never invoked, even
> OnReceiverErrorPassive/OnBusOff are never invoked, instead OnFreeTxBuffer
> is called.
>
> This is CAN init parameters:
>
> 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, 48);
> 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 */
> }
>
> RXFIE bit in CRIER reg is set so rx CAN interrupt is enabled,
> acceptable mask is zero, so why is OnFullRxBuffer never called ... ?
> I'm sending messages with CANalyzer but
>
> Probably I'm doing many mistakes ...
> I'm using CW 3.1 with PE 2.96.
>
> Thanks a lof for any help.
>
> Luigi


I'm not an expert for msCAN, but can you please check your documentation if
the acceptance and mask register settings are correct? This is a typical
failure and results in exactly the situation that no message is received.

Another hint: depending on how "Beans" are working, may be no interrupt is
generated for calling OnFullRxBuffer. In this case I would read out the
message id and data registers to check if a frame was received.
--

with best regards / mit freundlichen Grüßen

Heinz-Jürgen Oertel

+===================================================================

Merokok dapat menyebabkan kanker, serangan jantung,
impotensi dan gangguan kehamilan dan janin.
.