PIC I2C Master Crash

Thread Starter

Robin Mitchell

Joined Oct 25, 2009
819
Guys,

I really think the problem is the MMSP Module. My old I2C code did not work too well which is why I switched to the MSSP. This is a hardware driven I2C so my code still runs in the background when it sends data. But when I tried to make my own I2C code it never crashed, it actually worked some times :D

Im convinced that the problem is identical to the connecting of SDA and SCL temporarily scenario where the processor hangs in the same way. Maybe the PIC has some unusual circuitry which might possible affect the power lines or some other voodoo magic.
 

Thread Starter

Robin Mitchell

Joined Oct 25, 2009
819
Dont forget im relying on a circuit which I dont know the inner workings of. At least when I made my own I2C instructions I knew what everything was made of and doing. This MMSP is quite the black box to me. (Well past the block layout level)
 

ErnieM

Joined Apr 24, 2011
8,377
Dont forget im relying on a circuit which I dont know the inner workings of. At least when I made my own I2C instructions I knew what everything was made of and doing. This MMSP is quite the black box to me. (Well past the block layout level)
The MSSP is a very stable black box that engineers rely on to make real world product work in the real world. I wouldn't worry what is inside the box, I would concentrate on using that box, keeping track of the registers that control it.

Do you run a debugger? I would expect you would find some bit set you were not expecting that keep you in this "crash" mode.

That or you are entering a power brownout mode when you (un)plug in the clip.
 

THE_RB

Joined Feb 11, 2008
5,438
...
Im convinced that the problem is identical to the connecting of SDA and SCL temporarily scenario where the processor hangs in the same way. Maybe the PIC has some unusual circuitry which might possible affect the power lines or some other voodoo magic.
It could very well be "some voodoo magic". If the plug in connecting makes a noise spike etc it can hang the micro as (if I understood you correctly) you have the plug connections directly attached to the PIC pins.

It could also be a Vdd drop caused by the plug connection, especially if the plug-in clip has a large Vdd bypass cap. A Vdd drop from the plug-n-play can cause micros to hang.

You can start to see the benefit of going to something like a 1-wire USART serial that can be RC filtered between the two devices to remove spikes, add debouncing etc and have a lot more impedance between the two devices so spike or static energy is very low upon plug or unplug.

This design issue is not just about "which software protocol", it's about overall reliability when people run around building up static, ripping ammo clips from cloth pockets etc and shoving them into the laser tag gun in a panic. Have you considered the hardware protection side between the two devices?
 

Thread Starter

Robin Mitchell

Joined Oct 25, 2009
819
Hardware protection has already been considered and taken care of so there is no worry about ESD. I think there could be a spike but I have checked it with an oscilloscope and so far nothing!
 
Top