Bug in my programming tool

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

Hi all,

I wonder if anybody has seen this before.

I am working on my own ISP tool for a system where I am programming an AVR that is a slave to the main system processor. When I read back code from the AVR flash, sometimes I see what I expect, other times I see a parade of incrementing numbers.

Example
good:
0000000 940c 002c 940c 01ec 940c 01c6 940c 01a0
0000010 940c 0047 940c 0c99 940c 0047 940c 0047
0000020 940c 0047 940c 0047 940c 0047 940c 07e8
0000030 940c 067c 940c 0047 940c 0047 940c 0047
0000040 0000 0047 940c 0047 940c 0047 940c 0047
0000050 0000 0047 9400 0047 2411 be1f efcf e0d4
0000060 bfde bfcd e011 e0a0 e0b1 e3e0 e2f0 c002
0000070 9005 920d 3fa8 07b1 f7d9 e012 efa8 e0b1
0000080 c001 921d 35ae 07b1 f7e1 940c 023c 940c

bad:
0000000 940c 002c 940c 01ec 940c 01c6 940c 01a0
0000010 940c 0047 940c 0c99 940c 0047 940c 0047
0000020 940c 0047 940c 0047 940c 0047 940c 07e8
0000030 940c 067c 1a1a 1b1b 1c1c 1d1d 1e1e 1f1f
0000040 2020 2121 2222 2323 2424 2525 2626 2727
0000050 2828 2929 2a2a 2b2b 2c2c 2d2d 2e2e 2f2f
0000060 3030 3131 3232 3333 3434 3535 3636 3737
0000070 3838 3939 3a3a 3b3b 3c3c 3d3d 3e3e 3f3f
0000080 4040 4141 4242 4343 4444 4545 4646 4747

The problem is intermittent - it happens about 50% of the time. Anybody have an idea of what may be wrong?

Thanks,
- kwr

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

Parades of incrementing numbers indicate a locked chip, but it would not happen in the middle.

Try slowing down your ISP speed.

As a test, hammer the Read Signature button. Repeatable & reliable results?

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Thanks Lee.

Entering programming mode and reading the signature bytes is always reliable. I've got the clock below 250kbps, clock is set to 8MHz internal.

I wonder - should I check SPI synchronization for reads and writes as well as entering programming mode? I'll try that tomorrow.

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

Follow the algorithm in the datasheets, including the "waits",
and slow down programming (SPI) speed. Keep in mind that
maximum programming speed also depends on Vcc of
your target.

Embedded Dreams
One day, knowledge will replace money.