Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me implement CAN code on LPC2129 ARM microcontroller

Status
Not open for further replies.

nelsonmjk

Newbie level 3
Joined
Nov 6, 2014
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
35
i need c code for communicating between CAN controllers of two different lpc2129/01 controllers, i just want to send one single message with same id of 3/5 characters from 1st lpc2129 to next lpc2129 , anyone please help me

best regard
nelson
 

i need c code for communicating between CAN controllers of two different lpc2129/01 controllers,
Will you be configuring the LPC2129 microcontroller(s) to act as network device(s) for a CAN network,or will you be attaching a CAN module to them which will receive instructions from a microcontroller?

Please give some more details.
 

actually im try to configure inbuilt CAN controllers of lpc2129/01(transmit from CAN1 and received by CAN2), that is communication between two lpc2129 controllers through inbuilt CAN controllers. sorry for the time delay for replay
 

The LPC21xx can controllers are software compatible with industry standard controllers, there should be plenty of software examples. I would also look for example code from NXP.

Personally I'm not using CAN with NXP controllers. I recently implemented CAN for PIC32 within half an hour by putting together the plib library examples.
 

thanks for the information , but actually i already brought lpc2129 boards, and i just need basic level program
 

What compiler set are you using?

If KEIL, it includes at least one example of CAN implementation for the LPC2129.

BigDog
 

Now i am using this following codes to transmit and receive between two mcb2100 development boards without using any acceptance filter, bcoz i only using two nodes, can any one help me to sort out the problems with this codes please.

//////////////////////////////////////////////////////////////////////

Code dot - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
code for transmitting
 
 
 
int main()
{
PINSEL1|=0X00010000;// pin0.24 TD2
initLCD();
initClocks();
 
init_can();
data=0x3FF;
while(1)
{
C2TFI1=0X00040000;
while(!(C2SR&0X00000004));
C2TID1=0X00000002;
C2TDA1=data;
C2CMR=0X00000001;
LCD_Cmd(0x80);
 
 LCD_WriteString("sending");
 
void init_can()
{
C2MOD=0X00000001;
C2BTR=0X001C001D;
C2SR=0X00000000;
C2MOD=0X00000000;
AFMR=0X00000002;  //AccBP=1 not using filter
}
 
//////////////////////////////////////
receiving part program
////////////////////////////////////////////////////
 
int main()
{
PINSEL1|=0X00004000;// Pin 0.23  RD2
 initLCD();
initClocks();
 
init_can();
 LCD_WriteString("in main");
 
 while(1);
return 0;
}
void init_canrx()
{
 
C2MOD=0X00000001;
C2BTR=0X001C001D;
C2SR=0X00000000;
C2IER=0X00000001;
C2RFS=0X00000000;
C2RID=0X00000000;
C2RDA=0X00000000;
C2MOD=0X00000000;
 
 
AFMR=0X00000000;   // NOT using filter
 
SFF_sa = 0x00000000;
SFF_GRP_sa = 0x00000000;
EFF_sa = 0x00000000;
EFF_GRP_sa = 0x00000000;
ENDofTable = 0x00000000;
 
AFMR=0X00000002; // AccBP=1
}
void init_irq()    //RD2-PIN 0.23
{
 
 
VICVectCntl0=0x20|0x1B; 
VICVectAddr0=(unsigned) canisr;
VICIntEnable=0x08000000;
 
}
__irq void canisr()
{
while(!(C2SR&0X00000001));
C2CMR=0X00000004;
 data=C2RDA ;
LCD_Cmd(0x01);
LCD_Cmd(0x80);
LCD_WriteString("rcvd data :");
lcd_intiger(data);
 
VICVectAddr=0x00000000;
}




THANKS IN ADVANCE
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top