atmega1284P unexpected reset

Go To Last Post
48 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The atmega is reseting when mosfets are turned on.
The mosfet are controlling power through a 100W resistive bulb.
Sometimes turning nearby bulb also resets the atmega.

The reset pin is pulled up through a 10k resistor, otherwise the atmega works quite fine without loading anything.

Assistance will be highly appreciated.

This topic has a solution.

Crazy generation

Last Edited: Sun. Jun 4, 2017 - 02:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Check the supply voltage during the time the lamp is turning on. Incandescent lamps have a significantly lower resistance when cold and take a lot more current than when running. Your power supply may be momentarily current limiting.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

look at the MCU Status Register and identify which reset occurred.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

3A power supply is used to give 12v. Lm2596 checks it down to 4. 4.
450uF and 100nF are in parallel at the output.
If it's momentarily can the caps supply the need power?

What's the solution to this momentarily limited current?

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Derick22 wrote:
The mosfet are controlling power through a 100W resistive bulb.
Jim mentioned the in-rush current.

MOSFETs are somewhat tolerant of that though aren't tolerant of sustained overcurrent (load shorts)

One of several solutions to those problems is a protected load switch :

Fairchild Semiconductor

Advanced Load Switches

https://www.fairchildsemi.com/products/power-management/advanced-load-switches/

...

The AccuPower™ family provides full protection to systems and loads from in-rush current conditions.

...

Limiting in-rush current will increase the lifetime of the bulb.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've worked on commercial controllers for motor cycle headlamps. In that unit, the lamp is PWM controlled, and is carefully ramped up on turn on and down on turn off. Makes a big difference in the lifetime of the lamp. Not sure what the power is, maybe 40W?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
Not sure what the power is, maybe 40W?
That's the approximate power for one very bright motorcycle LED headlight (high beam, 46W, 3800 lumen)

https://www.superbrightleds.com/moreinfo/motorcycle-led-bulbs/7-round-h6024-sealed-beam-motorcycle-headlight-dot-approved-led-headlight-conversion/3149/#/tab/Specifications

LED lights might not be applicable for a show original bike though vehicle operators are keen on being seen especially motorcycle operators.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have have used watchdog in the program and its working fine(ISR is provided). The reset is pulled up.
I have a feeling it's a brownout detection issue.

I don't know how to monitor the cause of reset in the status register.

Someone tell me how to deactivate the brown out detection.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you're activating the brownout detection, then that is telling you something. I'd suggest you look at circuit layout. Understand where the current is flowing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

https://electronics.stackexchange.com/questions/84679/what-could-cause-unexplained-brownout-resets/84895#84895

I want to try this, but values for RC.
High dV/dt can cause symptoms similar to BOD which can be so challenging.

I'm using bidirection mosfets to switch AC and l hope placing RC on each mosfet will solve the high dv/dt problem.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Post your schematic. An accurate pencil drawing for the schematic is fine. Take a photo of the actual wiring. This is important because the layout will influence any current loops or glitches.
.
Like Kartman, I would get the electrics correct first. Then you can investigate some software tricks.
.
David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Schematic...

Attachment(s): 

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The gates receive voltage from the 12v zener diode.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How is the AVR related to that circuit?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Switching on the mosfets/100w bulb through optoisolator resets the AVR, otherwise the avr is running okay (when mosfets are off)

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What optoisolator? Please, don't make us guess, realise you have a difficult problem, so you need to give us all the information.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Optoisolator recieves PWM from the avr.

Attachment(s): 

Crazy generation

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Snubber components C4, C3, R2 and R5 have not helped.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The snubber components will help the mosfets. The problem is most lkely stray inductance and switching too fast. This means energy will couple easily to nearby wiring. Some series inductance, say 100uH might help.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do I place this 100uH in series with the fuse, I mean on the live of mosfets or supply of Avr?

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sure this is still hard problem. 100uH didn't help.
I place the inductor in series with the fuse.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Show us a picture of the physical layout.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Snubbers primarily help with transients that appear when a switch opens and interrupts current through an inductor. Inductor, in this case, means solenoid, transformer, or motor. The transients cause switch arcs and high voltage failures in semiconductor switches. There ARE cases where such transients can couple into near-by windings and cause other circuit problems, but they are relatively few in comparison to high voltage switch damage problems. When there is a transient-driven circuit incorrect operation, it always happens when the switch OPENS.

 

