Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

simplest CAN test!

2005-11-01 by Gus

For a starter, I just need to get the CAN module going in LPC to 
just ACK the frames back!

Can anyone tell me what I am doing wrong?
Is it correct that when AFMR=3 I will get all frames? If not, how do 
I get all frames? I don't need filters enabled!

My chip is not sending any ACK or error frames at all!

//500kbs @ 16Mhz
#define PROB  1
#define BRP   (1-1)
#define SJW   (1-1)
#define TSEG1 (8-1+PROB) //including propagation
#define TSEG2 (6-1)
#define SAM   0 //sample once  

void CANtest()
{
  C1MOD=1;//reset CAN
  // set the pin to CAN 1 RD1 (TD1 is not mult.)
  PINSEL1=PINSEL1 | (1<<18);
  AFMR=3;
  // set bit timing
  C1BTR=BRP|(SJW<<14)|(TSEG1<<16)|(TSEG2<<20)|(SAM<<23);
  // enable CAN
  C1MOD=0;

  while(1);
}

Gus

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.