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 support@ccsinfo.com

[Partially SOLVED] debug printf via the ICD-U80 debugger
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
allenhuffman



Joined: 17 Jun 2019
Posts: 537
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Tue Jun 18, 2019 8:34 am     Reply with quote

PCM programmer wrote:
1. What is your PIC ?

2. What PIM module are you using for the Explorer 16 ?


PIC24FJ256GA110 is what I have plugged in to the Explorer 16 at the moment. We have several modules, but this was the closest match to the module I will be developing for.

I am using the ICD-U80 debugger.
jeremiah



Joined: 20 Jul 2010
Posts: 1314

View user's profile Send private message

PostPosted: Tue Jun 18, 2019 10:41 am     Reply with quote

allenhuffman wrote:
PCM programmer wrote:
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOPBADEN


Various feedback here and other places claims this is "sometimes buggy," so maybe that is what I am running into.

The #fuses line I have is whatever default the PIC24 Wizard created. I did try using the:

Code:
#use rs232(ICD, DISABLE_INTS, stream=DBG)


…example that you and Jerimiah suggested, but I got no output on my PIC24FJ256GA110 board. I also checked that #fuses line, but NOPBADEN doesn't exist for me (or that header file, for my hardware config).

But, I now am fairly confident I am doing it correctly -- it's just not working for me. Maybe some Debug option I have misconfigured (the only thing I have done is toggle the Monitor one to true, so maybe I need to do others).

Thanks, much!


Note that this is not related to debug at all. I run this purely in release with NODEBUG fuse set.

Are you running it from PCWHD? Just cycling power may not work

Also you need to tell the compiler which programming port you are using
Code:

#device ICSP=2


For example. Choose the number that your dev kit uses
allenhuffman



Joined: 17 Jun 2019
Posts: 537
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Tue Jun 18, 2019 11:11 am     Reply with quote

jeremiah wrote:

Are you running it from PCWHD? Just cycling power may not work

Also you need to tell the compiler which programming port you are using
Code:

#device ICSP=2


For example. Choose the number that your dev kit uses


Thanks. I am able to debug just fine (breakpoints, etc.) -- ICSP=2 for me.

The compiler we use is the PCDIDE Compiler.
allenhuffman



Joined: 17 Jun 2019
Posts: 537
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Jul 05, 2019 12:22 pm     Reply with quote

From another topic:

PCM programmer wrote:
CCS Data Streaming Video Tutorial:
https://www.youtube.com/watch?v=EnSazS39MeA


Just using

#use rs232(ICD)

...then doing normal printf() in the code, then "BUILD AND RUN" will launch a serial terminal that works.

I have yet to figure out how to get that output when in the Debugger, though, but this is at least something.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
allenhuffman



Joined: 17 Jun 2019
Posts: 537
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Jul 05, 2019 2:08 pm     Reply with quote

The remaining issue now is how to get this same thing to work when debugging -- not just running.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 05, 2019 7:01 pm     Reply with quote

It defaults to using the ICSP pins for serial communication.
A typical example of ICSP pins would be B6 and B7.
But in Debug mode, the ICD will be using those pins to
communicate with the Debug hardware module in the PIC.
So that's probably why it doesn't work.

There used to be a method of using Pin B3 to send printf
messages to the console in the CCS IDE. This would seem
like the ideal method to use in Debug mode. I don't have
the CCS IDE or their ICD-Uxx debugger, so I can't test it.
jeremiah



Joined: 20 Jul 2010
Posts: 1314

View user's profile Send private message

PostPosted: Fri Jul 05, 2019 7:39 pm     Reply with quote

allenhuffman wrote:
From another topic:

PCM programmer wrote:
CCS Data Streaming Video Tutorial:
https://www.youtube.com/watch?v=EnSazS39MeA


Just using

#use rs232(ICD)

...then doing normal printf() in the code, then "BUILD AND RUN" will launch a serial terminal that works.

I have yet to figure out how to get that output when in the Debugger, though, but this is at least something.


If you have any interrupts, you want
Code:
#use rs232(ICD,DISABLE_INTS)

at a minimum. It's a software serial port, so interrupts can mess with it.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 05, 2019 10:52 pm     Reply with quote

Here is a website that has an example of using the built-in monitor of
the CCS IDE to view printf messages. He is using CCS vs. 5.051:
https://simple-circuit.com/pic16f887-mmc-sd-interfacing-ccs-c/

Scroll down to the bottom. You'll see a screenshot of a black screen
with messages on it. Look at the top message. It says:
Quote:
*** Interfacing PIC16F887 MCU with SD card ***

Then, look at his source code, in the screenshot above that.
He has a printf statement:
Code:
  printf("*** Interfacing PIC16F887 MCU with SD card ***");

Then above that line, he defines a software UART.
Code:
#use rs232(xmit = PIN_D2, rcv = PIN_D1, baud = 9600)

If you're using interrupts, you need to add DISABLE_INTS to that.
If you used a hardware UART, you wouldn't have to disable interrupts.

His schematic shows he's really only using the Xmit on pin D2.
It goes to a MAX232 chip and then to the PC's serial port connector.
This presumably comes in on COM1 or COM2 to the PC. Or some other
COM port if you're using a USB-COMport adapter.

He has has video here, which shows how to setup the CCS serial monitor
inside the IDE:
https://www.youtube.com/watch?v=ldN8GiTAgS8
allenhuffman



Joined: 17 Jun 2019
Posts: 537
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Tue Jul 09, 2019 8:59 am     Reply with quote

Our custom hardware doesn't provide a connection for that pin on the debugger.

From looking at schematics to the Explorer 16, it did, but I never got it working. Various responses say it is flaky, so I've given up for now. When I get a PIC setup to play with at home, I'll revisit.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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