Product Comparison: USB I2C | USB SPI | USB GPIO

USB PIC Bootloader. User Manual


5.5. CONFIG Registers - Code Protection

To prevent user application from unauthorized copying and to promote Bootloader fine performance it is recommended to set the following values of CONFIG registers. They enable the bootloader to perform all necessary operations with Flash memory, while denying access to external tools, e.g., programmers.

Table 5.1. Recommended CONFIG registers values

RegisterValueDescriptionStatus
0x300006.bit71Background DebugDisabled
0x3000080x08Code Protect 0x0800-0x1FFFEnabled
  Code Protect 0x2000-0x3FFFEnabled
  Code Protect 0x4000-0x5FFFEnabled
0x3000090x80Data EE Read ProtectDisabled
  Code Protect BootEnabled
0x30000A0x0FTable Write Protect 0x0800-0x1FFFDisabled
  Table Write Protect 0x2000-0x3FFFDisabled
  Table Write Protect 0x4000-0x5FFFDisabled
0x30000B0x80Data EE Write ProtectDisabled
  Table Write Protect BootEnabled
  Config Write ProtectEnabled
0x30000C0x0FTable Read Protect 0x0800-0x1FFFDisabled
  Table Read Protect 0x2000-0x3FFFDisabled
  Table Read Protect 0x4000-0x5FFFDisabled
0x30000D0x00Table Read Protect BootEnabled

In Bootloader code CONFIG registers are set in boot.asm file as following:

CONFIG  PLLDIV = 4           ; OSC/4 for 16MHz
CONFIG  CPUDIV = OSC1_PLL2   ; CPU_clk = PLL/2
CONFIG  USBDIV = 2           ; USB_clk = PLL/2
CONFIG  FOSC = HSPLL_HS      ; HS osc PLL
CONFIG  FCMEN = ON           ; Fail Safe Clock Monitor
CONFIG  IESO = OFF           ; Int/Ext switchover mode
CONFIG  PWRT = ON            ; PowerUp Timer
CONFIG  BOR = OFF            ; Brown Out
CONFIG  VREGEN = ON          ; Int Voltage Regulator
CONFIG  WDT = OFF            ; WatchDog Timer
CONFIG  MCLRE = ON           ; MCLR
CONFIG  LPT1OSC = OFF        ; Low Power OSC
CONFIG  PBADEN = ON          ; PORTB<4:0> A/D
CONFIG  CCP2MX = ON          ; CCP2 Mux RC1
CONFIG  STVREN = ON          ; Stack Overflow Reset
CONFIG  LVP = OFF            ; Low Voltage Programming
CONFIG  ICPRT = OFF          ; ICP
CONFIG  XINST = ON           ; Ext CPU Instruction Set
CONFIG  DEBUG = OFF          ; Background Debugging
CONFIG  CP0 = ON             ; Code Protect
CONFIG  CP1 = ON
CONFIG  CP2 = ON
CONFIG  CPB = ON             ; Boot Sect Code Protect
CONFIG  CPD = OFF            ; EEPROM Data Protect
CONFIG  WRT0 = OFF           ; Table Write Protect
CONFIG  WRT1 = OFF
CONFIG  WRT2 = OFF
CONFIG  WRTB = ON            ; Boot Table Write Protest
CONFIG  WRTC = ON            ; CONFIG Write Protect
CONFIG  WRTD = OFF           ; EEPROM Write Protect
CONFIG  EBTR0 = OFF          ; Ext Table Read Protect
CONFIG  EBTR1 = OFF
CONFIG  EBTR2 = OFF
CONFIG  EBTRB = ON           ; Boot Table Read Protect