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.

[SOLVED] I2C-Hardware problem

Status
Not open for further replies.
Only two arm7 devices are available in the bus. is we can isolate the controllers. i am checking that..
 

Hi shruv

Thanks for your help.. i gone through the code, its really useful.. in slave what states are you checking, i am checking 0x60 and 0x80. any suggestions..

I've checked for 0x70 & 0x90 states,the slave addr is 0x00 (general call address).
 

HI shruv
is it not possible to assign a particular address to a microcontroller, whether i need to use the general call bit.
 

Hi shruv
I tried your code from word press.com, it worked well but the slave did'nt receive the data in the state 0x90. it enters the state only one time but the value displayed is 0.. i verified in both Proteus and hardware output. the problem repeats. i have attached the slave c file with this, any ideas,suggestions would be helpful to me


Code:
#include <lpc214x.h>
#include "type.h"
#include "LCD_16x2.h"


void I2C_Inti(void);
__irq void I2C_ISR(void);
int c,i;
char k;
char buf[8];
int  main()
{
  LCD_Init();
  PINSEL0&=0xFFFFFF0F;
  PINSEL0|=0x00000050;// using i2c0
  VICVectCntl0 = 0x20 | 9; 
  VICIntEnable |= (1<<9);
  VICVectAddr0 = (unsigned long)I2C_ISR; 

 
	I2C_Inti();

	Display_String("slave");
	LCD_Command(0x80);

	
}
void I2C_Inti(void)
{
	I2C0ADR=0x01;
 I2C0CONCLR= 0xff;
 I2C0CONSET=0x40;
	I2C0CONSET=0x04;
 
	
}

__irq void I2C_ISR()
{
switch(I2C0STAT)
       {
           case 0x70 : Display_String("g");  
                              I2C0CONSET|=0x04;  //AA bit set
                              I2C0CONCLR=0x08;
                              break;
           case 0x90 :
						 for(i=0; i<9; i++)
					 {
						 Display_String("r");
						 buf[i]=I2C0DAT;  //data received and stored safely
					 }                  Display_Decimal(buf[i]);
				                      I2C0CONCLR=0x08;
                             
                             break;
           case 0xa0 :Display_String("p");
                             I2C0CONCLR=0x08;
                             break;
           default:Display_String("n");
                       I2C0CONCLR=0x08;
                       break;
}

VICVectAddr=0x00;
}

Thanks for your attention

Regards

sundar
 

hi 2 all,

Proteus is not always show the correct hardware effect , your hardware is not correct than it also possible that you may have correct program but output will not be correct. check for device address , and use proper clock signal to read and acknowledge the data.

what you are trying to do (read or write operation)?
 

Hi jaga

i am going to write data to the slave. i use general call address 0x00.


regards
Sundar
 

Hi jaga
I found your information useful and i have got output for i2c transferring data at 25khz,. Thanks to all who helped me out ..


Regards

Sundar
 

HI sundar,

congratulation.
hopefully what is the problem u found?
share it .

thank you .
 

Hi jaga123

Clock speed is main issue it worked in 25khz but not in 100 khz, need to make it work for 100 khz

Regards

Sundar
 

ok good.
thank you.
if you have any further i2c problem . than share it.
 

Hi everyone
I am facing problems while working in lpc2148 i2c slave transmitter mode, data is not transmitted from the slave to the master. i had successfully transmitted data from the master to the slave, but facing problems in this, any ideas would be helpful. i am using interrupts , no problems with hardware since i transmitted data from master to the slave using the same hardware setup.


Regards

Sundar
 

HI shruv
is it not possible to assign a particular address to a microcontroller, whether i need to use the general call bit.

I am not sure if one can assign an another address,haven't looked into that.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top