|
|
View previous topic :: View next topic |
Author |
Message |
laser_scientist
Joined: 26 Jun 2013 Posts: 7
|
write_program_memory doesn't work on dsPIC33EP [solved] |
Posted: Wed Sep 25, 2013 12:37 pm |
|
|
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
|
Problem is in MPLAB |
Posted: Wed Sep 25, 2013 2:02 pm |
|
|
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
|
|
Posted: Thu Sep 26, 2013 12:35 am |
|
|
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 |
|
|
|
|
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
|