• AVR Freaks

AnsweredSQTP not updating serial number

Author
jCoder
New Member
  • Total Posts : 26
  • Reward points : 0
  • Joined: 2015/04/29 10:57:23
  • Location: 0
  • Status: offline
2018/04/27 15:30:32 (permalink)
0

SQTP not updating serial number

Using:
 
 
PIC32MZ2048EFM100
IPE v4.15
 
I can't seem to get the IPE to update my serial number when I am programming new boards.  The IPE reports that it was successful and shows the address it programmed to and the serial number that it programmed but then when I check what is actually there it shows the value that the serial number is defaulted to.  
 
This is how I declare the serial number variable:
const uint32_t __attribute__((space(prog),address(0x9D0FC000))) mySn = 1000;
 
 
To create the SQTP file I use the following settings:
-Sequential
- Start Value (Hex): A0000
- Start Address (Hex): 1D0FC000
Number of bytes(Dec): 4
Number of parts(Dec): 10
Location - Program Memory
 
Any suggestions? I would appreciate the help.
#1
aschen0866
Super Member
  • Total Posts : 4504
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: SQTP not updating serial number 2018/04/29 12:57:52 (permalink)
0
jCoder
... but then when I check what is actually there it shows the value that the serial number is defaulted to.  
 
This is how I declare the serial number variable:
const uint32_t __attribute__((space(prog),address(0x9D0FC000))) mySn = 1000;
...
 

How do you "check what is actually there"? If you read back the program memory, assuming code protection is OFF, do you see the expected value?
 
Another potential cause is the compiler optimization. Do you have optimizer enabled? If so, you'll need the volatile qualifier to go with the definition. Otherwise, the compiler could simply load a register with the immediate constant, in this case, 1000, rather than perform a real memory read.
#2
jCoder
New Member
  • Total Posts : 26
  • Reward points : 0
  • Joined: 2015/04/29 10:57:23
  • Location: 0
  • Status: offline
Re: SQTP not updating serial number 2018/04/30 17:30:48 (permalink)
0
After reading back the program memory using IPE's read function (which is a intel-extended hex file) I realized that the IPE is writing to the correct address but my default value is being written to a different location.  
 
volatile uint32_t __attribute__((space(prog),address(0x9D0FC000))) mySn = SERIAL_NUMBER;
 
My default is being written to the address 0x1D014000 when I am specifying 0x9D0FC000 which believe is the same as 0x1D0FC000 in program flash.  
 
The IPE is writing to the correct address 0x1D0FC000.
 
It seems my variable declaration is still incorrect.  I tried adding volatile. Any other suggestions?  How do you specify an absolute address for a variable?
#3
aschen0866
Super Member
  • Total Posts : 4504
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: SQTP not updating serial number 2018/04/30 18:05:31 (permalink)
0
jCoder
 
 
volatile uint32_t __attribute__((space(prog),address(0x9D0FC000))) mySn = SERIAL_NUMBER;
 
My default is being written to the address 0x1D014000 when I am specifying 0x9D0FC000 which believe is the same as 0x1D0FC000 in program flash.  
 

Check the .map file to confirm the location of mySn. 
 
#4
aschen0866
Super Member
  • Total Posts : 4504
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
Re: SQTP not updating serial number 2018/04/30 18:08:18 (permalink) ☼ Best Answerby jCoder 2018/04/30 18:46:41
0
jCoder
 
It seems my variable declaration is still incorrect.  I tried adding volatile. Any other suggestions?  How do you specify an absolute address for a variable?


That should be pretty straightforward:

// main.c
volatile const uint32_t __attribute__((space(prog),address(0x9D0FC000))) mySn = 0x11223344;

and the .map file should say:

0x9d0fc000 0x4 build/default/production/main.o
0x9d0fc000 mySn

#5
jCoder
New Member
  • Total Posts : 26
  • Reward points : 0
  • Joined: 2015/04/29 10:57:23
  • Location: 0
  • Status: offline
Re: SQTP not updating serial number 2018/04/30 18:46:11 (permalink)
0
You fixed it!
I was able to find the correct address in the .map file after I changed the statement to:
 
const volatile uint32_t __attribute__((space(prog),address(0x9D0FC000))) mySn = SERIAL_NUMBER;
 
I also checked by programming a new serial number using the IPE and it finally changed it. 
 
Thank you very much!
#6
Jump to:
© 2019 APG vNext Commercial Version 4.5