skullhornet
Posts: 9
Joined: Mon Jun 14, 2021 6:06 am

Pico Resets When I Switch On My Desk Lamp

Mon Jun 14, 2021 7:25 am

My application is a simple protocol translator which reads 12 GPIOs and serializes them over a UART.

During development I noticed that my Pico would occasionally reset.

I am using the: pico_bootsel_via_double_reset mechanism.

The code is written in C using the latest SDK: 1.2.0

For convenience I have made a simple wire extension (30cm) from the RUN and GND pins to a momentary switch. I call this the reset assembly.

I wrote a simple debug application where I could detect an involuntary reset.

. Flash LED 5 times
. Turn off LED
. Wait for a switch input
. Turn on LED

I.e. when the Pico resets itself the LED would end up in the off state.

After some investigations I discovered the the Pico would never reset itself if I did not connect my reset assembly.

On my desk I have a halogen lamp with a transformer in the base. The lamp is roughly 30 cm away from the Pico.

To my surprise I noticed that the Pico would reset if I turned on the lamp but only when the reset assembly was in place.

Here is a GIF showing the issue, .

https://imgur.com/a/4CQCDFu

Can anyone explain why this is happening ?

dairequinlan
Posts: 30
Joined: Tue Feb 23, 2021 3:18 pm

Re: Pico Resets When I Switch On My Desk Lamp

Mon Jun 14, 2021 9:37 am

I'm no electrical engineer, so I can't explain what is happening other than some uninformed waffling about induced current or something, but the one thing I _would_ do would be to move that lamp away from any sensitive electronics :shock:

hippy
Posts: 10208
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pico Resets When I Switch On My Desk Lamp

Mon Jun 14, 2021 9:39 am

Sounds like an EMI issue. Turn the lamp on and it generates EMI, the reset assembly acts as an aerial, the Pico picks that up, sees it as a reset, or BOOTSEL reset when it picks up two items of noise.

I believe the reset pin is pulled-up internally in the chip. You could add an external pull-up close to the Pico, an inline resistor may also help, and a capacitor, and other 'prevent an input acting as an antenna' techniques should apply.

lars_the_bear
Posts: 225
Joined: Thu Jan 28, 2021 8:13 pm
Contact: Website

Re: Pico Resets When I Switch On My Desk Lamp

Mon Jun 14, 2021 10:05 am

If the input is pulled up, I wouldn't expect a _healthy_ piece of electrical equipment to generate enough interference to overcome the pull-up, with a 60cm wire. Perhaps the pull-up could be made stronger, or filtering added, as @hippy says, but it sounds like a faulty appliance to me.

Incidentally, I have a 12V LED lamp that causes my desk radio to shut down whenever I switch it on. I just assumed it's faulty, or badly designed.

Kevin.

drgeoff
Posts: 12055
Joined: Wed Jan 25, 2012 6:39 pm

Re: Pico Resets When I Switch On My Desk Lamp

Mon Jun 14, 2021 11:10 am

If you know that this is basically the same physics that Marconi was using to send the first radio messages across the Atlantic, it is not so surprising.
Quis custodiet ipsos custodes?

hippy
Posts: 10208
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Pico Resets When I Switch On My Desk Lamp

Mon Jun 14, 2021 11:34 am

Have the electrical characteristics of the reset pin been published ? I couldn't find that in the RP2040 datasheet.

I did find this - "If RUN is not used, it should be tied high".

It isn't on a Pico and there is no pull-up that I could see. However the hardware design guide states "The RUN pin on Raspberry Pi Pico is the reset_n (active low) for RP2040. It is pulled high (i.e. the RP2040 is running) on Raspberry Pi Pico".

So an internal pull-up perhaps but why should it then be tied high if not used ? That "used" is rather ambiguous, and "should" isn't the same as "must".

I would interpret that as meaning; if it's not driven by a hard high-low signal then a pull-up is required.

skullhornet
Posts: 9
Joined: Mon Jun 14, 2021 6:06 am

Re: Pico Resets When I Switch On My Desk Lamp

Mon Jun 14, 2021 12:30 pm

I agree that in some strange manner the wires are acting as an antenna and resetting the Pico.

As pointed out the documentation states that RUN has an internal pull up of 50K.

It does not have to be a lamp, I can plug in a USB adapter and get the same effect :)

edit:
I expect a shorter reset assembly will do the trick

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 14041
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Pico Resets When I Switch On My Desk Lamp

Mon Jun 14, 2021 12:38 pm

skullhornet wrote:
Mon Jun 14, 2021 12:30 pm
I agree that in some strange manner the wires are acting as an antenna and resetting the Pico.

As pointed out the documentation states that RUN has an internal pull up of 50K.

It does not have to be a lamp, I can plug in a USB adapter and get the same effect :)
Definitely an EMI issue, your lamp acts like a powerful sparkgap transmitter.
50K is weak!
any piece of wire can act as an antenna
I would add an extra 2K2 pullup.

skullhornet
Posts: 9
Joined: Mon Jun 14, 2021 6:06 am

Re: Pico Resets When I Switch On My Desk Lamp

Mon Jun 14, 2021 12:52 pm

