Yahoo Groups archive

Lpc2000

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

Thread

simplest CAN test!

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

RE: [lpc2000] simplest CAN test!

2005-11-03 by Gromann, Klaus

Hi Gus,

Bit0 of the AFMR-register turns off all CAN messages, that means all
messages are ignored.
If you want to receive all messages you have to set only bit1 of the
AFMR to 1

AFMR = 2 should do what you want

brgds
Klaus
Show quoted textHide quoted text
-----Original Message-----
From: lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com] On Behalf
Of Gus
Sent: Tuesday, November 01, 2005 7:32 PM
To: lpc2000@yahoogroups.com
Subject: [lpc2000] simplest CAN test!


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







 
Yahoo! Groups Links

Re: simplest CAN test!

2005-11-03 by Gus

haha......that was one of the problems. The other one was the bit 
timing....I hate CAN bittiming. I understand it but still hate it!!! 
I don't know how biginners can do CAN :-)

Gus

--- In lpc2000@yahoogroups.com, "Gromann, Klaus" 
<klaus.gromann@r...> wrote:
>
> Hi Gus,
> 
> Bit0 of the AFMR-register turns off all CAN messages, that means 
all
> messages are ignored.
> If you want to receive all messages you have to set only bit1 of 
the
> AFMR to 1
> 
> AFMR = 2 should do what you want
> 
> brgds
> Klaus
> 
> 
> -----Original Message-----
> From: lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com] On 
Behalf
> Of Gus
> Sent: Tuesday, November 01, 2005 7:32 PM
> To: lpc2000@yahoogroups.com
> Subject: [lpc2000] simplest CAN test!
> 
> 
> 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 
Show quoted textHide quoted text
> 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
> 
> 
> 
> 
> 
> 
> 
>  
> Yahoo! Groups Links
>

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.