In the case of incandescent lamps, when the circuit failure occurs, it is often due to high inrush current when the switch CLOSES. Here, you have to look at shared wiring, where the high inrush current travels through a part of the circuit shared with the microcontroller, or sensors, or other peripheral circuits.

 

Given the lack of impact of snubber components, I am betting that the problem occurs when the light bulb turns on.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Derick22, sincerely I would not use two MosFETs for the job, just one would do.  Just use a diode bridge and the MosFET connected between the + and - bridge output.  I don't trust so much the MosFET intrinsic diodes, they are not produced on purpose, they are just the result of the production, so, not really on spec sheet.  That snubber also needs a review, a single resistor and capacitor would do, no need to have it doubled.   For the sake of tests, use 3 x AA fresh batteries (4.5Vdc) to feed the AVR and see if eliminating the 12V 3A >> 4.4Vdc power supply will also eliminate the problem.  You may have a long ground or neutral loop noise.

Wagner Lipnharski
Orlando Florida USA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Image

Attachment(s): 

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I will try powering the avr with battery.

I have watchdog working quite well.
Reset pin is pulled up with a 10k
There is no JTAG communication.
The avr is alread powered on.

On option could be BOD that causes resetting.
someone advice me how to deal with this?

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Derick22 wrote:
I don't know how to monitor the cause of reset in the status register. Someone tell me how to deactivate the brown out detection.
1284P has this:

#define MCUSR _SFR_IO8(0x34)
#define PORF 0
#define EXTRF 1
#define BORF 2
#define WDRF 3
#define JTRF 4

The idea here is that very early on during the start up of the micro you read MCUSR and store it somewhere safe (then write 0 to it so the bits are wiped for next time). Later on you can study the bits that were found to be set when the micro started. If BORF is set hten it means the micro reset because of the Brownout Detector.

 

The one thing you don't want to do is switch BOD off. It's true that AVRs are delivered with it deactivated but that's just because Atmel don't know what Vcc level you plan to run at. But once that is decided you should always enable BOD at the next step below your planned Vcc. If the power supply can't cope and the Vcc gets dragged down into "dangerous territory" then BOD should activate to hold the AVR in reset (so it cannot do damage!) until Vcc returns to a "safe" level above the threshold.

 

As I say you can check whether it was the reason for reset by later studying the MCUSR contents.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have not touched BOD and I have not been programming it so certainly BOD is inactive.

It appears to be a power reset issue.
Must we have the 100nF and diode on the reset pin?

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Who should trust these manufactures anyway;

I only changed the mosfets to another type and the problem has not recoccured so far. I hope its gone for good.
Thank you for sharing especially on BOD.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You didn't identify the root cause so all can do is hope.
I can see plenty of antennas in your circuit, so i'm not surprised you had problems.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What are these antenas, help with solutions/recomendation to better the circuit.

I also discovered one of the misfets heats more IE becomes hotter than the other. The one on the lower side of the circuit.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Atemga1284p how to use the timer, and how to use the PWM? It is best to have an intuitive interpretation of the timer initialization and initial value settings.The compilation environment used is Atmel Studio 7.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The antennas are your bits of wire. Do some research on Faraday's law and see how that might apply in your situation.
As for your misfits, getting hot suggests you're not turning it on or off properly. You'll have to do some measurements.

Last Edited: Tue. Jun 6, 2017 - 09:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I need to synch the power in the heaters with an AC fan.

