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

write_program_memory doesn't work on dsPIC33EP [solved]

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



Joined: 26 Jun 2013
Posts: 7

View user's profile Send private message

write_program_memory doesn't work on dsPIC33EP [solved]
PostPosted: Wed Sep 25, 2013 12:37 pm     Reply with quote

Hello,

I am trying to use the write_program_memory() function on a dsPIC33EPMU806, and can't seem to get it to work. I have a simple program for testing (below). I've tried changing the buffer allocation size, the byte count for the write, the stack allocation. Regardless of settings, I get the following error:

Trap due to unimplemented RAM or PSV memory access, occurred from instruction at 0x0002b0

I've looked, and this is inside the CCS write_program_memory() routine.

The read_program_memory() function seems to work.

Code:

#include <33EP256MU806.h>
// #build (stack=1024)

#use delay(crystal=8Mhz, clock=120Mhz)

#define BUF_DECLSIZE 1024
#define BUF_READSIZE 384

char buffer[BUF_DECLSIZE];

void main(void)
{
   int32 addr_r, addr_w;
   int16 count;

   addr_r = 0x00000200;
   addr_w = 0x00001000;
   count = BUF_READSIZE;

   read_program_memory(addr_r, buffer, count);
   write_program_memory(addr_w, buffer, count);

   while (1);
}


I'm using version 5.011 of the compiler.

Has anyone else experienced this problem?

Thanks,
Dan
laser_scientist



Joined: 26 Jun 2013
Posts: 7

View user's profile Send private message

Problem is in MPLAB
PostPosted: Wed Sep 25, 2013 2:02 pm     Reply with quote

Found the problem. Apparently MPLAB SIM doesn't implement TBLWTx commands properly. I was trying to simulate the program before testing in hardware. The hardware worked. The simulation didn't...
Ttelmah



Joined: 11 Mar 2010
Posts: 19515

View user's profile Send private message

PostPosted: Thu Sep 26, 2013 12:35 am     Reply with quote

As a 'comment', longer term, you should reserve the area you are going to write 'to' with an #ORG, otherwise the compiler may (when the code gets more complex), accidentally start putting things there.

Best Wishes
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