2
\$\begingroup\$

I have a PCB with a Microchip PIC18F97J60 on it and every time I key a 5 watt radio transmitting at 144 Mhz next to the board it resets the processor. The processor resets when it’s attempting to communicate over the I2C bus. The watch dog timer times out waiting for the MSSP (Master Synchronous Serial Port) interrupt flag to be set. This happens most often when waiting for the interrupt flag after the master (PIC18F97J60) sends a restart or a NACK.

I’m using 2 kOhm pull up resistors and running the bus at ~96 kHz. On the oscilloscope it looks as though the interference on the bus is bad enough where it can pull the SCL and SDA lines down from 5V to 2.6 V. What can be done to protect the i2c bus signals from interference so the processor does not reset while waiting for an interrupt from the MSSP module?

\$\endgroup\$
  • \$\begingroup\$ I just measured the rise time of the clock signal and calculated the bus capacitance to be 486 pF is that going to be a problem? \$\endgroup\$ – mjh2007 Aug 6 '12 at 20:54
2
\$\begingroup\$

Apparently the radio interference is messing up the IIC bus communication such that the slave doesn't think it is being addressed and there is no ACK. As Steven pointed out, it is bad software design to have a missed ACK cause the processor to reset. This needs to be fixed, but your question is mostly about the interference issue. You got lucky that the interference aggrevated another lurking bug in your code. Fix that while it is easily reproduced.

2 kΩ pullups on the IIC lines is about as low as you can go, so nothing more can be done there. You don't say what frequency and power level this radio is that is next to the board. Some level of closeness and power output is going to cause a failure. Put another way, there are only so many volts per meter your board can take before it operates incorrectly. The first thing you need to ask yourself is if the level of radiation hitting the board is reasonable to protect against. One solution could be "well, don't do that". Put the transmitter accross the room, shield it properly, move the antenna, etc.

If you do need to make the board less sensitive to this RF (again, it would be useful to know the frequency and power level you're dealing with), then there are probably various things to fix. Most likely this problem is due to bad layout, particularly the ground, and inattention to high frequency loop currents. All the same things you do to reduce emissions work symmetrically to reduce the susceptibility to received radiation. Put another way, physics tells us that anything that works as a transmitting antenna works as a receiving antenna and the other way around.

So show the layout, particularly the grounding strategy, of your board. Also look carefully at anything going off board because these are antennas. Since you are using a 18F97J60 which has a ethernet MAC/PHY, you probably have a ethernet cable coming from the board. What RF reduction is on the network side of the transformer? Does the transformer have a built in balun on the network side? Does the problem go away when you unplug the ethernet cable?

\$\endgroup\$
  • \$\begingroup\$ Minor correction, 1.8kOhm pullups are common practice on the I2C bus (so 2kOhm is "about" as low as you can go, but there is a small amount lower you could go). I believe the recommended range is 1.8k - 4.7k with lower values giving faster rising edges on the bus... \$\endgroup\$ – vicatcu Jul 31 '12 at 17:36
  • \$\begingroup\$ @vicatcu - The 1.8 k\$\Omega\$ is near the lower limit because according to the standard a device doesn't have to draw more than 3 mA, and that's what you get with a 1.7 k\$\Omega;\$ pullup at 5 V. The upper limit depends on the wire's capacitance: a rising edge should not be longer than 1 \$\mu\$s. And let's be honest: isn't 2 k\$\Omega\$ exactly the same as 1.8 k\$\Omega\$? :-) \$\endgroup\$ – stevenvh Jul 31 '12 at 17:39
  • \$\begingroup\$ @vicatcu: That's why I said "about". I didn't want to get into all these details because I thought they would distract from the main point. For purposes of RF pickup 17% less impedance isn't going to make much difference. Again, I suspect the real problem is bad layout and grounding. \$\endgroup\$ – Olin Lathrop Jul 31 '12 at 20:11
  • \$\begingroup\$ I tried monitoring the 5VDC on board power supply with an oscilloscope and discovered that sometimes if I key the radio just right I can get the supply to jump as high as 6.25 VDC. Is that normal for RF interference? \$\endgroup\$ – mjh2007 Aug 6 '12 at 20:50
  • \$\begingroup\$ We still have a problem with the ethernet cable unpluged. I think the ethernet transformer is built into the pulse jack connector we are using J1006F01PNL. \$\endgroup\$ – mjh2007 Aug 6 '12 at 20:53
5
\$\begingroup\$

2 kΩ should be low enough not to get much noise on the signal.

But it looks like your problem lies somewhere else. It doesn't seem that the noise resets the controller. As long as the controller is functioning properly it should reset the watchdog timer so that it never times out to reset the controller. If the serial message isn't received properly your protocol should fix this. The reset is for emergencies, when the software goes bananas, or a power disturbance locks up the hardware. Letting the watchdog timeout because you're waiting for an ACK or a transmission restart is bad.

\$\endgroup\$
  • \$\begingroup\$ If I don't reset the processor it waits forever for the interrupt flag and locks up. If I used a separate timer to create a timeout I end up with a half completed i2c transaction and data is corrupted. \$\endgroup\$ – mjh2007 Jul 31 '12 at 13:56
  • 1
    \$\begingroup\$ If the I2C slave can't acknowledge it should discard that command. The master which doesn't see an acknowledge should retransmit the command. No corrupted data. \$\endgroup\$ – stevenvh Jul 31 '12 at 13:59
  • \$\begingroup\$ I2C slaves can hang the bus if clock pulses are missed. The recovery action may require bit banging the clock pin until the slave releases the bus. I2C may be a bad choice if the bus cannot be made sufficiently reliable. \$\endgroup\$ – 2.718 Jul 31 '12 at 23:56
  • \$\begingroup\$ I added a timeout and reset the watch dog timer while I'm waiting for the MSSP interrupt. Processor still resets sometimes when I key the radio. \$\endgroup\$ – mjh2007 Aug 6 '12 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.