use asm with registers killing chips, what dont I understand

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

I'm working with asm for the first time and need about 16 registers to hold data. Seem after a few minutes my chip wont burn, I get mismatching data.

WARNING: FLASH byte address 0x0006 is 0x8A (should be 0xBA).. FAILED!

Here is the code I'm testing for the first 8 registers. Please not the forum would not let me put this code in correctly.

//put the status of PORTC in a register Every other NOP. 

	in  r0, PORTC \n
		"nop	\n
//r1 cause issues..
	in  r2, PORTC\n
		"nop	\n 
	in  r3, PORTC\n
		"nop	\n
	in  r4, PORTC\n
		"nop	\n 
	in  r5, PORTC\n 
		"nop	\n
	in  r6, PORTC\n
		"nop	\n
	in  r7, PORTC\n
		"nop	\n
	in  r8, PORTC\n	

//now takes the first bit of each and put it in to register 0

BST r2, 0 \n
BLD r0, 1 \n

BST r3, 0 \n
BLD r0, 2 \n

BST r4, 0 \n
BLD r0, 3 \n

BST r5, 0 \n
BLD r0, 4 \n

BST r6, 0 \n
BLD r0, 5 \n

BST r7, 0 \n
BLD r0, 6 \n

BST r8, 0 \n
BLD r0, 7 \n

For those that are wondering why I'm doing this, its to get the first bit of PORTC with in a single clock with in very tight timing. However this is only a test, the issue here is that my chip is not usable after a few minutes. So I'm guessing I'm using registers that I should not be. And I just dont know enough about what register I can use. I need 16 of them if possible.

That or pop off the first bit of PORTC into a bit of a register with in two nops..

Something less then

"in r0, PORTC \n"
"BST r0, 0 \n"
"BLD r1, 1 \n"

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

The code you write has NOTHING to do with problems involving an inability to write flash while programming. That simply suggests you programmer/connections are "iffy"

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

Kind of sounds like your code is calling a write-to-flash routine somewhere too many times in a row... Is part of your application compiled with avrlibc? If so, you might want to check this page about register usage I'm guessing...

http://www.nongnu.org/avr-libc/u...

Sorry if I'm way off here... just trying to help ;)

Last Edited: Sat. Jul 18, 2009 - 05:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe, your programmer has the option to disable erase prior programming.
This should be useless in most cases.

Enable always erase prior programming. :!:

Peter

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

thx clawson, is reassuring to know. Just happened as I started this asm coding so I figured that was it.

thx, danni is it.

Quote:
Sorry if I'm way off here... just trying to help
- I'm thinking it does.. May not be relevant to my troubles but good info thx!

Also I happen to have to boards with an ISP's on them and they both do the same thing. But it could be that the first board hurt the chip, not sure. I only have one chip left ;(

Last Edited: Sat. Jul 18, 2009 - 05:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What kind of programmer is this? Something reliable like the AVRISPmkII or one of these half baked lash ups that only work half the time?

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

its of the AVRISPmkII flavor. I have been using if for 2 years with no troubles.

UPDAE:: OK I erased the device on my second board and re programed with success . Going to test with this board for a bit.