Skip to content

Commit 4a1562b

Browse files
committed
Pull request #33: Feature/MCU16GITHUB-936 add an verifying led indicator
Merge in MCU16CE/dspic33-dsc-bootloader-code-examples from ~C12109/dspic33-dsc-bootloader-code-examples:feature/MCU16GITHUB-936-add-an-verifying-led-indicator to develop * commit 'cadccecf13a672894bf3a25bbf908798df61ab46': Slight improvements to README.md. Fixed issue where Chrome would not render the a, b, c ordered list correctly. Implement verification indication.
2 parents 450535a + cadccec commit 4a1562b

File tree

5 files changed

+85
-17
lines changed

5 files changed

+85
-17
lines changed

secure_boot_and_secure_firmware_upgrade_over_canfd/README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ The associated bootloader and application projects demonstrate the following:
8181
![Clean and Build](./images/clean_and_build.png)
8282
3. The project should compile cleanly. app.X/dist/default/production/app.X.production.hex should be generated
8383
4. Verify that LED11 is still solid
84-
a. If LED11 is blinking instead of solid, then the application code was programmed instead of only compiled. Go back to the “Programming the Bootloader” stage and re-program the bootloader
84+
1. If LED11 is blinking instead of solid, then the application code was programmed instead of only compiled. Go back to the “Programming the Bootloader” stage and re-program the bootloader
8585

8686
#### Loading the Application
8787
1. Open the Universal Bootloader Host Application tool (UBHA)<br>
@@ -93,25 +93,26 @@ The associated bootloader and application projects demonstrate the following:
9393
4. Select the “Settings->CAN” option from the top menu<br>
9494
![UBHA CAN Settings Dropdown](./images/UBHA_Settings_CAN_Dropdown.png)
9595
5. Select the Peak protocol analyzer being used and the appropriate CAN configuration settings for this demo (listed below). When complete, press “Apply”:
96-
a. Nominal Bit Rate: 125.00 kbits/s
97-
b. CAN-FD: enabled
98-
c. CAN-FD TX Data Length: 8
99-
d. Flexible Data Rate: Enabled
100-
e. Flexible Data Rate: 2Mbits/s
101-
f. Message Format: Standard
102-
g. Host to Device ID: 0xA1
103-
h. Device to Host ID: 0xA2<br>
96+
1. Nominal Bit Rate: 125.00 kbits/s
97+
2. CAN-FD: enabled
98+
3. CAN-FD TX Data Length: 8
99+
4. Flexible Data Rate: Enabled
100+
5. Flexible Data Rate: 2Mbits/s
101+
6. Message Format: Standard
102+
7. Host to Device ID: 0xA1
103+
8. Device to Host ID: 0xA2<br>
104104
![CAN Settings](./images/UBHA_CAN_Settings.png)
105105
6. Press the "Read Device Settings" button
106-
a. The Application start address and Application end address fields should have updated. If it did not or if you get a communication error, please go back to the “Programming the Bootloader” stage to make sure the bootloader was programmed correctly<br>
106+
1. The Application start address and Application end address fields should have updated. If it did not or if you get a communication error, please go back to the “Programming the Bootloader” stage to make sure the bootloader was programmed correctly<br>
107107
![Read Device Settings](./images/UBHA_Read_Device_Settings.png)
108108
7. Load the application hex file by selecting “File->Open/Load File (*.hex)”
109-
a. Select app.X/dist/default/production/app.X.production.hex. This is included with the demo but may have been re-generated if Building the Application (Optional) was completed<br>
109+
1. Select app.X/dist/default/production/app.X.production.hex. This is included with the demo but may have been re-generated if Building the Application (Optional) was completed<br>
110110
![Open Hex File](./images/UBHA_Open_Hex.png)
111111
8. Check the "Enable Self Verification After Program" checkbox<br>
112112
![Enable Verification](./images/UBHA_Enable_Verification.png)
113113
9. Press “Program Device”. The application should program erase, program and perform a self verify using the TA100 for an ECDSA verify then read back verify correctly.<br>**NOTE**: The reset response may not be fully transmitted before reset which may result in the reset response failing. The reset most likely did occur and the error can be safely ignored
114-
a. After a few seconds, LED11 should be blinking<br>
114+
1. During the verification process, LED6 will be solid to indicate the image is being verified.
115+
2. After the verification process is complete, LED6 will turn off. If the image was verified, it will start to run and LED11 should be blinking. If LED6 is still solid, the image failed verification and is still in bootload mode.<br>
115116
![Program Device](./images/UBHA_Program.png)
116117

