Author Topic: STM32G0 freezes over time  (Read 74350 times)

0 Members and 5 Guests are viewing this topic.

Offline VekettiTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: fi
Re: STM32G0 freezes over time
« Reply #75 on: January 21, 2024, 07:29:36 am »
My mistake, the buzzer didn't crash it, it was consequence of issues with the debugging that I didn't notice the error in the code. Now I'll go to the shame corner... Sorry. Buzzer works fine as is. I scoped the buzzer and there were negligible effect on 3.3V nor the 5V net. However, noticed one funny thing. The buzzer control fet on output side had terrible ringing when fet turned off. I screwed up the screen capture, so no picture of it unfortunately. I googled about it and found information that it cannot be avoided or it is due to bad layout. Should I worry about it?

I found some reasonably priced current limited load switches. Would this be ok for the display side: TPS22942DCKR? It limits to 100mA and the 3.3V regulator is up to 150mA so my understanding is that it would be ok.

And for the ferrite bead, would below circuit be correct application? My understanding was to have it on output side on series and 100nf cap after. Should it be on the 3.3V net instead? I could always replace it with jumper, if it causes oscillation..
« Last Edit: January 21, 2024, 07:37:25 am by Veketti »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6936
  • Country: es
Re: STM32G0 freezes over time
« Reply #76 on: January 21, 2024, 07:44:38 am »
The converter looks fine to me.
Maybe another 10uF electrolytic after the coil to compensate for fast current surges.
And another 100nF before the coild to filter HF armonics coming from the output.


And couldn't you simply capture a new picture?
Was it an ultra-high-energy particle captured once every 30 years like the OMG Particle or the Amaratsu Particle?  :P

The buzzers are normally piezolectric or inductive, and can generate a bit of back-EMF when turned off.
Add a small 1N4148 diode in parallel with the buzzer:



You can skip D1 here:
« Last Edit: January 21, 2024, 07:57:37 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: Veketti

Offline VekettiTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: fi
Re: STM32G0 freezes over time
« Reply #77 on: January 21, 2024, 08:40:17 am »
And couldn't you simply capture a new picture?
Was it an ultra-high-energy particle captured once every 30 years like the OMG Particle or the Amaratsu Particle?  :P
Haha.  ::) I took zillion screenshots but you know, not doing it everyday and the not so intuitive Rigol interface, they were all .stp (setup files), not the screen captures. Didn't have enough motivation after that to do that all over again. That ringing however was suppressed effectively to 5V by that D1, or at least I think that's what helped. Makes sense if the ringing was the back emf..


The buzzers are normally piezolectric or inductive, and can generate a bit of back-EMF when turned off.
Add a small 1N4148 diode in parallel with the buzzer:



You can skip D1 here:


I recall some time ago Siwastaja mentioned in this post that the suppress diode/tvs should be close to the fet and not on the load so I've been following that and that's why I put that tvs across fet drain and source. Hope I got that right... Maybe in this case it doesn't matter as the wires between load and fet are short so both approaches are ok.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6936
  • Country: es
Re: STM32G0 freezes over time
« Reply #78 on: January 21, 2024, 08:48:01 am »
The backemf would be completely negligible, the inductance of a 3" trace is nH and the current of the buzzer small.

The problem here is not the placement, but the diode, a TVS acts similar of a zener, only clamping excessive voltage.
But below the clamping threshold, the backemf won't have a current path, so the energy has nowhere to go and cause the oscillation anyways.




You might add a small RC snubber to reduce this oscillation.


« Last Edit: January 21, 2024, 09:40:20 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: Veketti

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 11405
  • Country: fi
Re: STM32G0 freezes over time
« Reply #79 on: January 21, 2024, 11:29:35 am »
I recall some time ago Siwastaja mentioned in this post that the suppress diode/tvs should be close to the fet and not on the load so I've been following that and that's why I put that tvs across fet drain and source. Hope I got that right... Maybe in this case it doesn't matter as the wires between load and fet are short so both approaches are ok.

It's still in the wrong place, in the schematic. It needs to be in parallel with load, not parallel with the MOSFET; the post you refer to talks about layout; it should be close to the MOSFET. Placement and circuit are two different things. Paralleling a freewheeling diode with the MOSFET does not do much because the MOSFET already has built-in parasitic body diode. You want to provide a path for the current which still goes through the load after the MOSFET goes open-circuit, and the only place to offer this path is in parallel with the load.

