CW CAN Bean for HC908AZ60

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View

--------------------------------------------------------------------------

      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



Re: CW CAN Bean for HC908AZ60
I have some sample code for the msCAN for the HC12
which should be the same as the HC08.  If you are interested,
email me at snipped-for-privacy@zanthic.com  Due to spam this
email gets changed after a couple of days so if somebody is
reading this later and wants the code you'll have to go to
my web site for a current email address.
Steve

Steven D. Letkeman BSc.
President - Zanthic Technologies Inc.
403-526-8318
www.zanthic.com Embedded micro-controllers and CAN interfaces
www.brightan.com Automated lighting systems

Quoted text here. Click to load it
is
*/
Quoted text here. Click to load it



Site Timeline