CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Debug Printf Mysteriously Stopped Working

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JV625
Guest







Debug Printf Mysteriously Stopped Working
PostPosted: Thu Jun 25, 2009 10:23 am     Reply with quote

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)
JV625
Guest







P.S.
PostPosted: Thu Jun 25, 2009 10:28 am     Reply with quote

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.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 25, 2009 11:29 am     Reply with quote

Post your compiler version.
JV625



Joined: 25 Jun 2009
Posts: 16

View user's profile Send private message

Compiler Version
PostPosted: Thu Jun 25, 2009 11:51 am     Reply with quote

Compiler version 4.066 with ICD V2.89
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 25, 2009 12:57 pm     Reply with quote

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.
JV625



Joined: 25 Jun 2009
Posts: 16

View user's profile Send private message

PostPosted: Thu Jun 25, 2009 2:43 pm     Reply with quote

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?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 25, 2009 2:47 pm     Reply with quote

Look in the Configure menu and see if the Debug Monitor is enabled.
JV625



Joined: 25 Jun 2009
Posts: 16

View user's profile Send private message

PostPosted: Thu Jun 25, 2009 3:39 pm     Reply with quote

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.
JV625



Joined: 25 Jun 2009
Posts: 16

View user's profile Send private message

Update
PostPosted: Mon Jun 29, 2009 10:49 am     Reply with quote

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!
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Tue Jun 30, 2009 7:04 am     Reply with quote

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,....)
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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