line noise and unwanted flash corruption (SPI)

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

Hi all again.

My question now is about the uP getting in programming mode (via SPI) due to line noise, like "playing" with the power connector.

Last time, I was using an atmega8 and had some problems with that same power connector. After "playing" for a while, atmega8's flash got corrupted. It would do anything but follow the original program. The programming cable was totally disconnected, so that wasn't the problem.

The reset circuit is, as told by atmel, a Cap and a resistor... but that doesn't help. In fact I believe it makes it worse, since the reset pin is held low until the capacitor charges (which is quite fast usually, but it wasn't thought with power noise in mind I believe).

I have a 7805 with all the capacitor related stuff, but that didn't seem to help.

I don't know if I can reproduce the situation, I haven't tried. After reprogramming the atmega8, everything worked fine, but I can't deploy a unit like that.

I thought adding pullup or pulldown resistors to sck or mosi could help.. would it?

The last choice is disabling SPI programming, but parallel programming isn't as handy as SPI... just consider SMD chips!

Well thanks to everyone again for listening,

Carlos

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

Activate brown-out-detection.

/Martin.

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

Take care with the crystal circuit

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

well, thanks a lot!

What do you mean by "take care with the crystal circuit"?. I use a crystal with caps.

So, brown out would work? I didn't know that, I thought it wouldn't apply to SPI programming.

Thanks a lot, I'll try it!

Carlos

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

Hello,

It might not be the ISP lines, but internal AVR instructions. When the AVR is in a brown-out it can execute random instructions in memory - which can include chunks of flash write. Enabling the brown-out will go a long way...

Also putting pull ups on the SPI pins will keep them out of trouble if you do think noise could be getting in on them. But it would take a pretty huge (not impossible) stroke of luck to get the SPI programming instructions.

-Colin

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

I see. That makes sense. I'll try it.

I also thought a slow-rising power regulator could help, but can't think of one.
I would need one that waits like, I don't know, 1 second for power to estabilize and then (and not before) give power to the board... do these exist?

Thanks!

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

Sorry!
Line should not be too long, and do not share a crystal with other mcu.
And the shell(I don't konwn what to call it, sorry for my English)(the metal) should be tied to ground.

I often use SPI of AVR and haven't met this problem.
(I just connect a 10K pull-up risiter to RESET pin)

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

A slow rising regulator is a ticket to trouble. Brown out detection is good, and there for just the problem you are encountering. A uP supervisory chip, generally cheap, is also a good bet.

Bozai, "case" is the more common term, but "shell" is easily understood. Grounding that is sometimes done, but seldom. It rarely give sufficient benefit to be worth the bother.

Keep in mind that all solutions suggested are not, separately or together, going to give 100% protection, especially if you are chattering the power connections.

"It's easier to ask forgiveness than it is to get permission" - Admiral "Amazing" Grace Hopper.