 |
 |
| View previous topic :: View next topic |
| Author |
Message |
jeremiah
Joined: 20 Jul 2010 Posts: 1426
|
|
Posted: Mon Sep 10, 2012 5:54 pm |
|
|
Some fuses do prevent writing. You might check your fuse settings yes. Also, did you try it with the erase_program_memory() line uncommented? I initially left it commented since it shouldn't be needed, but you might give it a try with it not commented out as well.
Still your fuses are probably your next route to check. |
|
 |
naughty_mark
Joined: 29 Aug 2012 Posts: 97
|
|
Posted: Mon Sep 10, 2012 6:10 pm |
|
|
| jeremiah wrote: | Some fuses do prevent writing. You might check your fuse settings yes. Also, did you try it with the erase_program_memory() line uncommented? I initially left it commented since it shouldn't be needed, but you might give it a try with it not commented out as well.
Still your fuses are probably your next route to check. |
sorry, man, I just updated my last poster and tried uncomment the erase program line, the same result.
and my fuse is
| Code: |
#if defined(__PCD__)
#include <33EP256MU814.h>
#fuses HS,PR,NOWDT,ICSP2
#device ADC=12
#use delay(clock=20000000) // Actual crystal is 20M
#pin_select U1TX = PIN_D0
#pin_select U1RX = PIN_D1
#pin_select U2TX = PIN_D2
#pin_select U2RX = PIN_D3
#use RS232(UART1, STREAM = GSM, BAUD=2400, XMIT = PIN_D0 , RCV = PIN_D1 , BITS = 8, STOP = 1, PARITY = N, ERRORS)
#use RS232(UART2, STREAM = MODBUS, BAUD=9600, XMIT = PIN_D2 , RCV = PIN_D3 , BITS = 8, STOP = 1, PARITY = N, ERRORS)
#use i2c(MASTER, I2C1,SCL = PIN_D10, SDA = PIN_D9 , FORCE_SW)
#pin_select IC1=PIN_F0
#pin_select C1TX = PIN_D6
#pin_select C1RX = PIN_D5
#endif
|
Just have some other port declaration than your example code, I think that won't effect the result. The fuse part are the same.  |
|
 |
jeremiah
Joined: 20 Jul 2010 Posts: 1426
|
|
Posted: Mon Sep 10, 2012 6:20 pm |
|
|
| You aren't specifying many fuses, so there are a lot of them being defaulted. You might check and see if any of those prevent writing to flash memory. That's all I can think of. |
|
 |
naughty_mark
Joined: 29 Aug 2012 Posts: 97
|
|
Posted: Mon Sep 10, 2012 6:37 pm |
|
|
| jeremiah wrote: | | You aren't specifying many fuses, so there are a lot of them being defaulted. You might check and see if any of those prevent writing to flash memory. That's all I can think of. |
Thanks for your time, mate. I will check it out. Meanwhile I am trying another board although it has dsPIC30 on it, I just wanna make sure that is not hardware problem...  |
|
 |
naughty_mark
Joined: 29 Aug 2012 Posts: 97
|
|
Posted: Mon Sep 10, 2012 7:35 pm |
|
|
| jeremiah wrote: | | You aren't specifying many fuses, so there are a lot of them being defaulted. You might check and see if any of those prevent writing to flash memory. That's all I can think of. |
Hey, mate.
a very funny thing I just found.
I tried to program the code into micro and the MPLAB told me program failed, and then the code ran on my screen CORRECTLY! Then I reprogram, this time it said program/verify complete, then the code ran and back to the bad result again! Only one time I got the program/verify complete notice after I using MPLAB programmer and got correct result, others are all bad ones..
I was really mad by this compiler and programmer and the micro... |
|
 |
asmallri
Joined: 12 Aug 2004 Posts: 1680 Location: Perth, Australia
|
|
Posted: Mon Sep 10, 2012 7:50 pm |
|
|
| naughty_mark wrote: | | jeremiah wrote: | | You aren't specifying many fuses, so there are a lot of them being defaulted. You might check and see if any of those prevent writing to flash memory. That's all I can think of. |
Hey, mate.
a very funny thing I just found.
I tried to program the code into micro and the MPLAB told me program failed, and then the code ran on my screen CORRECTLY! Then I reprogram, this time it said program/verify complete, then the code ran and back to the bad result again! Only one time I got the program/verify complete notice after I using MPLAB programmer and got correct result, others are all bad ones..
I was really mad by this compiler and programmer and the micro... |
You cannot verify a PIC with code protection set - obviously. If you could do this then it would be a simple process of elimination to crack the contents of any code protect PIC. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
 |
naughty_mark
Joined: 29 Aug 2012 Posts: 97
|
|
Posted: Mon Sep 10, 2012 7:55 pm |
|
|
| asmallri wrote: | | naughty_mark wrote: | | jeremiah wrote: | | You aren't specifying many fuses, so there are a lot of them being defaulted. You might check and see if any of those prevent writing to flash memory. That's all I can think of. |
Hey, mate.
a very funny thing I just found.
I tried to program the code into micro and the MPLAB told me program failed, and then the code ran on my screen CORRECTLY! Then I reprogram, this time it said program/verify complete, then the code ran and back to the bad result again! Only one time I got the program/verify complete notice after I using MPLAB programmer and got correct result, others are all bad ones..
I was really mad by this compiler and programmer and the micro... |
You cannot verify a PIC with code protection set - obviously. If you could do this then it would be a simple process of elimination to crack the contents of any code protect PIC. |
sorry, mate. I can not quite understand what you mean. Do you mean I shouldn't have PR in #fuse?
Actually yesterday, I tried to read out the hex from micro by using MPLAB and export it, then compare with my hex file. They are not different! only part of them are the same and the second half of my hex file is not equal with the content read out in same address. |
|
 |
naughty_mark
Joined: 29 Aug 2012 Posts: 97
|
|
Posted: Mon Sep 10, 2012 8:48 pm |
|
|
Hi, guys.
I noticed that in configuration bit, there is a register named "FGS" and has "GSSK" and "GSS" and "GWRP", which showed in datasheet page 474, and as it required, I set it in #fuse
so now is
| Code: | | #fuses HS,PR,NOWDT,ICSP2,NOPROTECT,NOGSSK |
but still doesn't work  |
|
 |
naughty_mark
Joined: 29 Aug 2012 Posts: 97
|
|
Posted: Tue Sep 11, 2012 1:05 am |
|
|
Hi, Guys.
Finally I fixed it.
Although I don't know why. the fuse statement is
| Code: |
#fuses HS,PR,NOWDT,ICSP2,NOGSSK,NOPROTECT,NOAPROTECT,NOAPLK
|
I found it by accident, because I found the NOGSSK fuse first and tried, but failed, and then I think maybe I can not write to main flash memory while I run code on it. So I tried to write to Auxiliary flash, and change the write address, failed again. Then I change to main flash memory write back but without delete, NOAPLK and NOAPROTECT fuse. Then it works!!!!!!
Now I can let my bootloader code work~ just need CCS to support auxiliary flash to put bootloader code. Or maybe it is my fault. Maybe try download bootloader code to auxiliary flash tomorrow.
Anyway, thank you all guys! thanks a lot!  |
|
 |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Tue Sep 11, 2012 5:35 am |
|
|
Usual steps to prevent problems like this are:
- review valid fuses in CCS IDE
- if you have any doubts about correct fuse settings, check the actual fuses in MPLAB, compare with datasheet specifications
- if necessary, correct CCS fuse definitions in device editor or bypass the compiler fuse output by writing the configuration words with a #rom statement |
|
 |
|
|
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
|