Permalink
A Serial Bootloader for PIC24F Devices Author: Brant Ivey Microchip Technology Inc. FIGURE 1: BOOTLOADER FUNCTIONAL BLOCK DIAGRAM UxRX UxTX Bootloader Firmware INTRODUCTION One of the advantages of Microchip’s PIC® microcontrollers with self-programmable enhanced Flash memory is the ability to implement a bootloader. Necessary to run the bootloader first after a device Reset. Therefore, the device™s hardware Reset vector (addresses 000000h and 000002h) is used to store the bootloader™s Reset vector. If the bootloader™s Reset vector is ever overwritten, the device would no longer be able to enter Boot mode. For the bootloader to call the user. I loaded bootloader code using pickit3. Then, I used P24QP serial programmer software application to load Applicatio program. Doing this, I was able to detect my MCU device id. Microchip Technology PIC24F 16-Bit MCUs. Microchip Technology PIC24F 16-bit microcontrollers (MCUs) utilize two methods of programming: In-Circuit Serial Programming™ (ICSP™) and Enhanced In-Circuit Serial Programming (Enhanced ICSP).In addition, the PIC24F MCUs from Microchip Technology power their core digital logic at a nominal 1.8V and incorporate an on-chip regulator that allows the. Microchip's PIC24F Serial Bootloader Demo v1.04. This repository contains the files installed by 'Microchip PIC24F Serial Bootloader v1.04 Setup.exe'. USB Stack for Microchip PIC 16F. Fast PIC24 bootloader. PIC24F, and PIC32MX devices. Microchip has obviously made a conscious effort to make the register. A boot loader for Microchip PIC24FJ devices, initially targeting PIC24FJ256GB206 - krekeltronics/pic24-bootloader-firmware.
Download practicals of yantras pdf. 3/17/2014 Mantrik Yantras1/12 ArticlesHome ArticlesYanthra 1Result: All kinds of prosperity and relief from complex problemsYanthra 2Result: Enabling to influence others and to get respect from them Yanthra 3Result: Knowledge especially vedic knowledge is the gains Yanthra 4Result: Recovery from diseases, relief from fear and prosperity are the gains. Sankaracharya and SoundaryalahariThe genius played key role in propagating Vedanta philosophy and in revamping Arsha culture is undoubtedly Sree sankaracharya. 100 Yanthrasin Soundarya LahariSri.
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up Find file Copy path
Cannot retrieve contributors at this time
Pic18f Bootloader
Microchip Pic32 Bootloader
/******************************************************************** |
* |
* PIC24F Serial Bootloader Config |
* |
********************************************************************* |
* FileName: config.h |
* Dependencies: |
* Processor: PIC24F Family |
* Compiler: C30 v3.00 or later |
* Company: Microchip Technology, Inc. |
* |
* Software License Agreement: |
* |
* The software supplied herewith by Microchip Technology Incorporated |
* (the “Company”) for its PICmicro® Microcontroller is intended and |
* supplied to you, the Company’s customer, for use solely and |
* exclusively on Microchip PICmicro Microcontroller products. The |
* software is owned by the Company and/or its supplier, and is |
* protected under applicable copyright laws. All rights are reserved. |
* Any use in violation of the foregoing restrictions may subject the |
* user to criminal sanctions under applicable laws, as well as to |
* civil liability for the breach of the terms and conditions of this |
* license. |
* |
* THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES, |
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED |
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHOALL NT, |
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR |
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
* |
* |
* File Description: |
* |
* Configuration for PIC24F Serial Bootloader |
* |
* |
* Change History: |
* |
* Author Revision # Date Comment |
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
* Brant Ivey 1.00 1-17-2008 Initial release with AN1157 |
* Brant Ivey 1.01 4-09-2008 Added AES support |
* Brant Ivey 1.02 11-17-2008 Updated AES and 'K' device support |
* Added extra configuration options |
* Derek Baker(RedSlate) 17-10-2011 Added BootLoader Funtion prototype |
********************************************************************/ |
#ifndef CONFIG_H |
#defineCONFIG_H |
//Includes ************************************************************************* |
#include<p24fxxxx.h> |
#include'GenericTypeDefs.h' |
//********************************************************************************** |
//Configuration Defines ************************************************************ |
//Bootloader device configuration |
#defineDEV_HAS_WORD_WRITE//Device has word write capability (24FJxxx devices) |
#defineDEV_HAS_PPS//Device has Peripheral Pin Select (PPS) feature |
//#define DEV_HAS_CONFIG_BITS //Device has Configuration Bits |
//#define DEV_HAS_EEPROM //Device has internal data EEPROM |
#defineDEV_HAS_USB//Device is a USB capable device with a 96MHz PLL |
//Bootloader feature configuration |
#defineUSE_BOOT_PROTECT//Use BL block protection |
#defineUSE_RUNAWAY_PROTECT//Provide runaway code protection using program flow |
//#define USE_CONFIGWORD_PROTECT //Protect last page from writes/erases |
//#define USE_VECTOR_PROTECT //Use Reset and IVT protection |
//#define USE_HI_SPEED_BRG //Use BRGH=1, UART high speed mode |
//#define USE_WORKAROUNDS //UART workarounds for device errata |
//#define USE_AUTOBAUD //Use hardware autobaud feature |
//#define USE_AES //Use encryption |
//#define USE_RESET_SAVE //Restores the reset vector without using USE_BOOT_PROTECT |
//Bootloader Operation Configuration |
#defineMAJOR_VERSION0x01//Bootloader FW version |
#defineMINOR_VERSION0x02 |
#defineFCY16000000//Instruction clock speed (Fosc/2) |
#defineUARTNUM3//Which device UART to use |
#ifndef USE_AUTOBAUD |
#defineBAUDRATE9600 |
#endif |
#defineMAX_PACKET_SIZE261//Max packet size |
//USER_PROG_RESET should be the location of a pointer to the start of user code, |
//not the location of the first instruction of the user application. |
#defineUSER_PROG_RESET0x100//User app reset vector location |
#defineDELAY_TIME_ADDR0x102//BL entry delay location, 0x102 |
#defineBOOT_ADDR_LOW0x400//start of BL protection area |
#ifndef USE_AES |
#defineBOOT_ADDR_HI0x9FF//end of BL protection area |
#else |
#defineBOOT_ADDR_HI0x13FF//end of BL protection area ** USE 0x13FF for AES support |
#endif |
//If using encryption, set the AES encryption key |
#ifdef USE_AES |
#defineAES_KEY {0x0100,0x0302,0x0504,0x0706,0x0908,0x0B0A,0x0D0C,0x0F0E} |
#endif |
//If using RPx pins multiplexed with ANx functions, uncomment these lines to configure AD1PCFG |
//#define UTX_ANA AD1PCFGbits.PCFG2 |
//#define URX_ANA AD1PCFGbits.PCFG4 |
//Define UART pins for PPS devices, by default Explorer 16 settings are used |
#ifdef DEV_HAS_PPS |
#if defined(__PIC24FJ64GA004__) |
#definePPS_UTX_PIN RPOR12bits.RP25R //UART TX pin |
#definePPS_URX_PIN19//UART RX pin |
#definePPS_URX_REG RPINR19bits.U2RXR |
#elif defined(__PIC24FJ64GB004__) |
#definePPS_UTX_PIN RPOR9bits.RP19R //UART TX pin,pin RP19 (Pin 36) |
#definePPS_URX_PIN21//UART RX pin,pin RP21 (Pin 38) |
#definePPS_URX_REG RPINR19bits.U2RXR |
#elif defined(__PIC24FJ256GB206__) |
#definePPS_UTX_PIN RPOR14bits.RP29R //UART TX pin,pin RP14 (Pin 29) |
#definePPS_URX_PIN30// ?? UART RX pin,pin RP21 (Pin 38) |
#definePPS_URX_REG RPINR17bits.U3RXR |
// OUT_FN_PPS_U3TX 28 /* RPn tied to UART3 Transmit */ |
// IN_FN_PPS_U3RX RPINR17bits.U3RXR |
#elif (defined(__PIC24FJ256GB110__) || defined(__PIC24FJ256GA110__)) |
#definePPS_UTX_PIN RPOR8bits.RP17R //UART TX pin |
#definePPS_URX_PIN10//UART RX pin |
#definePPS_URX_REG RPINR19bits.U2RXR |
#endif |
#endif |
//Device Flash Memory Configuration |
//Size of flash memory sections in bytes |
//includes upper phantom byte (32-bit wide memory) |
#if defined(__PIC24F__) //PIC24F 'J' type devices |
#definePM_INSTR_SIZE4//bytes per instruction |
#definePM_ROW_SIZE256//user flash row size in bytes |
#definePM_PAGE_SIZE2048//user flash page size in bytes |
#elif defined(__PIC24FK__) //PIC24F 'K' type devices |
#definePM_INSTR_SIZE4//bytes per instruction |
#definePM_ROW_SIZE128//user flash row size in bytes |
#definePM_PAGE_SIZE128//user flash page size in bytes |
#endif |
//Vector section is either 0 to 0x200 or 0 to end of first page, whichever is larger |
#defineVECTOR_SECTION ((0x200>(PM_PAGE_SIZE/2))?0x200:(PM_PAGE_SIZE/2)) |
#ifdef DEV_HAS_CONFIG_BITS |
#defineCM_ROW_SIZE1//configuration row size in bytes |
#endif |
#if defined(__PIC24FJ128GA010__) |
#defineCONFIG_START0x157FC//Flash config word locations for devices |
#defineCONFIG_END0x157FE//w/o config bits |
#elif (defined(__PIC24FJ256GB110__)|| |
defined(__PIC24FJ256GA110__)) |
#define CONFIG_START 0x2ABFA |
#defineCONFIG_END0x2ABFE |
#elif defined(__PIC24FJ64GA004__) |
#defineCONFIG_START0xABFC |
#defineCONFIG_END0xABFE |
#elif defined(__PIC24FJ64GB004__) |
#defineCONFIG_START0xABF8 |
#defineCONFIG_END0xABFE |
#elif defined(__PIC24FJ256GB206__) |
#defineCONFIG_START0x02ABF8 |
#defineCONFIG_END0x02ABFE |
#elif defined(__PIC24F16KA102__) |
#defineCONFIG_START0xF80000 |
#defineCONFIG_END0xF80010 |
#else |
#warning 'No config location defined.. using default config locations' |
#defineCONFIG_START0x157FC |
#defineCONFIG_END0x157FE |
#endif |
//Self-write NVMCON opcodes |
#if defined(__PIC24F__) //PIC24F 'J' type devices |
#definePM_PAGE_ERASE0x4042//NVM page erase opcode |
#definePM_ROW_WRITE0x4001//NVM row write opcode |
#elif defined(__PIC24FK__) //PIC24F 'K' type devices |
#definePM_PAGE_ERASE0x4058//NVM page erase opcode |
#definePM_ROW_WRITE0x4004//NVM row write opcode |
#endif |
#ifdef DEV_HAS_WORD_WRITE |
#definePM_WORD_WRITE0x4003//NVM word write opcode |
#endif |
#ifdef DEV_HAS_EEPROM |
#defineEE_WORD_WRITE0x4004//EE word write opcode |
#defineEE_ROW_WRITE0x4006//EE row write opcode |
#endif |
#ifdef DEV_HAS_CONFIG_BITS |
#defineCONFIG_WORD_WRITE0x4004//Config memory write opcode |
#endif |
//********************************************************************************** |
//UART Baud Rate Calculation ******************************************************* |
#ifndef USE_AUTOBAUD |
#ifdef USE_HI_SPEED_BRG |
#defineBRG_DIV4 |
#else |
#defineBRG_DIV16 |
#endif |
#defineBAUDRATEREG ((FCY + (BRG_DIV/2*BAUDRATE))/BRG_DIV/BAUDRATE-1) |
#defineBAUD_ACTUAL (FCY/BRG_DIV/(BAUDRATEREG+1)) |
#defineBAUD_ERROR ((BAUD_ACTUAL > BAUDRATE) ? BAUD_ACTUAL-BAUDRATE : BAUDRATE-BAUD_ACTUAL) |
#defineBAUD_ERROR_PRECENT ((BAUD_ERROR*100+BAUDRATE/2)/BAUDRATE) |
#if (BAUD_ERROR_PRECENT > 3) |
#error 'UART frequency error is worse than 3%' |
#elif (BAUD_ERROR_PRECENT > 2) |
#warning 'UART frequency error is worse than 2%' |
#endif |
#endif |
//********************************************************************************** |
//Constant Defines ***************************************************************** |
//Protocol Commands |
#defineRD_VER0x00 |
#defineRD_FLASH0x01 |
#defineWT_FLASH0x02 |
#defineER_FLASH0x03 |
#defineRD_EEDATA0x04 |
#defineWT_EEDATA0x05 |
#defineRD_CONFIG0x06 |
#defineWT_CONFIG0x07 |
#defineVERIFY_OK0x08 |
//Communications Control bytes |
#defineSTX0x55 |
#defineETX0x04 |
#defineDLE0x05 |
//********************************************************************************** |
//Support for PIC24F PPS *********************************************************** |
#ifdef DEV_HAS_PPS |
//PPS Outputs |
#defineNULL_IO0 |
#defineU1TX_IO3 |
#defineU1RTS_IO4 |
#defineU2TX_IO5 |
#defineU2RTS_IO6 |
#defineU3TX_IO7 |
#defineU3RTS_IO8 |
#defineU4TX_IO9 |
#defineU4RTS_IO10 |
externvoidioMap(); |
#endif |
//********************************************************************************** |
//UART Configuration *************************************************************** |
#defineUARTREG2(a,b) U##a##b |
#defineUARTREG(a,b) UARTREG2(a,b) |
#defineUxMODEUARTREG(UARTNUM,MODE) |
#defineUxBRGUARTREG(UARTNUM,BRG) |
#defineUxSTAUARTREG(UARTNUM,STA) |
#defineUxRXREGUARTREG(UARTNUM,RXREG) |
#defineUxTXREGUARTREG(UARTNUM,TXREG) |
#defineUxMODEbitsUARTREG(UARTNUM,MODEbits) |
#defineUxSTAbitsUARTREG(UARTNUM,STAbits) |
#ifdef DEV_HAS_PPS |
#defineUxTX_IOUARTREG(UARTNUM,TX_IO) |
#endif |
//********************************************************************************** |
//Function Prototypes ************************************************************** |
voidBootLoader(void); |
voidPutChar(BYTE); |
voidGetChar(BYTE *); |
voidReadPM(WORD, DWORD_VAL); |
voidWritePM(WORD, DWORD_VAL); |
voidErasePM(WORD, DWORD_VAL); |
voidWriteTimeout(); |
voidGetCommand(); |
voidHandleCommand(); |
voidPutResponse(WORD); |
voidAutoBaud(); |
#if defined(USE_BOOT_PROTECT) || defined(USE_RESET_SAVE) |
voidreplaceBLReset(DWORD_VAL); |
#endif |
//********************************************************************************** |
//Configuration Check ************************************************************** |
#if ((defined(DEV_HAS_WORD_WRITE) && defined(DEV_HAS_CONFIG_BITS)) || |
(defined(DEV_HAS_WORD_WRITE) && defined(DEV_HAS_EEPROM))) |
#warning 'No devices support configured feature set.' |
#endif |
//********************************************************************************** |
#endif//ifdef CONFIG_H |
Microchip Pic24f Serial Boot Loader Parts
Copy lines Copy permalink