View previous topic :: View next topic |
Author |
Message |
vtrx
Joined: 11 Oct 2017 Posts: 142
|
18F4550 USB RE3 sensitive |
Posted: Fri Nov 20, 2020 3:55 pm |
|
|
My circuit uses USB HID and is working perfectly, but the RE3 pin is sensitive to noise.
RE3 is an input, but if you put a screwdriver on that pin, the circuit restart.
Only this pin has this behavior.
Code: | #fuses XTPLL,NOWDT,PROTECT,NOLVP,NODEBUG,USBDIV,PLL1,CPUDIV1,VREGEN,NOMCLR,CPB,CPD,NOBROWNOUT //4MHZ,USB-48MHZ,CPU-48MHZ (NOMCLR=RE3 como entrada) |
Is there anything that can improve the fuse option?
I'm thinking of using a 22n capacitor between the pin and the ground, it improved a little.
VREG uses a 470n capacitor and at the 5V input I use a 47µx16 and 22N capacitor in parallel.
Changing the values to 47µ or 22n didn't change anything. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Nov 20, 2020 8:41 pm |
|
|
Try a 47K pull-down resistor, without the cap. See if that solves the problem. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sat Nov 21, 2020 1:23 am |
|
|
Seriously, this is all down to what the pin is actually doing. Understand that
the 'internal' protection on the pins, is a 'last resort' thing, and does not
guarantee that the chip will keep working if activated. You will find notes in
the MicroChip sheets telling you that you must clamp signals to within the
allowed limits before they get to the chip.
Have a look at this note, which discusses this:
<https://www.digikey.com/en/articles/protecting-inputs-in-digital-electronics>
Generally this is why pins should never be left as inputs unless they are
actually used as inputs, and if they are so used, you need to ensure that what
is connected to them ensures the signal is kept inside the chip limits.
Understand, that the internal diodes on an input pin, will act like the diode
in an old crystal; radio receiver. Creating significant voltages inside the
chip...
The difference between the signal shown in figure 4, and figure 8, in the
above note, shows the typical effect of proper protection. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sat Nov 21, 2020 6:10 am |
|
|
what is the input signal ?? As others have said, that pin needs extra attention ( proper design).
Jay |
|
|
vtrx
Joined: 11 Oct 2017 Posts: 142
|
|
Posted: Sat Nov 21, 2020 10:48 am |
|
|
All input pins are used.
All are using 4K7 pull up resistors.
The pins are attached to buttons. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sat Nov 21, 2020 11:18 am |
|
|
All 'button' input pins should ( need) to have at least a .1mfd cap across them, though I think mine are 1mfd or .68mfd ( got a 5000pc reel of them 10-14 years ago....)
'Buttons' are very 'noisy', aka 'contact bounce', the R-C filters or smooths the button press to a single 1-0-1 transition.
As well as using hardware filtering, you can 'filter' using software. Some use timers, some loops...some PIC pins can be set to only see a certain change.
jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Nov 21, 2020 11:49 am |
|
|
vtrx wrote: | All input pins are used.
All are using 4K7 pull up resistors.
The pins are attached to buttons. |
My suggestion was based on RE3 being a floating input pin.
I didn't know you were trying to use it as a input pin for a switch. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sat Nov 21, 2020 11:58 am |
|
|
A 'screwdriver on a pin', is a different thing from a short wire to a button... |
|
|
vtrx
Joined: 11 Oct 2017 Posts: 142
|
|
Posted: Sat Nov 21, 2020 12:41 pm |
|
|
Ttelmah wrote: | A 'screwdriver on a pin', is a different thing from a short wire to a button... |
The buttons are connected to the wires by screws, that's how i discovered this behavior on the RE3 pin. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sat Nov 21, 2020 1:13 pm |
|
|
Problem is that a screwdriver is a 150mm or more length of wire acting like
an aerial, which is going close to a human body which also acts as an aerial.
If you use a meter that shows RF signal strength, and touch a screwdriver
held in the hand to this, the signal will shoot up.... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sat Nov 21, 2020 1:19 pm |
|
|
Now a 'clever' person would 'harvest' that RF energy and use it to power the PIC !! I did that 6 decades ago, prepreprePIC......used local radio station to charge up a cap, then ran a 6 xtr radio from that... |
|
|
vtrx
Joined: 11 Oct 2017 Posts: 142
|
|
Posted: Sat Nov 21, 2020 5:28 pm |
|
|
Bad news.
A 220n capacitor connected between the ground and the pin, decreased the sensitivity to noise but when pressing the button, connected to the ground and the pin (RE3), the circuit resets. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9243 Location: Greensville,Ontario
|
|
Posted: Sat Nov 21, 2020 6:19 pm |
|
|
Maybe try another PIC, as you could have damaged that one due to EMI. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19539
|
|
Posted: Sun Nov 22, 2020 2:28 am |
|
|
Seriously, think about what you are doing.
220nF. Probably something like a polyester or ceramic type. Charged up to
the 5v rail by the resistor. You then short this out, through the button and
the earth attached to this. Current at this moment enormous (will probably
kill the button after only a short number of uses). Depending on where the
earth to the button actually runs, you are almost certainly 'spiking' the
PIC into a reset.
Though a small capacitor like 10nF can be used like this, 220nF is much
too large. Honestly there needs to be a resistor to limit the current that
can flow if you use a capacitor this large.... |
|
|
vtrx
Joined: 11 Oct 2017 Posts: 142
|
|
Posted: Thu Nov 26, 2020 1:31 pm |
|
|
I solved the problem using a diode 1N4148 connected to pin RE3.
Anode connected to pin RE3 and the cathode connected to the wire that is connected to the button.
There was no more restart when generating 'noise' from the cathode onwards.
My concern was that when using a slightly long wire or external noise, restart the microcontroller. |
|
|
|