If the load (in this case, piezo) is driven such that off-time is always significant, then any diode type is OK (forward recovery time matters; but it's good enough with nearly any diode type). On the other hand, if you drive the MOSFET back on quickly (e.g., because you do PWM), then you need to use a diode type with fast reverse recovery, or no reverse recovery at all, schottky is the usual choice then. A "normal" slow Si diode would be still conducting due to slow reverse recovery and cause significant short-circuit current through the diode+MOSFET series connection.

#1 for even slightly inductive loads is to add the freewheeling diode, and having it physically close to the MOSFET is right because it then also freewheels the parasitic inductance from the wiring going to the load. Always try this first, remove the problem where it's generated. After that, if you still have ringing, which is now caused by the parasitic inductance of your switching loop (loop formed by your closest DC bus capacitor, MOSFET and the freewheeling diode all in series) forming a "tank" circuit with Cds of the MOSFET (or C of the diode), then you can add RC snubber(s), across the MOSFET and across the diode.
« Last Edit: January 21, 2024, 11:34:15 am by Siwastaja »
 
The following users thanked this post: Veketti

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6936
  • Country: es
Re: STM32G0 freezes over time
« Reply #80 on: January 21, 2024, 11:34:04 am »
The effect will be similar (Clamping against VDD or to GND) but the oscillation would still happen with the TVS if there's no snubber.
The only real difference will be dumping the energy into VDD, making it a bit more efficient?
« Last Edit: January 21, 2024, 11:36:48 am by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: Veketti

Offline VekettiTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: fi
Re: STM32G0 freezes over time
« Reply #81 on: January 21, 2024, 12:36:12 pm »
Now my head is spinning. Bear with me, please. So did I understood correctly that this is what you meant Siwastaja?


If so then it is physically close to the load, not the transistor. Let's say there is two meters wires between the load and transistor. For dummies, please. What does this mean:
Quote
Also layout is important. The diode needs to be physically closest to the transistor, not next to the relay coil. Don't forget a capacitor between supply and GND, physically close to the transistor and diode. In other words, minimize the loop inductance (length) going from capacitor +, through the diode, through the MOSFET, back to capacitor -.
How can it at the same time be physically close to transistor and parallel with load? Sketch or someting?
« Last Edit: January 21, 2024, 12:47:36 pm by Veketti »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6936
  • Country: es
Re: STM32G0 freezes over time
« Reply #82 on: January 21, 2024, 01:46:25 pm »
Regarding the LDO decoupling, I just remembered this thread and updated it.
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 
The following users thanked this post: Veketti

Offline VekettiTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: fi
Re: STM32G0 freezes over time
« Reply #83 on: January 21, 2024, 02:05:04 pm »
I soldered the 1n4148 to the buzzer legs and results below. Sorry, not enough hands to get both channels at once, but it shouldn't matter. I still have the D1, should I unsolder it, whether it messes this up?
« Last Edit: January 21, 2024, 02:25:01 pm by Veketti »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6936
  • Country: es
Re: STM32G0 freezes over time
« Reply #84 on: January 21, 2024, 02:08:51 pm »
Don't you have probe clips?
You can solder small wires to the testing points, sometimes is safer than acrobatic probing, risking the probe slipping and causing all kind of mess, like shorting 12Vin -> 3Vout in a regulator!

Why is the buzzer turning off when the gate is high? Your schematic shows a N-fet but this behaviour is for P-fet.
Or you just captured the wrong edge of the gate signal :)?

« Last Edit: January 21, 2024, 02:14:50 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline VekettiTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: fi
Re: STM32G0 freezes over time
« Reply #85 on: January 21, 2024, 02:25:53 pm »
 :palm: I got the wrong edge, I forgot to change it. Updated the image on previous post. Those very small glitches which are barely visible on gate seem to be 371us apart and ~470mv high..

« Last Edit: January 21, 2024, 02:38:10 pm by Veketti »
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6936
  • Country: es
Re: STM32G0 freezes over time
« Reply #86 on: January 21, 2024, 02:36:27 pm »
Are you using the probe in 10X mode? Otherwise it'll add a lot of capacitance to the circuit and cause strange effects/issues.

Looks like if nothing was connected at all, show the updated schematic?

The PESD5V0 is rated for 5V, not 5.5 or 6V, but exactly 5V, and you're feeding 5V to it, so you're at the very limit.
You only want to protect the Fet from excessive voltages, if the fet tolerates 20V, clamping to 6-10V would be ok, but not so extremely close to VDD.

That TVS would be ok for example for a MCU input.

And yeah try removing D1.
« Last Edit: January 21, 2024, 02:48:25 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline VekettiTopic starter

  • Frequent Contributor
  • **
  • Posts: 275
  • Country: fi
Re: STM32G0 freezes over time
« Reply #87 on: January 21, 2024, 02:45:52 pm »
Here's the updated schematic.

Update. Added also zoom image of the gate glitches..

Update2. Added also picture of the drain, when D1 removed. So only 4148 present. Yes, I'm using 10x mode.

Update3. To rule out the 4148 was faulty, I replaced it with über-fast BYV27 diode and still the same ringing...
« Last Edit: January 21, 2024, 03:57:14 pm by Veketti »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->