mahjongg wrote:
Mon Jun 14, 2021 12:38 pm
Definitely an EMI issue, your lamp acts like a powerful sparkgap transmitter.
50K is weak!
any piece of wire can act as an antenna
I would add an extra 2K2 pullup.
Thank you for the suggestion, I will try that later.

skullhornet
Posts: 9
Joined: Mon Jun 14, 2021 6:06 am

Re: Pico Resets When I Switch On My Desk Lamp

Fri Jun 18, 2021 6:57 am

I added a 2K2 pullup resistor but the Pico still resets when I switch on the lamp.

Should I try 1K ?

cleverca22
Posts: 3912
Joined: Sat Aug 18, 2012 2:33 pm

Re: Pico Resets When I Switch On My Desk Lamp

Fri Jun 18, 2021 7:20 am

skullhornet wrote:
Fri Jun 18, 2021 6:57 am
I added a 2K2 pullup resistor but the Pico still resets when I switch on the lamp.

Should I try 1K ?
the only danger of using a lower resistance, is how much power the switch will be pulling when you push the reset button

checking ohms law, I=V/R, I=3.3/1000, I=3.3mA, a trivial amount of current, so that should still be safe

skullhornet
Posts: 9
Joined: Mon Jun 14, 2021 6:06 am

Re: Pico Resets When I Switch On My Desk Lamp

Fri Jun 18, 2021 7:30 am

cleverca22 wrote:
Fri Jun 18, 2021 7:20 am
the only danger of using a lower resistance, is how much power the switch will be pulling when you push the reset button

checking ohms law, I=V/R, I=3.3/1000, I=3.3mA, a trivial amount of current, so that should still be safe
Thank you for verifying that 1K is OK. I just tested it and it still resets :shock:

cleverca22
Posts: 3912
Joined: Sat Aug 18, 2012 2:33 pm

Re: Pico Resets When I Switch On My Desk Lamp

Fri Jun 18, 2021 7:41 am

how is the pull-up resistor wired into it?
do you have access to a scope?

skullhornet
Posts: 9
Joined: Mon Jun 14, 2021 6:06 am

Re: Pico Resets When I Switch On My Desk Lamp

Fri Jun 18, 2021 7:57 am

cleverca22 wrote:
Fri Jun 18, 2021 7:41 am
how is the pull-up resistor wired into it?
do you have access to a scope?
It is connected like this.
20210618_094625_resize.jpg
20210618_094625_resize.jpg (140.55 KiB) Viewed 511 times


No access to a scope just now, but I have a Salea Logic Pro with analogue support...

cleverca22
Posts: 3912
Joined: Sat Aug 18, 2012 2:33 pm

Re: Pico Resets When I Switch On My Desk Lamp

Fri Jun 18, 2021 10:48 am

that wiring looks good

maybe try hooking the analog port of the logic probe up to the RUN pin, and see what it does when you flip the light?
try setting it to trigger on the falling edge, and you can use the switch to test triggering it

skullhornet
Posts: 9
Joined: Mon Jun 14, 2021 6:06 am

Re: Pico Resets When I Switch On My Desk Lamp

Fri Jun 18, 2021 11:59 am

I connected the Salea to the RUN pin, enabled analogue recording and when I flip the switch the Salea loses connection over USB :o

cleverca22
Posts: 3912
Joined: Sat Aug 18, 2012 2:33 pm

Re: Pico Resets When I Switch On My Desk Lamp

Fri Jun 18, 2021 12:22 pm

welcome to EMI, where anything and everything can be reset!

back when i was a kid, i used to reset those 200-in-1 game consoles, by just getting a static shock off something else while holding the console

W4GNS
Posts: 2
Joined: Thu Feb 06, 2014 4:39 pm

Re: Pico Resets When I Switch On My Desk Lamp

Fri Jun 18, 2021 4:40 pm

I would separate the wire to the switch and twist them, that will offer some help

skullhornet
Posts: 9
Joined: Mon Jun 14, 2021 6:06 am

Re: Pico Resets When I Switch On My Desk Lamp

Sat Jun 19, 2021 1:02 pm

W4GNS wrote:
Fri Jun 18, 2021 4:40 pm
I would separate the wire to the switch and twist them, that will offer some help
I tried that but it had no effect. I will just use a switch closer to the Pico.

penitko
Posts: 11
Joined: Thu Jun 10, 2021 9:25 am

Re: Pico Resets When I Switch On My Desk Lamp

Sat Jun 19, 2021 4:08 pm

You could try Metal Oxide Varistor to reduce the voltage spikes :

https://www.youtube.com/watch?v=LTSf_tsN7QA

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 14041
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Pico Resets When I Switch On My Desk Lamp

Thu Jun 24, 2021 1:01 pm

Add a 100nF capacitor between GND and the GPIO pin, use short wiring

skullhornet
Posts: 9
Joined: Mon Jun 14, 2021 6:06 am

Re: Pico Resets When I Switch On My Desk Lamp

Thu Jun 24, 2021 9:37 pm

mahjongg wrote:
Thu Jun 24, 2021 1:01 pm
Add a 100nF capacitor between GND and the GPIO pin, use short wiring
Thank you for the suggestion :D

Return to “General”