117118
#### Re-Entering Bootloader Mode

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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ void BOOT_DEMO_Initialize(void)
7777

7878
}
7979

80+
static void VerifyingApplicationIndicator(bool verifying)
81+
{
82+
if(verifying)
83+
{
84+
IO_RE6_SetHigh(); //LED6 on
85+
}
86+
else
87+
{
88+
IO_RE6_SetLow(); //LED6 off
89+
}
90+
}
91+
8092
/*******************************************************************************
8193
* The check to see if you want to update or not is somewhat complex. Below
8294
* is a list of the conditions when an update is required:
@@ -182,12 +194,16 @@ void BOOT_DEMO_Tasks(void)
182194
}
183195
else
184196
{
197+
VerifyingApplicationIndicator(true);
198+
185199
UpdateFromDownload();
186200

187201
if( executionImageRequiresValidation == true )
188202
{
189203
executionImageValid = BOOT_ImageVerify(EXECUTION_IMAGE);
190204
}
205+
206+
VerifyingApplicationIndicator(false);
191207

192208
if(executionImageValid == false)
193209
{

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
@@ -196,6 +196,57 @@
196196
*/
197197
#define IO_RD15_SetDigitalOutput() (_TRISD15 = 0)
198198

199+
/**
200+
* @ingroup pinsdriver
201+
* @brief Sets the RE6 GPIO Pin which has a custom name of IO_RE6 to High
202+
* @pre The RE6 must be set as Output Pin
203+
* @param none
204+
* @return none
205+
*/
206+
#define IO_RE6_SetHigh() (_LATE6 = 1)
207+
208+
/**
209+
* @ingroup pinsdriver
210+
* @brief Sets the RE6 GPIO Pin which has a custom name of IO_RE6 to Low
211+
* @pre The RE6 must be set as Output Pin
212+
* @param none
213+
* @return none
214+
*/
215+
#define IO_RE6_SetLow() (_LATE6 = 0)
216+
217+
/**
218+
* @ingroup pinsdriver
219+
* @brief Toggles the RE6 GPIO Pin which has a custom name of IO_RE6
220+
* @pre The RE6 must be set as Output Pin
221+
* @param none
222+
* @return none
223+
*/
224+
#define IO_RE6_Toggle() (_LATE6 ^= 1)
225+
226+
/**
227+
* @ingroup pinsdriver
228+
* @brief Reads the value of the RE6 GPIO Pin which has a custom name of IO_RE6
229+
* @param none
230+
* @return none
231+
*/
232+
#define IO_RE6_GetValue() _RE6
233+
234+
/**
235+
* @ingroup pinsdriver
236+
* @brief Configures the RE6 GPIO Pin which has a custom name of IO_RE6 as Input
237+
* @param none
238+
* @return none
239+
*/
240+
#define IO_RE6_SetDigitalInput() (_TRISE6 = 1)
241+
242+
/**
243+
* @ingroup pinsdriver
244+
* @brief Configures the RE6 GPIO Pin which has a custom name of IO_RE6 as Output
245+
* @param none
246+
* @return none
247+
*/
248+
#define IO_RE6_SetDigitalOutput() (_TRISE6 = 0)
249+
199250
/**
200251
* @ingroup pinsdriver
201252
* @brief Sets the RE9 GPIO Pin which has a custom name of IO_RE9 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
@@ -62,7 +62,7 @@ void PINS_Initialize(void)
6262
TRISB = 0xFFFF;
6363
TRISC = 0x77FF;
6464
TRISD = 0x7FFF;
65-
TRISE = 0xBDFF;
65+
TRISE = 0xBDBF;
6666
TRISF = 0xFFFF;
6767

6868

0 commit comments

Comments
 (0)