View previous topic :: View next topic |
Author |
Message |
allenhuffman
Joined: 17 Jun 2019 Posts: 602 Location: Des Moines, Iowa, USA
|
[Partially SOLVED] debug printf via the ICD-U80 debugger |
Posted: Mon Jun 17, 2019 8:37 am |
|
|
I have been looking through the docs to see if there is any provision to get some kind of printf-style debugging output via the ICD-U80 debugger I have. My search skills have come up short, so I thought I'd ask here. My end-hardware will not have UART available to me.
Thanks…
Last edited by allenhuffman on Fri Jul 05, 2019 1:56 pm; edited 2 times in total |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Mon Jun 17, 2019 9:28 am |
|
|
There is a thing with #use RS232 macro that allows you to select the ICD as an option rather than specifying pins or a UART module |
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 602 Location: Des Moines, Iowa, USA
|
|
Posted: Mon Jun 17, 2019 9:39 am |
|
|
dluu13 wrote: | There is a thing with #use RS232 macro that allows you to select the ICD as an option rather than specifying pins or a UART module |
That is what I have been trying to get going. I am using an Explorer 16 board, and trying to figure out what PIN I need to assign to make this work. I have not had much luck looking through the Explorer PDF, the CCS help files, or searching this forum.
I see things like this:
Code: | #use rs232(DEBUGGER, stream=STREAM_MONITOR, xmit=PIN_B3, rcv=PIN_B3) |
And found a few examples, saying to use this stream:
Code: | fprintf( STREAM_MONITOR, "Count: %d\n", count ); |
Perhaps I am just needing to figure out the PIN. The schematics were not helpful to me. Usually, on Arduino type projects, I can find the answers online easily. Maybe I'm the only one who needs debug output ;-) |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Mon Jun 17, 2019 9:46 am |
|
|
Honestly I have not used it either, since I am always fortunate enough to have a couple of spare pins to configure as UART for debug purposes. I have just noticed that it is an option. Besides the DEBUGGER option, there is also the ICD option. So, perhaps you can try that one as opposed to DEBUGGER.
However, there are some extremely experienced users on this forum and I am sure one of them will know how to correctly configure this.
In the meantime, how are you hooking it up? Seeing a schematic of your setup can quickly confirm or rule out any errors in your hardware. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 602 Location: Des Moines, Iowa, USA
|
|
Posted: Mon Jun 17, 2019 10:12 am |
|
|
Thanks. I feel like I'm just missing something very simple. There is "DEBUGGER" (which seems to need the two pins, B6 and B7 match) and "ICD" (one-wire, B3). No combinations have produced any output for me, yet.
I figured out how to make the LCD panel work, but it's not great for lots of output |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 602 Location: Des Moines, Iowa, USA
|
|
Posted: Mon Jun 17, 2019 11:54 am |
|
|
Thanks. Unfortunately, no luck there. I have a "#use RS232" line setup and have tried various pins, I have Monitor enabled set to True, etc. I'm expecting it's just not getting configured for the proper pin(s) for the Explorer 16 board. I'm just having trouble finding docs. I've looked at the board schematics and it sure looks like I want B6 and B7, though I have also tried the default of B3 (which I don't think it hooked to the debug port on Explorer 16). |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 17, 2019 12:28 pm |
|
|
You definitely don't want B6 and B7 for the serial monitor function.
Those are normally the ICSP pins. They're used by the ICD to talk to the
PIC. This is a completely different function than the serial monitor output
from the PIC.
You should tell us what your PIC is. |
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 602 Location: Des Moines, Iowa, USA
|
|
Posted: Mon Jun 17, 2019 12:30 pm |
|
|
PCM programmer wrote: | You definitely don't want B6 and B7 for the serial monitor function.
Those are normally the ICSP pins. They're used by the ICD to talk to the
PIC. This is a completely different function than the serial monitor output
from the PIC.
You should tell us what your PIC is. |
Now you see my confusion. I have found examples here that show using B6/B7... Perhaps that's the difference in using the one-wire (B3) mode verses the other (ICD versus DEBUGGER?). None of the examples I have found work for me, yet. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 17, 2019 12:57 pm |
|
|
1. What is your PIC ?
2. What PIM module are you using for the Explorer 16 ? |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1362
|
|
Posted: Tue Jun 18, 2019 6:47 am |
|
|
For printf functionality you do not need B3. You do need the IDE and the following line
Code: |
#use rs232(ICD,DISABLE_INTS, stream=DBG)
|
Stream name can be anything or even left out. When you program or run the code it will auto load the SIOW terminal.
Note that printing this way is sometimes buggy.
We use this all the time for our projects |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jun 18, 2019 7:00 am |
|
|
I always thought CCS defaulted to using pin B3. But your code
defaults to using pin B7. I guess this is something new for CCS ?
Part of .LST file, showing a soft UART on Pin B7:
Code: | .................... #use rs232(ICD,DISABLE_INTS, stream=DBG)
00032: MOVFF INTCON,03
00036: BCF INTCON.GIEH
00038: BCF TRISB.7
0003A: BCF LATB.7
0003C: MOVLW 08 // 8 bits
0003E: MOVWF @01
00040: BRA 0042
00042: NOP
00044: BSF 01.7
00046: BRA 006C
00048:
|
Test program:
Code: | #include <18F46K22.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOPBADEN
#use delay(clock=4M)
#use rs232(ICD,DISABLE_INTS, stream=DBG)
//======================================
void main()
{
fprintf(DBG, 0x55);
while(TRUE);
}
|
Tested with PCH vs. 5.085. |
|
|
jeremiah
Joined: 20 Jul 2010 Posts: 1362
|
|
Posted: Tue Jun 18, 2019 7:17 am |
|
|
It is fairly new. .last 4-5 years maybe? It appears to use telnet under the hood if you look at the SIOW config. It also tends to be a bit skittish but is ok for quick stuff |
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 602 Location: Des Moines, Iowa, USA
|
|
Posted: Tue Jun 18, 2019 8:23 am |
|
|
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! |
|
|
|