Reading fuses-great feature.

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

I know we bag Atmel when things don't go our way or we don't like something.

This time I wish to express my gratitude for providing means to read fuses and lockbits from within the program area.

As I'm finally getting around at sending out some boards with Mega164p and I need to make sure that certain fuses are set correctly (ie WDTON, JTAGEN off etc.) it's great that I can get the program to check it's own fuse setting (and lockbits) to make sure that things are what they shoud be.

If not, then it will become as stubborn as a mule and refuse to work!! :-) (with indication of problem areas)

So Atmelians, great feature, pat on the shoulder and buy yourselves a drink or 2 at the company's expenses :wink:

ps and Mr CirMicro the programmer seems to work well finally. Maybe still needs some twigging but it is now usable. Tomorrow will be the great smoke test, 50 boards to program.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Way to go John!!

Keep us in the know as you go 8)

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

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

Can the fuses be read on all Atmel AVR chips? Or just certain ones with the ______? feature.

You did not mention how you were reading these bits.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

Quote:
Can the fuses be read on all Atmel AVR chips?
Just on newer one with this feature. See the bootloader section. There may be some macros with winAvr to read the fuses already as there is one to read the signature bytes.

This is my code for the M164p:

;Fuse value returned in temp
read_low_fuses:
	ldi		zh,0x00					;point z to 0x0000 low fuse byte 
	ldi		zl,0x00
	rjmp	read_fuses_ret
read_high_fuses:
	ldi		zh,0x00					;point z to 0x0003 high fuse byte 
	ldi		zl,0x03
	rjmp	read_fuses_ret
read_ext_fuses:
	ldi		zh,0x00					;point z to 0x0002 ext fuse byte 
	ldi		zl,0x02

read_fuses_ret:
	ldi   temp,(1<<BLBSET | 1<<SPMEN)
	out   SPMCSR,temp
	lpm   temp,z
	ret

I had used this code for reading signature bytes before and it should work for lockbits (use adress 0x0001).

Different bits (SIGRD and SPMEN) need to be set for reading the signature and the appropiate address of course.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly