View previous topic :: View next topic |
Author |
Message |
jamd
Joined: 22 Jan 2013 Posts: 4
|
Bit Debug on PIC24F16KA101 |
Posted: Fri Jun 17, 2022 9:57 am |
|
|
Hello,
Excuse my English, I'm French.
I wrote a program for a pic 24F16KA101.
With the following fuses:
Code: | Code:
#include <24F16KA101.h>
#FUSES NOWDT //Pas de Watch Dog
#FUSES CKSFSM
#FUSES NOWRT
#FUSES NOPROTECT
#FUSES NOWDT
#FUSES FRC
#FUSES NODEBUG
|
The program compiles very well.
But when I load it into Mplab-IPE, it tells me that the Debug bit is set, etc...and of course the PIC doesn't boot.
Yet when I look at the .HEX, the bits are set correctly.
Code: |
Configuration Words
F80000: FF00000F FF000000 FF000003 FF000080
F80008: FF00003F FF00004B FF0000F3 FF000042
F80010: FF0000FF
|
Word @F8000E (FICD): 0x42 when it should be 0x82
Bit 7 to 1 for nodebug
What's going on?
Thank's you |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Fri Jun 17, 2022 11:12 am |
|
|
Historically MPLAB, the default mode of the build is 'DEBUG' not 'RELEASE' mode.
I use version 8.92 (last one..)
In the main menu, select project, build configuration, release.
hope this is the fix !
Jay |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Jun 17, 2022 2:15 pm |
|
|
temtronic, he's using MPLAB X. Your post applies to MPLAB 8.
Regarding the debug bit problem, see this post:
http://www.ccsinfo.com/forum/viewtopic.php?t=59754
It was solved by setting the correct PIC device in MPLAB X. |
|
|
jamd
Joined: 22 Jan 2013 Posts: 4
|
|
Posted: Sat Jun 18, 2022 6:37 am |
|
|
Hello,
I wrote a mini program to test the configuration bits.
Code: |
#include <24F16KA101.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES CKSFSM //Clock Switching is enabled, fail Safe clock monitor is enabled
#FUSES NOWRT
#FUSES NOPROTECT
#FUSES NOBROWNOUT //No brownout reset
//#FUSES NODEBUG
//#device ICD=2
#use delay(internal=4000000)
#define retro PIN_B7 //rétroéclairage
void main()
{
set_tris_A(0b01000100);
set_tris_B(0b0000001100000000);
while(TRUE)
{
output_high(retro);
}
|
By default, without specifying (NO)DEBUG. Bits config is correct (ICSP1 & NoDebug). Copy file from .lst
Code: |
Configuration Fuses:
Word 1L: 000F NOWRTB NOBSS
H: 0000
Word 2L: 0000
H: 0000
Word 3L: 0003 NOWRT NOPROTECT
H: 0000
Word 4L: 0087 FRC_DIV IESO
H: 0000
Word 5L: 003F NOPR NOOSCIO POSCFREQ_H SOSC_HIGH CKSFSM
H: 0000
Word 6L: 005F WPOSTS16 WDT128 WINDIS NOWDT
H: 0000
Word 7L: 00F8 NOBROWNOUT PUT NOALTI2C1 BORV_LOW MCLR
H: 0000
Word 8L: 00C3 ICSP1 NODEBUG
H: 0000
Word 9L: 00FF DSWDT2147483648 DSWDTCK_LPRC RTCCK_SOSC DSBOR DSWDT
H: 0000
|
If I define the ICSP2 ports by #define ICD=2, The config is not good, even specifying NODEBUG.
Code: |
Configuration Fuses:
Word 1L: 000F NOWRTB NOBSS
H: 0000
Word 2L: 0000
H: 0000
Word 3L: 0003 NOWRT NOPROTECT
H: 0000
Word 4L: 0087 FRC_DIV IESO
H: 0000
Word 5L: 003F NOPR NOOSCIO POSCFREQ_H SOSC_HIGH CKSFSM
H: 0000
Word 6L: 005F WPOSTS16 WDT128 WINDIS NOWDT
H: 0000
Word 7L: 00F0 NOBROWNOUT NOPUT NOALTI2C1 BORV_LOW MCLR
H: 0000
Word 8L: 0042 ICSP2 DEBUG
H: 0000
Word 9L: 00FF DSWDT2147483648 DSWDTCK_LPRC RTCCK_SOSC DSBOR DSWDT
H: 0000
Some fuses have been forced to be compatible with the ICD debugger.
|
Strange!
Do you have an explanation? |
|
|
jamd
Joined: 22 Jan 2013 Posts: 4
|
|
Posted: Sat Jun 18, 2022 6:58 am |
|
|
I understood my error.
#device ICD=x is only to be used for debugging
Thank's |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19510
|
|
Posted: Sat Jun 18, 2022 10:00 am |
|
|
Yes.
The ICD=x syntax sets ICD=TRUE, and the port to be used.... |
|
|
|