The secure firmware download example "DownloadLibEx1" from LPC55S16 Host Software demonstrates how the user can update the PN7642 NXP secure firmware via the Host Interface. This post describes how to enable the download via UART.
Locate J68 on the PNEV7642A board. These 4 jumpers are the host interface connectors
(ATX_A, ATX_B, ATX_C, ATX_D). Take the jumpers off as we are going to directly connect to this pin-header.
EduardoZamora_0-1781124699804.png
| LPC55S16-EVK | PNEV7642A Eval Board | |||
| Pin | Signal (LPC) | Pin | Signal (PNEV) | |
| J12-14 | UART Tx | → | J68-2 | UART Rx |
| J12-16 | UART Rx | ← | J68-8 | UART Tx |
| JP12-17 | GND | ↔ | J47-6 | GND |
Note: In this case, please do not remove the jumpers of J45 and J20 on the PNEV7642A, we are going to attach the jumpers directly onto those headers.
EduardoZamora_0-1785967035261.png
Also, please remove the jumper on J25.
| IRQ | VEN | DWL_REQ | |
| LPC55S16-EVK | J13-1 | J12-12 | J13-3 |
| PNEV7642A | J45 | J20 | J25-2 |
In order to select the UART Host Interface in the PNEV7642A, we need to set the HIF switches (SW5-SW7) as indicated:
EduardoZamora_0-1784052280049.png
Prior to the following steps, please follow section 8 of the PN76 family evaluation board quick start guide.
To run the example in UART mode, first we need to compile the following libraries:
EduardoZamora_1-1784052475173.png
EduardoZamora_2-1784052493978.png
Please compile the main example the exact same way after this.
EduardoZamora_6-1784053460818.png
In the “lpc55S16Board_Init” function we need to add the following lines in order to enable one the ports and the clock for the USART of the Flexcomm2 peripheral.
EduardoZamora_8-1784053796090.png
GPIO_PortInit(GPIO, 1);
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM2);
In the “BOARD_InitPins” functions we need to add the following line to enable GPIO 1’s clock.
EduardoZamora_9-1784053928400.png
CLOCK_EnableClock(kCLOCK_Gpio1);
In this file we are going to include the following library:
EduardoZamora_10-1784054328036.png
#include "fsl_usart.h"
In the “phHdll_Lib_HalHwExchange” function we are going to add the following lines right after performing the UART transmission of the command.
EduardoZamora_11-1784054370469.png
while(USART2->FIFOSTAT & 0x40)
{
USART_ReadByte(USART2);
}
This is done to empty the RX FIFO of the UART before performing a reception, in order to prevent reading errors.
In the “USART_ReadBlocking” function please copy the line 625 and paste it again after clearing the reception flags.
EduardoZamora_12-1784054430177.png
This is done in order to avoid erroneous interpretation of the RX frame.
Lastly, we need to change the path of the ESFWU files to the local path where the files will be located. Please visit PN7642 Product Page, Software section to download the Firmware file.
EduardoZamora_13-1784054476381.png
Now we need to rebuild the main example, and we should be able to flash and debug after this.
EduardoZamora_0-1786041828193.png