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 support@ccsinfo.com

Read #ID Checksum on dsPIC30F3011

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
RNR107



Joined: 19 Dec 2014
Posts: 23

View user's profile Send private message

Read #ID Checksum on dsPIC30F3011
PostPosted: Mon Mar 08, 2021 10:32 am     Reply with quote

Hi all,
I am trying to read the Checksum stored in the user #ID on a dsPIC30F3011.
My function looks like that:
Code:

#ID CHECKSUM
.
.
.
.
.
unsigned int16 Get_Checksum(void)
{
   unsigned int8 id[8];
   unsigned int n;
   unsigned int16 check_id = 0;

   read_program_memory(0x8005C0, id, sizeof(id) );
   for(n=0; n<=3; ++n)
   {
      check_id=check_id*16+(id[n*2] & 15);
   }
   return(check_id);
}


This code works fine on a dsPIC30F3012. But not on the 3011.
Is it on a different location on the 3011 ? I search through the datasheet but could not find the answer.

I am using compiler PCWHD Version 5.091

Thank you for any help.
RNR
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 09, 2021 2:14 am     Reply with quote

Look on page 3 of the pdf below. This pdf covers the 3011.
It shows the Unit ID area is at 0x8005C0.

dsPIC30F Flash Programming Specification:
http://ww1.microchip.com/downloads/en/devicedoc/70102k.pdf\

Look at section 6.7 on page 21. It says a Bulk Erase will not erase
the Unit ID area. So potentially it could be a problem with your programmer
firmware.

How do you know the ID was written correctly ?
You could have the compiler read it with:

value = getenv("ID");
RNR107



Joined: 19 Dec 2014
Posts: 23

View user's profile Send private message

PostPosted: Tue Mar 09, 2021 3:47 am     Reply with quote

Ha.... OK
In that case, I know why it doesn't work.
I have a bootloader on this PIC, therefore it doesn't get erased properly...

Thank you for help!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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