So I'm controlling AC power not DC.
The bridge rectifier can control AC too but there is a subbtle problem at full load / 100%PWM.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think we understand what you're wanting to do. At 100% conduction there is no opportunity to harvest your control voltage, thus it won't work! You need to limit your maximum pwm so there is enough off time to harvest some energy.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Derick22 wrote:
I also discovered one of the misfets heats more IE becomes hotter than the other. The one on the lower side of the circuit.
A gate drive optoisolator would have greater bi-directional drive current than a phototransistor.

In lieu of isolation by light, isolation can occur by magnetic or electrical field.

Silicon Labs

Silicon Labs

Si875x Isolated FET Drivers​​

http://www.silabs.com/products/isolation/si875x-isolated-fet-drivers

...

Unlike traditional SSRs, which integrate optocoupler-style LED inputs and limit the operating temperature range of the solution, the Si875x can support full industrial and automotive temperature ranges with increased stability and longer life-time.

...

 

Features

  • ...
  • 10.3 V gate drive output with <100 µs turn-on time
  • ...
  • DC or AC load switching support
  • ...
  • 2.5 kVrms isolation rating
  • UL, CSA, VDE, and CQC certifications (pending)
  • Industrial -40 to +105°C or Automotive -40 to 125 °C temperature ranges
  • ROHS-compliant SOIC-8 Package

http://www.mouser.com/new/Silicon-Laboratories/silabs-si875x-fet-drivers/

http://www.microchip.com/design-centers/analog/power-management/power-mosfet-drivers/overview

 

Edit : Microchip

 

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Tue. Jun 6, 2017 - 12:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I need this 100%pwm, l don't like taking chances where manageable. That's why I'm using two mosfets.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I appreciated your contribution. I'm interested in controlling AC not DC.
I'm not a pro in snubber design,
What is your thought in only using one pair of the RC snubber -where should I place them on the cct?
It will be cost effective also.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As for your misfits, getting hot

LOL love those auto filling helpers......devil

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One or two mosfets make no difference to 100% pwm. Look at your circuit- if the mosfets are both fully on, then you won't get much voltage drop to run your gate drive.
Note - commercial light dimmers use igbts. Better voltage rating and cheaper. These don't run 100% for the reason i mentioned.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unfortunately the problem re occured again.
This a tough problem to me.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

See #30. I would suggest you have a number of problems. You need to address each of them.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

After careful analysis l discovered a hanging 10k ohm resistor on the reset pin. I forgot to solder the it to the Vcc. Without taking any chance I added 100nF between the reset pin and the GND.
everything is now stable.
Thank you everyone.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another problem came up.
How do we connect a free wheeling diode on AC controlled devices as in my schematic for bidirectional mosfets. I tried to add AC motor parallel to the lamp and this took me back to the resetting problem. Aim is to synch heater and fun.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need a bidirectional clamp to limit the voltage when you interrupt the current to the inductor. Something like a bidirectional transzorb. Note power dissipation might be a problem, so you might need to add some R & C.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for your consistent help.
I will try it out. So far l have tried MOV but did not kill the problem.
I also noted the that AVR runs okay when the motor is powered some distance away from the AVR.

I already have RCs on the two mosfets but the ringing sound is still conspicuous. Should they be removed and connect only a pair on the R-L load or just leave them and add some on the inductive load.

Crazy generation

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As i've said before, you've most likely have a number of problems.
Let's look at your lcd. These are very sensitive to EMC and ESD. You also connect to it with long wires - these are antennas ready to pick up interference. Now, if your code polls the lcd for ready and the lcd gets upset by esd or emc, it will most likely lock up. If you have a watchdog in your code, this will most likely reset your AVR.

Your pushbutton switches don't seem to have any filtering. The long wires will also act as antennas.

It could be that you switch the mosfets too fast. This will create EMC that gets picked up by your antennas and possibly coupled back via your power supply. Due to your circuit construction and layout, the mosfets may also be oscillating. This is going to create problems.
You need to use an oscilloscope to see what is really happening, but this also presents a problem as your circuit is connected to mains. This means you need a differential probe as many of the cheap digital scopes process the differential calcs in software which makes it painfully slow.
I've only touched the surface of what potential problems you could be facing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay sir.

Crazy generation