Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

how to programm serial number?
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 386
Location: Wuppertal, Germany

germany.gif
PostPosted: Thu Feb 28, 2008 3:05 pm    Post subject: how to programm serial number? Reply with quote

Hi,
I need to programm a serial number into the flash. The number must increase after each programming.
Is there a solution?
Back to top
View user's profile
lpa

Bascom Member



Joined: 12 Dec 2006
Posts: 27
Location: Oreokastro, Greece

greece.gif
PostPosted: Thu Feb 28, 2008 6:41 pm    Post subject: Reply with quote

how do you program the flash ?

are you using bootloader ?
Back to top
View user's profile Visit poster's website
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 386
Location: Wuppertal, Germany

germany.gif
PostPosted: Thu Feb 28, 2008 6:56 pm    Post subject: Reply with quote

No bootloader, I donīt want to programm a new number to the same chip every time it is programmed.
I need to programm serial numbers into a large amount of chips, e.g. the serial number of your mobile.
Back to top
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Thu Feb 28, 2008 10:04 pm    Post subject: Reply with quote

Ponyprog has the option for an auto incremental serial number.
Check it out, it's free.
http://www.lancos.com/prog.html

Regards,
Evert

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Thu Feb 28, 2008 10:05 pm    Post subject: Reply with quote

Ponyprog has the option for an auto incremental serial number.
Check it out, it's free.
http://www.lancos.com/prog.html

Regards,
Evert

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2483
Location: Queensland

australia.gif
PostPosted: Thu Feb 28, 2008 10:30 pm    Post subject: Reply with quote

May not be quite what you want, but Bascom compiler stores the date/time of compilation in a variable called Version in your code. So if you did a re-compile before each chip program, you would get a different date/time stamp for each chip.
_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 386
Location: Wuppertal, Germany

germany.gif
PostPosted: Fri Feb 29, 2008 11:56 am    Post subject: Reply with quote

Thanks a lot!
Both ways are fine to me, Iīll use them both!

I can read the "ponyprog" serial number using the cpeek command, thats easy. Its also easy to find an unused address in the flash, Iīd use the very last address.
But imagine I change my program-code, it might suddenly use the address of the serial number.
My idea is to place dummy-data at the very end of my Code, thus keeping the space left for my serial number.
Does anyone agree?
Back to top
View user's profile
lpa

Bascom Member



Joined: 12 Dec 2006
Posts: 27
Location: Oreokastro, Greece

greece.gif
PostPosted: Fri Feb 29, 2008 12:16 pm    Post subject: Reply with quote

Here is my idea:

1)Set the address of a variable in Bascom at a specific address in code memory, put in this variable your default ID-value. Use command :
Code:
DIM var AS [XRAM/SRAM/ERAM]type [AT location/variable] [OVERLAY] AT

The optional AT parameter lets you specify where in memory the variable must be stored. When the memory location already is occupied, the first free memory location will be used. You need to look in the report file to see where the variable is located in memory.


2)Compile and get the HEX file.

3)Make a pc program to run from windows that changes in the HEX file the specific values at bascom variable's address space with your ID value automatically - something like automatic hexeditor.

4)Program the HEX file to chip flash

Since you define the Bascom variable at a specific address, you can modify the rest of the program without affecting the rest of the procedure
Back to top
View user's profile Visit poster's website
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Fri Feb 29, 2008 12:27 pm    Post subject: Reply with quote

lpa wrote:
Here is my idea:

1)Set the address of a variable in Bascom at a specific address in code memory, put in this variable your default ID-value. Use command :
Code:
DIM var AS [XRAM/SRAM/ERAM]type [AT location/variable] [OVERLAY] AT

The optional AT parameter lets you specify where in memory the variable must be stored. When the memory location already is occupied, the first free memory location will be used. You need to look in the report file to see where the variable is located in memory.




Nice idea to reserve space for Ponyprog, address will not change with an software update.

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 386
Location: Wuppertal, Germany

germany.gif
PostPosted: Fri Feb 29, 2008 12:35 pm    Post subject: Reply with quote

As far as I understand, that will preseve space in a RAM, but I need to write the serial-number in the flash-ROM. The serial-number cannot be a variable!
Back to top
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Fri Feb 29, 2008 12:58 pm    Post subject: Reply with quote

Arera wrote:
As far as I understand, that will preseve space in a RAM, but I need to write the serial-number in the flash-ROM. The serial-number cannot be a variable!


Yep your right, Embarassed time to get some lunch.

_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Fri Feb 29, 2008 1:39 pm    Post subject: Reply with quote

Hi,

Write a batch file (or program) that calls the tool HEXinc.
(HEXinc will increment a value in the HEX file).

The same batch file (or program) will then call the Atmel command
line programming software stk500.exe which will flash the AVR chip.

Note that stk500.exe will output the file stk500.log after programming.
(Error report).

* * *

Where to download the tool HEXinc:
http://www.atmel.ru/Disks/AVR%20Technical%20Library/tools/developer/stk500/index.html
(See link Serial Number Programming for Batch Programming).
To get help type: hexinc -h

Where do get stk500.exe:
stk500.exe is installed when you install AVR Studio. (Current version 4.13).
The documentation of the command line software (stk500.exe) is in
the help file of AVR studio. (Open the STK500 help file).

The STK500.exe will work with the Atmel ISP programmer STK500, AVRISP and AVRISP Mk II.

Best regards,

Luciano
Back to top
View user's profile
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 386
Location: Wuppertal, Germany

germany.gif
PostPosted: Fri Feb 29, 2008 4:21 pm    Post subject: Reply with quote

Thanks Luciano for this way to get the serial number into the chip.

But what Iīm still worried about is:

Can I be shure, that if I place the serial number at the end of the flash-ROM, this location is untouched by the programm, until its size reaches there?
Back to top
View user's profile
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2156

netherlands.gif
PostPosted: Fri Feb 29, 2008 4:53 pm    Post subject: Reply with quote

If you don't use an bootlader you can abuse $LOADERSIZE for it.
_________________
www.evertdekker.com Bascom code vault
Back to top
View user's profile Visit poster's website
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 386
Location: Wuppertal, Germany

germany.gif
PostPosted: Fri Feb 29, 2008 5:21 pm    Post subject: Reply with quote

Yes, thatīs what I was looking for!
I donīt know anything about that mysterious bootloader stuff, so just to be shure: The bootloader space is always at the end of the memory, right?
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum