Yahoo Groups archive

Lpc2000

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

Message

CAN baudrate/processor

2005-05-04 by vanewend

Hi,

I'm a student and I joined the lpc2000 group awhile ago. I have just
been reading and looking information to my school project. I'm using
LPC2129. I'm going to build CAN network and I have slight problem, or
I think so, to get my CAN work at 1 Mbit.

My settings are:

void processorInit(void)
{
	// set PLL multiplier & divisor.
	PLLCFG = PLLCFG_MSEL | PLLCFG_PSEL;

	// enable PLL
	PLLCON = PLLCON_PLLE;
	PLLFEED = 0xAA;   // Make it happen.  These two updates
	PLLFEED = 0x55;   // MUST occur in sequence.

	// wait for PLL lock
	while (!(PLLSTAT & PLLSTAT_LOCK))
		continue;

	// enable & connect PLL
	PLLCON = PLLCON_PLLE | PLLCON_PLLC;
	PLLFEED = 0xAA;   // Make it happen.  These two updates
	PLLFEED = 0x55;   // MUST occur in sequence.

	// setup & enable the MAM
	MAMTIM = MAMTIM_CYCLES;
	MAMCR = MAMCR_FULL;
}

#define FOSC	(10000000)// Master Oscillator Freq.
#define PLL_MUL	(6)	// PLL Multiplier

// Pheripheral Bus Speed Divider
#define PBSD	1	// MUST BE 1, 2, or 4
#define PCLK	(CCLK / PBSD)	// Pheripheal Bus Clock Freq.

I'm using external 10 Mhz crystal 

My calculations are:

PLLCFG = PLLCFG_MSEL | PLLCFG_PSEL;
PLLCFG_MSEL   ((PLL_MUL - 1) << 0) // PLL_MUL = 6 = 1010 
PLLCFG_PSEL   ((PLL_DIV - 1) << 5)
PLL_DIV       (FCCO_MAX / (2 * CCLK)) // FCCO_MAX = 320 000 000
CCLK          (FOSC * PLL_MUL) // FOSC = 10 000 000

CCLK = 60 000 000

PLL_DIV = 2 = 10

PLLCFG_PSEL = 10000
PLLCFG_MSEL= 1001
PLLCFG = 11001

VPBDIV = 1;

With these setting and using value from message 6065:

#define CANBit1000k_60MHz 0x48C003 // 0+1  8+1   4+1  3+1 67    3+1

it should work ok?

Best Regards

Vanessa W

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.