Microcontroller protection from EMI

Thread Starter

ecka333

Joined Oct 1, 2009
76
Problem is solved finally. The problem was caused by sensitive I2C bus. That is microcontroller always stucked when data read from DS1307 chip occured. Tried several ways to reduce sensitivity, but nothing helped. Then changed one manufacturer's DS1307 chip to another (to maxim's i suspect, but cant to say exactly). And problem magically dissapeared! So thanks to everyone who tried to help me.
 

takao21203

Joined Apr 28, 2012
3,702
Problem is solved finally. The problem was caused by sensitive I2C bus. That is microcontroller always stucked when data read from DS1307 chip occured. Tried several ways to reduce sensitivity, but nothing helped. Then changed one manufacturer's DS1307 chip to another (to maxim's i suspect, but cant to say exactly). And problem magically dissapeared! So thanks to everyone who tried to help me.
Hmm. I suggested this as one potential source of the problems.
For instance it can happen during acknowledge polling.
Having a timeout interrupt also could be a helping (+ retry).

I used I2C at 500 KHz, so there is no need to wait. Without a filter coil, the display reading would always go corrupt.

You should never allow an I/O signal to lock up the controller, always think it could become corrupted for some reason.
 

takao21203

Joined Apr 28, 2012
3,702
Depends on your I2C code. You could OR it with the test for the acknowledge. There are mainly software I2C codes, and hardware I2C codes.

Per hardware, it is possible to poll the serial port flag, or also do that with interrupt. It is sometimes polled, especially for high-speed serial transfer.

Do you use assembler/C? I2C library or did you write it yourself?

What is your processor speed? Could you reduce that perhaps? Then a I2C code without delay can be used. It is just a couple of lines in C, without the delay. I even removed the I/O access, only changing the TRIS, since there is a pullup already.
 

ErnieM

Joined Apr 24, 2011
8,415
It actually entails a completely different way of doing I2C transactions over what the typical library code does. I wrote my own timeout routines when I was doing some work with the PIC32's.

It's not that hard, but you do have to pick a way to determine either how much time has passed, or how many tries you want to give something to complete.
 
Top