Skip to content

Commit a7eef56

Browse files
aiwyatt787davidflowers
authored andcommitted
Pull request #25: Add S1 for reentry into the bootloader
Merge in MCU16CE/dspic33-dsc-bootloader-code-examples from ~C74569/dspic33-dsc-bootloader-code-examples:feature/MCU16GITHUB-933-add-button-re-entry-into-bootloader to develop * commit 'e27ae0a7543e80fd57bb4eff03cc5f27dc15afb8': Center arrow in image and remove white spaces in Readme Add S1 for reentry into the bootloader
2 parents 17946c6 + e27ae0a commit a7eef56

File tree

6 files changed

+66
-6
lines changed

6 files changed

+66
-6
lines changed

secure_boot_and_secure_firmware_upgrade_over_canfd/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ The associated bootloader and application projects demonstrate the following:
113113
a. After a few seconds, LED11 should be blinking<br>
114114
![Program Device](./images/UBHA_Program.png)
115115

116+
#### Re-Entering Bootloader Mode
117+
1. Power off the board by unplugging the micro-USB cable from port J1
118+
2. While the board is powered off, hold down switch S1<br>
119+
![S1](./images/switch_location.png)
120+
3. Continue holding down S1 and plug the micro-USB cable back into port J1
121+
4. Once the board is powered back on, release S1
122+
5. Verify LED11 is solid, indicating the device is in bootloader mode. The application can now be loaded once again (see Loading the Application)
123+
116124
## Trademarks
117125

118126
MPLAB® is a registered trademark of Microchip Technology Inc. All other trademarks are the property of their respective owner.

secure_boot_and_secure_firmware_upgrade_over_canfd/boot.X/boot.mc3

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

secure_boot_and_secure_firmware_upgrade_over_canfd/boot.X/mcc_generated_files/boot/boot_demo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Copyright (c) [2012-2024] Microchip Technology Inc.
6060
#include "boot_application_header.h"
6161
#include "boot_image.h"
6262
#include "boot_process.h"
63+
#include "../mcc_generated_files/system/pins.h"
6364
#include "../mcc_generated_files/timer/mccp9.h"
6465

6566
#define DOWNLOADED_IMAGE 1u
@@ -216,5 +217,5 @@ static bool EnterBootloadMode(void)
216217
/* NOTE: This might be a a push button status on power up, a command from a peripheral,
217218
* or whatever is specific to your boot loader implementation */
218219

219-
return false;
220+
return (IO_RD13_GetValue()==0);
220221
}

secure_boot_and_secure_firmware_upgrade_over_canfd/boot.X/mcc_generated_files/system/pins.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,57 @@
9494
*/
9595
#define IO_RA6_SetDigitalOutput() (_TRISA6 = 0)
9696

97+
/**
98+
* @ingroup pinsdriver
99+
* @brief Sets the RD13 GPIO Pin which has a custom name of IO_RD13 to High
100+
* @pre The RD13 must be set as Output Pin
101+
* @param none
102+
* @return none
103+
*/
104+
#define IO_RD13_SetHigh() (_LATD13 = 1)
105+
106+
/**
107+
* @ingroup pinsdriver
108+
* @brief Sets the RD13 GPIO Pin which has a custom name of IO_RD13 to Low
109+
* @pre The RD13 must be set as Output Pin
110+
* @param none
111+
* @return none
112+
*/
113+
#define IO_RD13_SetLow() (_LATD13 = 0)
114+
115+
/**
116+
* @ingroup pinsdriver
117+
* @brief Toggles the RD13 GPIO Pin which has a custom name of IO_RD13
118+
* @pre The RD13 must be set as Output Pin
119+
* @param none
120+
* @return none
121+
*/
122+
#define IO_RD13_Toggle() (_LATD13 ^= 1)
123+
124+
/**
125+
* @ingroup pinsdriver
126+
* @brief Reads the value of the RD13 GPIO Pin which has a custom name of IO_RD13
127+
* @param none
128+
* @return none
129+
*/
130+
#define IO_RD13_GetValue() _RD13
131+
132+
/**
133+
* @ingroup pinsdriver
134+
* @brief Configures the RD13 GPIO Pin which has a custom name of IO_RD13 as Input
135+
* @param none
136+
* @return none
137+
*/
138+
#define IO_RD13_SetDigitalInput() (_TRISD13 = 1)
139+
140+
/**
141+
* @ingroup pinsdriver
142+
* @brief Configures the RD13 GPIO Pin which has a custom name of IO_RD13 as Output
143+
* @param none
144+
* @return none
145+
*/
146+
#define IO_RD13_SetDigitalOutput() (_TRISD13 = 0)
147+
97148
/**
98149
* @ingroup pinsdriver
99150
* @brief Sets the RD15 GPIO Pin which has a custom name of IO_RD15 to High

secure_boot_and_secure_firmware_upgrade_over_canfd/boot.X/mcc_generated_files/system/src/pins.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void PINS_Initialize(void)
100100
ANSELA = 0x001F;
101101
ANSELB = 0x039E;
102102
ANSELC = 0x00CF;
103-
ANSELD = 0x2C00;
103+
ANSELD = 0x0C00;
104104
ANSELE = 0x000F;
105105
ANSELF = 0x03C0;
106106

3.61 MB
Loading

0 commit comments

Comments
 (0)