CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

18F4550 USB RE3 sensitive
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
vtrx



Joined: 11 Oct 2017
Posts: 142

View user's profile Send private message

18F4550 USB RE3 sensitive
PostPosted: Fri Nov 20, 2020 3:55 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Nov 20, 2020 8:41 pm     Reply with quote

Try a 47K pull-down resistor, without the cap. See if that solves the problem.
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 1:23 am     Reply with quote

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... Sad

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: 9228
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 6:10 am     Reply with quote

what is the input signal ?? As others have said, that pin needs extra attention ( proper design).

Jay
vtrx



Joined: 11 Oct 2017
Posts: 142

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 10:48 am     Reply with quote

All input pins are used.
All are using 4K7 pull up resistors.
The pins are attached to buttons.
temtronic



Joined: 01 Jul 2010
Posts: 9228
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 11:18 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 11:49 am     Reply with quote

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: 19515

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 11:58 am     Reply with quote

A 'screwdriver on a pin', is a different thing from a short wire to a button...
vtrx



Joined: 11 Oct 2017
Posts: 142

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 12:41 pm     Reply with quote

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: 19515

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 1:13 pm     Reply with quote

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: 9228
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 1:19 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 5:28 pm     Reply with quote

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: 9228
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Nov 21, 2020 6:19 pm     Reply with quote

Maybe try another PIC, as you could have damaged that one due to EMI.
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Sun Nov 22, 2020 2:28 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Nov 26, 2020 1:31 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group