Usb pic18f4550 :: Bootloader details

USB PIC Bootloader

 Bootloader kit

USB PIC Bootloader is a resident bootloader for PIC18 series of Enhanced Flash USB Microcontrollers. It allows you to program application hex into the chip using the standard USB connectivity of your device.

USB PIC Bootloader code is write-protected and cannot be overwritten by firmware.

Firmware update or user mode is selected by SW and/or HW switch.

USB PIC Bootloader is a program that stays in the first 8191 bytes of the program memory of the Microchip PIC Microcontroller. Bootloader runs at the boot time (when the processor has just been reset) and is capable of loading a complete application program into a processors memory. With the USB PIC Bootloader loaded, there are two distinct modes of operation:

firmware update mode and Application mode.

USB PIC Bootloader uses the EEPROM mark and/or hardware switch to determine which mode to run in.

Firmware Update Mode.

In firmware update mode USB PIC Bootloader utilizes USB connection of Microchip PIC Microcontroller to communicate with PC and load the new application code. Once the programming is done, the USB PIC Bootloader switches to Application mode, the processor is reset and begins running the newly loaded code.

Application mode.

In Application mode USB PIC Bootloader simply remap reset and interrupt vectors to user mode firmware application.


Features

1. Easy connect to Laptop as well as Desktop PCs through USB Port to downloading your hex file

2. Built-in MAX232 interface circuit for easy communication with a computer and other serial devices (GPS modules, GSM Modems, etc).

3. On board Buzzer.

4. Comes with two BC547which can be used to drive relays.

5. On board 16x2 LCD with brightness control for LCD.

6. 4 Digit Segment Multiplexed Display.

7. 8 LED array.

8. I2C serial EEPROM and Real Time Clock.

9. 4*4 matrix keyboard.

10. Port extensions for all ports.

Included Material

# 12V DC Adaptor

# 20 No's Burg wire - Female to Female

# USB Port Cable

# The included CD contains tutorials to get started, sample codes, demo projects, BootSoft Software and USB driver.


Contact : shop.romux@gmail.com


Bootloader Modification for Microchip ASM compiler

/*  SOURCE : WWW.ROMUX.COM
    AUTHOR : romux team     */ 
    
    
	processor PIC18F4550
	#include"p18f4550.inc"

	org 0x2000
	goto init
	org 0x2020
	goto int_isr

init
	...               ; initialization
loop
        ...               ; code
	goto loop	


int_isr
        ...               ; interrupt code
	retfie
	end

Bootloader Modification for Microchip C18 compiler

For Bootloader you need to rebuild and use linker file : Bootloader18F.lkr

step 1 : find mcc18/src/traditional/startup/c018i.c

step 2 : edit the files and search "#pragma code _entry_scn=0x000000" modify as "#pragma code _entry_scn=0x002000"

Step 3 : edit the same for c018.c file also

step 4 : Build

Example Format

/*  SOURCE : WWW.ROMUX.COM
    AUTHOR : romux team     */ 
    
    
#include "p18F4550.h"

void low_isr(void);
void high_isr(void);

#pragma code low_vector=0x2018
void interrupt_at_low_vector(void)
{
  _asm GOTO low_isr _endasm
}
#pragma code 

#pragma code high_vector=0x2008
void interrupt_at_high_vector(void)
{
  _asm GOTO high_isr _endasm
}
#pragma code 

#pragma interruptlow low_isr
void low_isr (void)
{
  
 return;
}

#pragma interrupt high_isr
void high_isr (void)
{
 return;
}

void main( void )
{
     ...;
 }

MikroC

Example Format for Bootloader

/*  SOURCE : WWW.ROMUX.COM
    AUTHOR : romux team     */ 
    
    
#pragma orgall 0x2000
void interrupt(void) org 0x2008
{
;
}
void interrupt_low(void) org 0x2018
{
;
}
void main()
{
  ......;
}

Hi-Tech C Compiler

step1:goto Build option

step2:linker tap

step3:set offset : 2000

CCS C Compiler

Example format

/*  SOURCE : WWW.ROMUX.COM
    AUTHOR : romux team     */ 
    
    

#include "18F4550.h"
#use delay(clock = 48000000)

#define LOADER_SIZE        (0x1FFF)
#define LOADER_START       (0)
#define LOADER_END         (LOADER_SIZE)
#define APPLICATION_START  (LOADER_SIZE+1)
#define APPLICATION_END    (getenv("PROGRAM_MEMORY")-1)
#define APPLICATION_ISR    (APPLICATION_START+8)

#build(reset=APPLICATION_START, interrupt=APPLICATION_ISR)
#org 0, LOADER_END {}

#use delay(clock=48000000)

#int_default
void isr() 
{ 
;
}

void main(void) 
{
...;
}








anonymous   said:
4 years ago

Hi there, can I know if i just include the given codes up there as well as my main program, is it sufficient to tell my microcontroller to load the code via the USB port?

Points :   0


migqc82   said:
6 years ago

Hi there , I am trying to follow this example to get running my TIERTEX TDSDB14550 board (PIC18F4550)
I follow all the steps mentioned on the C18 section (aboved) and not luck, here is my code :

#include <p18cxxx.h>
#include <delays.h>



//-------------PIC18F4550 configuration bits on Code--------------------------
#pragma config PLLDIV = 5 // 20 MHz crystal on board
#pragma config CPUDIV = OSC1_PLL2 // PPL Rate divided by 2 = 48MHz
#pragma config USBDIV = 2 // Clock source from 96MHz PLL/2
#pragma config FOSC = HSPLL_HS // Oscillator Selection
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor
#pragma config IESO = OFF // Internal/External Osc Switchover
#pragma config PWRT = OFF // Power up timer
#pragma config BOR = OFF // Brown out reset
#pragma config BORV = 1 // Brown out voltage

|
Points :   0




Post Your Comments Here :
 


User Login

Username :


Password :