2013-12-18 05:52 AM
Hi
I'm trying to write data to eeprom using I2C protocol (Polling Method), but while checking event 5 (EV5) as well as event 6 (EV6) I'm getting '' Bus error & Arbitration loss '' error. How can i overcome this... please help me somebody #i2c #basic-electronics #stm32f103rrbt6 #need-help-interfacing-to-eeprom2013-12-20 05:04 AM
Have you gone through my code ?? Is their any flaw ?? If not, tell me where should i concentrate ? or what are the things should i consider ?? to be frank i don't know why that error is coming...& what should i do to over come that ? If you have any idea, that will be much helpful for me.... Thanks for your support...
Regards Selva....2013-12-20 05:40 AM
I do not see any code here on the posting.
Post it and I will try. As I said, the problem may not be code. It could be hat the bus contention is real. If the bus contention is real - you may not be able to fix it in code.2013-12-20 05:47 AM
Ok... this is my code...
2013-12-20 05:59 AM
Hi
OK, I have had QUICK look (so it is not definitive) : Not sure if the port pins have I2C output selected on them. Hopefully, the I2C_init() function does that for you. The while loops can get stuck forever - you have probably found this. One thing for you to try is to disconnect the EEPROM and try the code again. If the code is OK - you will get a no response error instead.2013-12-21 01:34 AM
Hi sung,
As per your suggestion i removed the eeprom & i tried. I'm not getting any error.... Thank u sung....2013-12-22 10:16 PM
Hi sung.chen_chung,
I tried using interrupt method, but now I'm getting ''Acknowledgement Failure error'' after initiating the slave address. what should i do to overcome this error ?? why this error is coming ?? any idea ?? help me sombody.. Thank you............2013-12-23 02:44 AM
Hi
I am beginning to think that you do not understand the I2C protocol. Do you understand the I2C protocol? '' I tried using interrupt method, but now I'm getting ''Acknowledgement Failure error'' after initiating the slave address. what should i do to overcome this error ??'' Is this with the EEPROM attached ? If it is not attached - then you will get a NACK.2013-12-23 04:11 AM
Thank you for reply sung,
I have a doubt.... please don't mind...... As per the datasheet '' the port line should be Open Drain '' is both SDA & SCL should open drain ? or only SDA ? why I'm asking means, when i configure both SDA & SCL as open drain (with EEPROM or Without EEPROM) connected, I won't get any interrupt & even error also. Only Busy Flag will be High. But when i configure both SDA & SCL as Push Pull ( Without EEPROM ), I'll get every time error interrupt (i.e. Ack failure) error. With EEPROM :- After initiating Start condition I'll get Event interrupt (i.e. EV5 ) & then, when i try to initiate the slave address, I'm getting error interrupt (i.e. Ack failure) error. Hope you got the problem... I'm just struck here..... Please help me, I'm waiting for your response....Thanks Regards Selva....2013-12-23 08:16 AM
Hi
As I thought, you do not understand I2C. Your problem is not just the software. You must first understand what I2C is and how it works: Try this first : http://en.wikipedia.org/wiki/I%C2%B2C The official specification is here : http://www.nxp.com/documents/user_manual/UM10204.pdf (but it is difficult to read unless you are an electronics person) Basically the bus works by allowing any of the devices pull either SDA or SCK low when they want to. If any of the devices pulls either line low while an I2C transmission is going on - this dissrupts the I2C transmission (the bus collision you were getting). All I2C transmissions are 9 bits (8 data bits and 1 ACK bit). The ACK bit is left high by the transmit side (master) and the receiver must pull the SDA low to signal an ACK. I2C Transmissions are signaled with StartBit and StopBit (SDA is changed while SCK is high, while bits are sampled on the transition of SCL going low to high) You CANNOT drive I2C with push pull - it must be done by open collector. Most do not use the built in pull up resistors - most use external pull up resistors (2k to 5K will work). The STM32 has a built in controller which knows how to generate the whole sequence - you just need to set it up for start/stop bits and byte transmissions. However, it can be tricky to get right.2013-12-24 02:52 AM
''but it is difficult to read unless you are an electronics person''
If you are doing interfacing work at this level, then you need at least a sufficient grasp of electronics to be able to understand this kind of specification!You could start here: