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.

[ARM] I2C -lpc2148 isr problem

Status
Not open for further replies.

Sundar Raju

Newbie level 2
Joined
Mar 30, 2014
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
24

Code C - [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
void I2C_Initi(void);
__irq void I2C_ISR(void);
void ISR_8(void);
void ISR_18(void);
void ISR_10(void);
void ISR_28(void);
 
 
int i,Temp,f;
 
 
 
int main()
{
PINSEL0&=0xFFFFFF0F;
PINSEL0|=0x00000050;// using i2c0
I2C_Initi();
I2C0CONSET|=0x20;/* Send start bit */
 
while(1)
{
IOCLR0=0x40;
IOSET0=0x40; //post indicators
 
}
}
 
void I2C_Initi(void)
{
    
    
I2C0CONCLR=0X6C;   
I2C0CONSET=0X40;   
 
I2C0SCLH= 0x01;
I2C0SCLL= 0x90;
 
VICVectCntl0 = 0x20 | 9; 
VICIntEnable |= (1<<9);
VICVectAddr0 = (unsigned long)I2C_ISR; 
 
}
 
__irq void I2C_ISR()
{
      
  Temp=I2C0STAT;                    
switch(Temp)
{
case 0x08:
ISR_8();
break;
case 0x18:
ISR_18();
break;  
case 0x28:
ISR_28();
break;
}
 
VICVectAddr = 0xff;
 
}
  
void ISR_8(void)
{
    
I2C0DAT=0x60;              //slave address//
I2C0CONSET=0x04;
I2C0CONCLR=0x08;      
}   
 
void ISR_18(void)
{ 
        I2C0DAT=0x32 ; // sample data
    I2C0CONSET=0X04;    
      I2C0CONCLR=0x08;
}
 
 
void ISR_28(void)
{
    I2C0DAT=0x24 ;   // next data
    I2C0CONSET=0X04;    
    I2C0CONCLR=0x08;
    
}



i am using two lpc2148. one as master and other as slave. afterthe address acknowldgement form the slave. no data has been send.

any suggestions
 
Last edited by a moderator:

Have you debugged your code to see if it runs all the way through and to make sure it doesn't get stuck? Did you check your registers to make sure that it doesn't get overwritten or an overflow errors?
 

Check out what's the status the master is returning after you try to send data.That will help you debug your code.
 

HI shruv

Thanks for replying...

I visited the link, its really useful... i have configured master as mentioned in that, i am having problems in slave side , my slave configuration as follows

first i have enabled the I2EN bit and AA bit , while checking the states it waits in state 0x60. after that it does not progress any ideas would be helpful.


Regards

raj
 

Post the schematic and code
 

HI shruv

Thanks for replying...

I visited the link, its really useful... i have configured master as mentioned in that, i am having problems in slave side , my slave configuration as follows

first i have enabled the I2EN bit and AA bit , while checking the states it waits in state 0x60. after that it does not progress any ideas would be helpful.


Regards

raj

Could you tell me why have you selected slave receiver mode? and can you also post the code?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top