CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

SOLVED: PIC24 and getting the Configuration Bits address?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
allenhuffman



Joined: 17 Jun 2019
Posts: 617
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Dec 19, 2024 11:22 am     Reply with quote

jeremiah wrote:
Out of curiosity, did you try PROGRAM_MEMORY and see how it compared to the other options?


I have, now, and ran into a compiler issue (see other post I just made) which CCS is looking at.

But...

Code:
PROGRAM_MEMORY      : 0xabfc (44028)
CONFIGURATION_ADDR. : 0x57f8 (22520)


Looks like CONFIGURATION_ADDR is giving the PIC24 memory location and PROGRAM_MEMORY is giving number of bytes. But converting that to 2-bytes per address is still not the same as CONFIGURATION_ADDRESS.

However, PROGRAM_MEMORY is the value our code hard-codes in a #define, so maybe that's enough. I'll check our two other PIC24 types and see if they confirm.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?

Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
allenhuffman



Joined: 17 Jun 2019
Posts: 617
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Dec 19, 2024 11:35 am     Reply with quote

More tests:

Code:

24FJ256GA106:

PROGRAM_MEMORY      : 0x2abf8 (175096)
CONFIGURATION_ADDR. : 0x557f0 (350192)
RAM                 : 0x3fa6 (16294)
FLASH_WRITE_SIZE    : 0x100 (256)
MIN_FLASH_WRITE     : 0x4 (4)
FLASH_ERASE_SIZE    : 0x800 (2048)
BYTES_PER_ADDRESS   : 0x2 (2)
BITS_PER_INSTRUCTION: 0x18 (24)

24EP256GP202:

PROGRAM_MEMORY      : 0x2afec (176108)
CONFIGURATION_ADDR. : 0x55fd8 (352216)
RAM                 : 0x7fa6 (32678)
FLASH_WRITE_SIZE    : 0x8 (8)
MIN_FLASH_WRITE     : 0x4 (4)
FLASH_ERASE_SIZE    : 0x1000 (4096)
BYTES_PER_ADDRESS   : 0x2 (2)
BITS_PER_INSTRUCTION: 0x18 (24)

24FJ64GA002:

PROGRAM_MEMORY      : 0xabfc (44028)
CONFIGURATION_ADDR. : 0x57f8 (22520)
RAM                 : 0x1fa6 (8102)
FLASH_WRITE_SIZE    : 0x100 (256)
MIN_FLASH_WRITE     : 0x4 (4)
FLASH_ERASE_SIZE    : 0x800 (2048)
BYTES_PER_ADDRESS   : 0x2 (2)
BITS_PER_INSTRUCTION: 0x18 (24)

_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?

Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
allenhuffman



Joined: 17 Jun 2019
Posts: 617
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Dec 19, 2024 11:49 am     Reply with quote

Looking at the data sheets at the Configuration Byte addresses:

1) 24FJ256GA106

1. 2ABFE
2. 2ABFC
3. 2ABFA

We use 0x2ABF8 (half of what CONFIGURATION_ADDRESS reports. Not matching data sheet?

2) 24EP256GP202

Range: 2AFEC -- 2AFFE

We use 0x2AFF0 (half of CONFIGURATION_ADDRESS is 2AFEC, which matches the data sheet)

3) 24FJ64GA002

1. ABFE
2. ABFC

We use 0xABFC (matches CONFIGURATION_ADDRESS, and word #2 in the data sheet)

#3 is the only one where the #define in our code matches the datasheet. I expect there is a reason, but for now I may just leave everything as-is since it's been that way for well over 6 years.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?

Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
allenhuffman



Joined: 17 Jun 2019
Posts: 617
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Dec 19, 2024 12:08 pm     Reply with quote

And I now understand... The #defines we use match what is in the CCS HEX files.

Either CCS is wrong (well, it all seems to work, so probably not), or the data sheet is wrong (one of them has an update where they specifically corrected a Configuration Byte address so they have been in the past, at least), or CCS is wrong with what CONFIGURATION_ADDRESS returns from their database Smile

Clear as mud.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?

Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
allenhuffman



Joined: 17 Jun 2019
Posts: 617
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Dec 19, 2024 12:15 pm     Reply with quote

Some more details:

1 - 24FJ256GA106:

PROGRAM_MEMORY : 0x2abf8 (175096)
CONFIGURATION_ADDR. : 0x557f0 (350192)

CCS HEX file uses 2ABF8

Configuration Words
02ABF8: 00FF0000 00FFFFFF 00FF8319 00FF3F4D
Program Memory

Data sheet does not match - it shows (Word1) 2ABFE, (Word2) 2ABFC and (Word3) 2ABFA

-------------------------------------------------------------------------------

2 - 24EP256GP202:

PROGRAM_MEMORY : 0x2afec (176108)
CONFIGURATION_ADDR. : 0x55fd8 (352216)

CCS HEX file uses 2AFF0

Configuration Words
02AFF0: 00FFFFCF 00FFFFEF 00FFFF6D 00FFFF39
02AFF8: 00FFFFF8 00FFFFFF 00FFFFFF 00FFFFFF
Program Memory

Data sheet does not match? Range of 2AFEC-2AFFE???

-------------------------------------------------------------------------------

3 - 24FJ64GA002:

PROGRAM_MEMORY : 0xabfc (44028)
CONFIGURATION_ADDR. : 0x57f8 (22520)

CCS HEX file uses ABFC

Configuration Words
00ABFC: 00FFFB15 00FF3F6D
Program Memory

Data sheet lists Word2 ABFC (match) and Word1 (ABFE).
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?

Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
allenhuffman



Joined: 17 Jun 2019
Posts: 617
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Dec 19, 2024 12:28 pm     Reply with quote

I really need to write this up on my blog.

getenv("PROGRAM_MEMORY")

24FJ256GA106: 256K/16K - 87K Instructions
PROGRAM_MEMORY : 0x2abf8 (175096)
(divide by two and get 87548 instructions. 3-bytes per would be 262644, 256K-ish)

24EP256GP202: 256K/32K - 88K Instructions
PROGRAM_MEMORY : 0x2afec (176108)
(divide by two and get 88054 instructions. 3-bytes per would be 264162, 257K-ish)


24FJ64GA002: 64K/8K - 22K Instructions
PROGRAM_MEMORY : 0xabfc (44028)
(divide by two and get 22014 instructions. 3-bytes per would be 66042, 64K-ish).
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?

Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 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


Powered by phpBB © 2001, 2005 phpBB Group