View previous topic :: View next topic |
Author |
Message |
JV625 Guest
|
Debug Printf Mysteriously Stopped Working |
Posted: Thu Jun 25, 2009 10:23 am |
|
|
Has anyone ever had an experience using a USB Based ICD programmer in PCW where a program ran and debugged just fine, including sending printf statements to the monitor, and then it stopped?
I ran such a program for days on a 18F2450, left the office, and came back to find that none of the printf statements were working.
I tried restarting the program, restarting the computer, unplugging and replugging in the ICD, using another circuit board with another PIC (same model), but never had any luck.
The programs do seem to run fine, and I am able to pause with the debugger, I just can't get any printf data out.
The headers in all of the programs that I am trying are:
Code: |
#include <18F2450.h>
#device ICD=TRUE
#include <stdlib.h>
#fuses HS, NOWDT, NOPROTECT, DEBUG
#use delay(clock=20000000)
#use RS232(DEBUGGER, XMIT=PIN_B5, RCV=PIN_B5) |
|
|
![](templates/subSilver/images/spacer.gif) |
JV625 Guest
|
P.S. |
Posted: Thu Jun 25, 2009 10:28 am |
|
|
I should mention, if it isn't obvious, that before leaving the printf statements always worked just fine in these programs.
I can not think of a single thing that has changed except for elapsed time, and the fact that I used multiple programs (including old ones that were not modified and also worked) suggests something fishy is going on.
To reduce the possibility of it relating to some complex programming bug, I even tried:
Code: |
#include <18F2450.h>
#device ICD=TRUE
#include <stdlib.h>
#fuses HS, NOWDT, NOPROTECT, DEBUG
#use delay(clock=20000000)
#use RS232(DEBUGGER, XMIT=PIN_B5, RCV=PIN_B5)
void main(){
while(1){
printf("Hello World!");
}
} |
but had no luck. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 25, 2009 11:29 am |
|
|
Post your compiler version. |
|
![](templates/subSilver/images/spacer.gif) |
JV625
Joined: 25 Jun 2009 Posts: 16
|
Compiler Version |
Posted: Thu Jun 25, 2009 11:51 am |
|
|
Compiler version 4.066 with ICD V2.89 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 25, 2009 12:57 pm |
|
|
I don't have an 18F2450, so I used an 18F4550. I installed vs. 4.066
and compiled your program. On my PicDem2-Plus board, I jumpered
pin B5 to pin C6. I set the terminal program on my PC to 2400N81.
It worked. I got this output:
Quote: |
Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!
Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!
Hello World!Hello World!Hello World!Hello World!Hello World!Hello World! |
I suggest that you test it with a terminal program. Don't use the
connection through the CCS ICD-U40 debugger. Connect pin B5
to a MAX232-type chip and connect the output of that chip to your PC
with a serial cable. Or look at pin B5 with an oscilloscope, to see if
the signal is there. If it is, then the problem is in the ICD-U40 hardware
or in one of the cables. Or possibly it's in the configuration of the CCS IDE. |
|
![](templates/subSilver/images/spacer.gif) |
JV625
Joined: 25 Jun 2009 Posts: 16
|
|
Posted: Thu Jun 25, 2009 2:43 pm |
|
|
The oscilloscope shows that pin B5 it is sending out a repeating pattern that is roughly the same, so I assume it is OK.
Any idea which settings in the compiler might need to be changed?
Or, if it was the ICD itself, is there anything specific to change or check? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 25, 2009 2:47 pm |
|
|
Look in the Configure menu and see if the Debug Monitor is enabled. |
|
![](templates/subSilver/images/spacer.gif) |
JV625
Joined: 25 Jun 2009 Posts: 16
|
|
Posted: Thu Jun 25, 2009 3:39 pm |
|
|
I don't see an option for "Debug Monitor" but I do see a "Echo on Monitor" which is set to true, as well as a "Monitor Font Size" which is set to 9. |
|
![](templates/subSilver/images/spacer.gif) |
JV625
Joined: 25 Jun 2009 Posts: 16
|
Update |
Posted: Mon Jun 29, 2009 10:49 am |
|
|
For anyone else who ever has the same problem:
It turns out that my "userstream enabled" option was set to false and that ended up causing this problem.
Thanks PCM and CCS! |
|
![](templates/subSilver/images/spacer.gif) |
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Tue Jun 30, 2009 7:04 am |
|
|
The user upstream can get set to false when the usb PC connection senses a fault and disconnects the USB ( this is especially true if you are driving the target with the usb 5v supply since the usb is protected against over drawing power). A reset of the USB PC port or a reboot of the PC may not always restore the ICD debugger to its original state if the original state of user upstream was true. It can come back as user upstream false
making you think the printf(debugger,...) is broken. User upstream is aka the debug monitor feed from printf(debugger,....) |
|
![](templates/subSilver/images/spacer.gif) |
|