|
|
View previous topic :: View next topic |
Author |
Message |
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
24FJ and Debugger |
Posted: Mon Oct 10, 2011 9:48 am |
|
|
I have emailed CCS about this but haven't been helped yet.
I have V4.125 and the PIC24FJ256GA106 and cannot get the chip to debug. I have had the debugger working before but something changed (software and ICD update) and now the chip will load, then verify data, the say Busy then pop up "Could not start Target. The target was not halted after reset .... blah blah blah....Valide fuses... blah blah.... fuse."
ICD is CCS 2.91
If I compile my program without icd=true and use ccsload, the program loads and runs as expected.
I have tried many combinations of the fuses and cannot find the magical combination for debugging. Here is the code I am testing with right now.
Code: |
#include <24FJ256GA106.h>
#build(stack=512)
#device icd=true
//////// Fuses: WPOSTS1,WPOSTS2,WPOSTS3,WPOSTS4,WPOSTS5,WPOSTS6,WPOSTS7
//////// Fuses: WPOSTS8,WPOSTS9,WPOSTS10,WPOSTS11,WPOSTS12,WPOSTS13,WPOSTS14
//////// Fuses: WPOSTS15,WPOSTS16,WDT128,WDT32,NOWINDIS,WINDIS,NOWDT,WDT
//////// Fuses: ICSP3,ICSP2,ICSP1,DEBUG,NODEBUG,WRT,NOWRT,PROTECT,NOPROTECT
//////// Fuses: NOJTAG,JTAG,EC,XT,HS,NOPR,NOIOL1WAY,IOL1WAY,OSCIO,NOOSCIO
//////// Fuses: CKSFSM,CKSNOFSM,NOCKSFSM,FRC,FRC_PLL,PR,PR_PLL,SOSC,LPRC
//////// Fuses: FRC_PS,NOIESO,IESO,NOWPFP,WPFP,WPDIS,NOWPDIS,WPCFG,NOWPCFG
//////// Fuses: WPEND,WPBEG
#FUSES ICSP2 //ICD uses PGC2/PGD2 pins
//#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOWDT //No Watch Dog Timer
#FUSES NOJTAG //JTAG disabled
//#FUSES NOPROTECT //Code not protected from reading
//#FUSES NOWRT //Program memory not write protected
//#FUSES NOCODE //Device will reset into operational mode
#FUSES WINDIS //Watch Dog Timer in non-Window mode
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES PR
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled
//#FUSES NOOSCIO //OSC42 is clock output
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOIOL1WAY
#FUSES NOWPFP
#use delay(clock=20000000,RESTART_WDT)
#pin_select U1TX=PIN_F3
#pin_select U1RX=PIN_F2
#pin_select U2TX=PIN_F5
#pin_select U2RX=PIN_F4
#pin_select U3TX=PIN_G8
#pin_select U3RX=PIN_G7
#pin_select U4TX=PIN_b8
#pin_select U4RX=PIN_b9
#use rs232(uart1,baud=38400,parity=N,bits=8,ERRORS,stream = uar1)
#use rs232(uart2,baud=38400,parity=N,bits=8,ERRORS,stream = uar2)
#use rs232(uart3,baud=38400,parity=N,bits=8,ERRORS,stream = uar3)
#use rs232(uart4,baud=9600,parity=N,bits=8,ERRORS,stream = uar4)
//#use rs232(ICD)
#zero_ram
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <float.h>
main(){
while(1){
delay_ms(1000);
fprintf(uar4,"test\r\n");
}
}
|
|
|
|
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
|
Posted: Mon Oct 10, 2011 10:31 am |
|
|
FYI, not even the 24FJ128GA006 development board I bought from CCS will load and debug a program...... |
|
|
destmaster84
Joined: 10 Oct 2011 Posts: 3
|
It's a #fuses ICSP bug |
Posted: Mon Oct 10, 2011 12:01 pm |
|
|
CCS v 4.124
I've this problem. I had spent my morning to find the problem. At the end I've find that the directive #fuses ICSPx not works if ICSP is different by ICSP1. In my project I've ICSP connected to port 3 and after compiling If i observe configuration bits in MPLAB windows the field ICSP remain set to ICSP1.
I've set to set manually only the ICSP ports deselecting "Configuration bits set in code" and all works fine.
The problem appears only when enter in debug mode.
Programming, erasing etc. works always good.
With version 4.120 there isn't this problem.
Please solve this bug!! |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Oct 10, 2011 1:04 pm |
|
|
CCS loves to apply arbitrary changes to fuse keywords and fuse entry decoding without notice. You should check the respective settings in the Device Table Editor for ICSP1 - 3. In some cases, the sudden change had been a correcting a previous setting contradicting the Microchip documentation.
Anyway, thanks for clarifying the cause for the V4.125 debugging problems. |
|
|
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
|
Posted: Mon Oct 10, 2011 1:53 pm |
|
|
I am changing #FUSES ICSP1 2 OR 3 but the ICSP fuse in the List File is always set to ICSP1.
I am connected to ICSP2, B6,B7.
The Device Table Editor shows:
ICSP3 MASK: 000300 VALUE:000100
ICSP2 MASK: 000300 VALUE:000200
ICSP1 MASK: 000300 VALUE:000300
Code: |
Configuration Fuses:
Word 1L: 375F WPOSTS16 WDT128 WINDIS NOWDT ICSP1 DEBUG NOWRT NOPROTECT NOJTAG
H: FF00
Word 2L: 02AA HS NOIOL1WAY NOOSCIO NOCKSFSM PR NOIESO
H: FF00
Word 3L: FE00 NOWPFP WPDIS NOWPCFG WPEND
H: FF00
Word 4L: 0000
H: FF00
Some fuses have been forced to be compatible with the ICD debugger.
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 10, 2011 2:03 pm |
|
|
If you're testing fuse behavior, get rid of DEBUG mode. (both in the CCS
or MPLAB drop-down box, and in #device ICD=TRUE, and in the #fuses).
In debug mode, the Config bits will often be forced into the required
settings for debugging. If you want to test the ability to set any fuse,
then get rid of DEBUG mode during your tests. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Oct 10, 2011 11:42 pm |
|
|
Quote: | In debug mode, the Config bits will often be forced into the required
settings for debugging. |
You're right, that CCS apparently decided to make PCD force ICSP1 in debug mode since V4.124 (or a few version before). But I don't see that it's required. It rather seems like a new bug. ICSPx fuses are used exclusively for debugging. If they can't be set according to the target system hardware, they are useless.
You'll need to set ICSPx in MPLAB for the time being and should ask CCS for an explanation. |
|
|
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
|
Posted: Tue Oct 11, 2011 7:19 am |
|
|
So what is the conclusion? Do I need to move the icd pins from B6,B7 to B1,B0? Do I need to downgrade to 4.120? Does CCS need to fix a bug?
Turning off Debug doesn't change anything. I am not trying to test fuse settings, I am just trying to get my project back to debugging again. I was playing with fuses because the errror that pops up says the problem has to be in the fuse settings. Not even the 24FJ128GA006 development board I bought from CCS will load and debug a program.
I have another call into ccs because the 16F1825 will not program because the ICD can't read the ID when the chip is at 3.3V I have to raise the voltage to 3.8V but then other components on the board don't work properly.
destmaster84, can you elaborate on what you did? What does deselecting "Configuration bits set in code" mean and where do I find this? |
|
|
destmaster84
Joined: 10 Oct 2011 Posts: 3
|
|
Posted: Tue Oct 11, 2011 11:50 am |
|
|
I'm using MPLAB IDE to debug my project.
In "Configuration bits" I've deselected "configuration Bit set in code" flag and selected manually all fuses.
In my project with PI24FJ256GA106 and ICSP connected on ICSP3 pair works fine.
However, I've preferred to downgrade to version 4.120, because I would not other surprises!!
I will wait for CCS fix. |
|
|
ljbeng
Joined: 10 Feb 2004 Posts: 205
|
|
Posted: Mon Oct 17, 2011 3:29 pm |
|
|
The fix...
|
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Oct 17, 2011 11:19 pm |
|
|
The below statement can be found in readme.txt since more than a year:
Quote: | The following may also be used instead of the fuses:
#device ICD=2 |
Since V4.1024, the entry is apparently required, but the fuses are ignored. Doesn't sound well considered, besides being undocumented. |
|
|
destmaster84
Joined: 10 Oct 2011 Posts: 3
|
|
Posted: Wed Oct 19, 2011 12:57 am |
|
|
Works good thanks!!
CCS: is not bad make documentation coherent!!
Please update pdf manuals... |
|
|
|
|
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
|