Rn12Tim
Joined: 04 Dec 2025 Posts: 1
|
| Error while loading and verifying Slave program on dsPIC33CH |
Posted: Fri Feb 06, 2026 4:27 am |
|
|
Hello there,
currently I am having some trouble with my dsPIC33CH512MP505 microcontroller.
For a long time it was working fine, but since the program of the slave core got bigger, I started having some problems.
The problem comes with the loading of the slave program.
Inside the master program I am loading the slave with the "load_slave_program" and verify the loaded program with the "verify_slave_program" function, which was working well for a Long time.
The way I load my slave file from the master into the PRAM of the slave:
load_slave_program(SLAVE_PROGRAM_START_ADDR, SLAVE_PROGRAM_INSTRUCTIONS);
verify_slave_program(SLAVE_PROGRAM_START_ADDR, SLAVE_PROGRAM_INSTRUCTIONS);
the defines are defined as:
#define SLAVE_PROGRAM_START_ADDR 0x034000
#define SLAVE_PROGRAM_END_ADDR 0x048FFE
#define SLAVE_PROGRAM_INSTRUCTIONS 16384
The slave program is loaded into the master hex with:
#import(file="Messender_FL_v03_Slave.X.production.hex", HEX, range=SLAVE_PROGRAM_START_ADDR:SLAVE_PROGRAM_END_ADDR)
For the offset of the slave hex, i have the following line in the slave project:
#export(file="MessenderFL_v03_Slave.hex", HEX, offset=SLAVE_PROGRAM_START_ADDR)
The slave hex starts at address 0x68000 and ends at 0x781B0.
In "PIC address Format" it should translate to 0x34000 to 0x3C0D8.
So there should be enough space for the Slave hex inside the Flash-Memory of the master.
Inside the hex-File, which is addressed by 1 Byte, an instruction is 24 Bits Long + 8 Bit "buffer" -> 32 Bit -> 4 addresses.
Inside the Pic, where 2 Byte are addressed per address, you have 24 Bit instruction + 8 Bit "buffer" -> 32 Bit -> 2 addresses.
So I think I need at least (0x3C0D8 - 0x34000)/2 = 16492 instructions for my slave program to work properly.
To my Problem:
My Problem occurs, when I try to load more than 16384 instructions. (By defining the "SLAVE_PROGRAM_INSTRUCTIONS" higher than 16384)
In this case "verify_slave_program" will return a value greater than 0, which means something went wrong.
If I Transfer less than 16384 instructions, then my program will load properly, but at some Point the slave will just stop working.
Which makes sense, because the program wasnt transfered completely...
So I have a few Questions:
1. Could there Maybe be an error in the PCD-Compiler 5.085, which prevents loading more than 14 Bit addresses (>16384) inside the PRAM of the slave Controller?
2. Is there a way to read and write the PRAM of the slave manually? So I could check myself which part of the hexfile isnt written correctly into the PRAM. Is there possibly another way to load the program into the slave?
3. Did I make any mistakes in the loading of the slave program?
I really would like to post the whole code of the program, but its a project of my company and because of that, I really cant post it online.
Currently we are using the version 5.85 of the PCD-Compiler, which is already quite old.
I am trying to get a new version of the compiler, but it can take quite some time to get new software in my company... |
|
Ttelmah
Joined: 11 Mar 2010 Posts: 20031
|
|
Posted: Sat Feb 07, 2026 12:56 pm |
|
|
You really need to ask CCS about this. It looks as if the problem appears
when you go past 64K bytes. I vaguely remember this being raised for
another import/export in the past, so CCS ought to be able to tell you if
possibly this is fixed in a later compiler, or if not how to handle this.
So email their support. |
|