PN7642 - LPC55S16 DownloadLibEx1 over UART

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

PN7642 - LPC55S16 DownloadLibEx1 over UART

PN7642 - LPC55S16 DownloadLibEx1 over UART

Introduction

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.

Resources needed to follow this guide

Hardware Connections

On the PN7642 there are various shifters and multiplexers in between the host and the
actual PN7642 inputs. In order to bypass them quickly, we will interconnect the boards as follows.

UART Tx and Rx:

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.pngEduardoZamora_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

IRQ, VEN and DWL_REQ connection

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.pngEduardoZamora_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.pngEduardoZamora_0-1784052280049.png

Software

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.pngEduardoZamora_1-1784052475173.png

EduardoZamora_2-1784052493978.pngEduardoZamora_2-1784052493978.png

Please compile the main example the exact same way after this.

EduardoZamora_6-1784053460818.pngEduardoZamora_6-1784053460818.png

Code Modifications:

In lpc55S16Board.c (LPC55S16_Lib/source)

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.pngEduardoZamora_8-1784053796090.png

GPIO_PortInit(GPIO, 1);
CLOCK_AttachClk(kFRO12M_to_FLEXCOMM2);

In pin_mux.c (LPC55S16_Lib/board)

In the “BOARD_InitPins” functions we need to add the following line to enable GPIO 1’s clock.

EduardoZamora_9-1784053928400.pngEduardoZamora_9-1784053928400.png

CLOCK_EnableClock(kCLOCK_Gpio1);

In phHdll_Lib.c (Hdll_Lib/comps/phHdllLib/src)

In this file we are going to include the following library:

EduardoZamora_10-1784054328036.pngEduardoZamora_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.pngEduardoZamora_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 fsl_usart.c (LPC55S16_Lib/drivers)

In the “USART_ReadBlocking” function please copy the line 625 and paste it again after clearing the reception flags.

EduardoZamora_12-1784054430177.pngEduardoZamora_12-1784054430177.png

This is done in order to avoid erroneous interpretation of the RX frame.

In DownloadLibEx1.c

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.pngEduardoZamora_13-1784054476381.png

Final Build:

Now we need to rebuild the main example, and we should be able to flash and debug after this.

EduardoZamora_0-1786041828193.pngEduardoZamora_0-1786041828193.png

ラベル(1)
評価なし
バージョン履歴
最終更新日:
2 週間前
更新者: