View previous topic :: View next topic |
Author |
Message |
pinkfloyd11
Joined: 02 Jul 2007 Posts: 247
|
Posted: Wed Jan 11, 2012 9:06 am Post subject: How to set fuse bit directly from program code? |
|
|
Hello
How to set fuse bit directly from program code?
Thanks |
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
|
Back to top |
|
|
pinkfloyd11
Joined: 02 Jul 2007 Posts: 247
|
Posted: Wed Jan 11, 2012 3:22 pm Post subject: |
|
|
Hello Evert
If is true that I cannot set fuse bit directly from Bascom, the cause is about compiler limitation?
Hovewer I have read about $PROG
Thanks |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Jan 11, 2012 4:48 pm Post subject: |
|
|
First of all, you should mention for which chip.
Second, you should have a look in the datasheet.
Under the topic memory programming you can find info about programming the chip.
In short, atmel did not made it possible. Probably for a good reason.
And that is why bascom can not change the fuse/lock bits in code either. _________________ Mark |
|
Back to top |
|
|
pinkfloyd11
Joined: 02 Jul 2007 Posts: 247
|
Posted: Wed Jan 11, 2012 5:34 pm Post subject: |
|
|
Hello
I'm using ATTiny 25 programming by AVRISP II
Then what is $PROG?
Thanks |
|
Back to top |
|
|
kimmi
Joined: 24 Feb 2006 Posts: 1922 Location: Denmark
|
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
Posted: Wed Jan 11, 2012 7:21 pm Post subject: |
|
|
The $Prog can be used to program the fusebits automatic when the avr is programmed with an ISP programmer, not all programmers support this.
From the help file; The $PROG setting is only supported by the AVRISP, STK200/300, Sample Electronics and Universal MCS Programmer Interface. The USB-ISP programmer also supports the $PROG directive.
If it works with you AVRISP 2 ? Only one way to find out and that's give it a try. _________________ www.evertdekker.com Bascom code vault |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Thu Jan 12, 2012 12:41 am Post subject: |
|
|
I guess one should ask why exactly you think you need to change the fuses in code ? There are usually other ways to achieve similar effects, without compromising the security of the chip. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Thu Jan 12, 2012 10:31 am Post subject: |
|
|
I am not sure that the question was:
Can an AVR set its own fuse bytes at runtime?
(The answer is no).
* * *
If the subject of the thread was:
Presetting the fuse bytes into my basic source code so that the ISP-programmer
will use them when the compiled program is loaded into the flash memory of the chip.
How can I do that and how does it work. Are these settings embedded in the
output of the Bascom compiler (HEX or BIN file) or are these settings stored
in a separate file? If these settings are stored in a separate file, can I use this
feature only when I flash the chips from within the Bascom AVR IDE or can I use
this feature also when I flash the chips with the standalone Windows program
that comes with the ISP-programmer?
Best regards,
Luciano
Last edited by Luciano on Thu Jan 12, 2012 1:28 pm; edited 1 time in total |
|
Back to top |
|
|
pinkfloyd11
Joined: 02 Jul 2007 Posts: 247
|
Posted: Thu Jan 12, 2012 10:54 am Post subject: |
|
|
Dear friends,
The question is:
which is the bast way (if exist) to set fusebit directly from source code so that in mass production with only one operation I set fuse bit and write the program into the flash?
Thanks |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Thu Jan 12, 2012 11:35 am Post subject: |
|
|
(One way to do that).
AVR Studio 4 (current version is 4.19) can store FLASH and EEPROM contents,
fuses and lockbits in a single ELF file. (ELF Production File Format). LINK
The ELF file can then be used from the AVR Studio GUI or as input for the Atmel
command line tool (stk500.exe). You get the command line tool when you install
AVR Studio on your PC.
The above works with the current version of AVR Studio 4 and most of the current
versions of the programmers sold by Atmel.
Best regards,
Luciano |
|
Back to top |
|
|
reinhars
Joined: 29 Nov 2009 Posts: 114
|
|
Back to top |
|
|
|