2 Replies Latest reply on Oct 4, 2019 10:32 AM by zhjoy

    How to write dspic33FJ128GP802 flash memory?

    zhjoy

      Hi ,

      I am working on a project which is using dsPIC33FJ128GP802. I am using MPLAB X IDE, XC16 compiler, pickit3.

      I need to write flash memory, I thought I have done all procedures, but the code doesn't work.I attached my code here, please help to see where I missed, and how to improve.

      In the code, I tried to write flash memory address 0x01000 with data 0x123456.

       

      Please help.

       

      Thanks a lot!

      Joy

        • Re: How to write dspic33FJ128GP802 flash memory?
          zhjoy

          Hi,

          I just found a bug in my code, and fixed it, before it is #1000,I changed it to #0x1000. After the modification, temp.i[0] can get 0xFFFF1234, but if I check program memory, address 0x01000, it is still 0xFFFFFF. and if I reset the processor, the first time step here, temp.i[0] is 0xFFFFFFFF again. So, flash memory wasn't written.

          asm("MOV #0x1000,W0"); //an example program memory address

          Where am I wrong, please help.

           

          Thanks a lot,

          Joy

            • Re: How to write dspic33FJ128GP802 flash memory?
              zhjoy

              Hi,

              I thought the code works now, it is my verification way is wrong. After I downloaded my code to the processor and run it in debug mode, my expectation was to see in MPLAB X IDE,  the  Program Memory window, in address 0x01000, the data is changed to the new data. I think this is wrong, When I export the data which in temp.i[0] over CAN, the output value is proper.

               

              Thanks,

              Joy