FAQ
- M051 Base Series(95)
- M0518 Series(97)
- M0519 Series(43)
- M0564 Series(1)
- Mini51 Base Series(90)
- Nano100/102 Base Series(101)
- Nano103 Base Series(10)
- Nano110/112 LCD Series(100)
- Nano120 USB Series(111)
- Nano130 Advanced Series(110)
- NUC029 Series(94)
- NUC100/200 Advanced Series(102)
- NUC120/122/123/220 USB Series(116)
- NUC121/125 Series(1)
- NUC126 USB Series(2)
- NUC130/230 CAN Series(103)
- NUC131/NUC1311 CAN Series(98)
- NUC140/240 Connectivity Series(114)
FAQ
How to change the UART port when using the UART function of NuMicro_ISP_Programming_Tool for ISP update? Issue Date:2018-11-27
When using the UART function of NuMicro_ISP_Programming_Tool for ISP update, there are three steps to change the UART port.
1. In targetdev.h, find define, change the UART port and the name of the interrupt subroutine to the name of the target PORT
(For different chips, the name of the interrupt subroutine may be slightly different, please refer to the interrupt vector table.)
2. In main.c, find the SYS_Init(), which has the clock setting for the UART, and change the original UART PORT setting to the target UART PORT setting.
3. In main.c, find the SYS_Init(); there are MFP settings for the UART at the bottom; change the MFP to the MFP of the target PORT.
(1) /* Set PD multi-function pins for UART0 RXD(PD.0) and TXD(PD.1) */
For example: Change the UART port of the NUC126 ISP update from
UART0 to UART1
Step 1 Change PORT Define (targetdev.h)
Before change
#define UART_T UART0
#define UART_T_IRQHandler UART02_IRQHandler
#define UART_T_IRQn UART02_IRQn
After change
#define UART_T UART1
#define UART_T_IRQHandler UART1_IRQHandler
#define UART_T_IRQn UART1_IRQn
Step 2 Change the clock setting of UART PORT (main.c)
Before change
CLK->APBCLK0 |= CLK_APBCLK0_UART0CKEN_Msk;
CLK->CLKSEL1 = (CLK->CLKSEL1 & (~CLK_CLKSEL1_UARTSEL_Msk)) | CLK_CLKSEL1_UARTSEL_HIRC;
CLK->CLKDIV0 = (CLK->CLKDIV0 & (~CLK_CLKDIV0_UARTDIV_Msk)) | CLK_CLKDIV0_UART(1);
After change
CLK->APBCLK0 |= CLK_APBCLK0_UART1CKEN_Msk;
CLK->CLKSEL1 = (CLK->CLKSEL1 & (~CLK_CLKSEL1_UARTSEL_Msk)) | CLK_CLKSEL1_UARTSEL_HIRC;
CLK->CLKDIV0 = (CLK->CLKDIV0 & (~CLK_CLKDIV0_UARTDIV_Msk)) | CLK_CLKDIV0_UART(1);
P.S. The UART Clock settings of different chips may be slightly different. Refer to the Sample Code in the BSP or the Clock chapter in the Technical Reference Manual.
Step 3 Change MFP to the target port (main.c)
Before change
/* Set PD multi-function pins for UART0 RXD(PD.0) and TXD(PD.1) */
SYS->GPD_MFPL = (SYS->GPD_MFPL & (~SYS_GPD_MFPL_PD0MFP_Msk)) | SYS_GPD_MFPL_PD0MFP_UART0_RXD;
SYS->GPD_MFPL = (SYS->GPD_MFPL &
(~SYS_GPD_MFPL_PD1MFP_Msk)) | SYS_GPD_MFPL_PD1MFP_UART0_TXD;
After change
/* Set PD multi-function pins for UART0 RXD(PE.9) and TXD(PE.8) */
SYS->GPE_MFPH = (SYS->GPE_MFPH & (~SYS_GPE_MFPH_PE9MFP_Msk)) | SYS_GPE_MFPH_PE9MFP_UART1_RXD;
SYS->GPE_MFPH = (SYS->GPE_MFPH & (~SYS_GPE_MFPH_PE8MFP_Msk)) | SYS_GPE_MFPH_PE8MFP_UART1_TXD;
Products: | Microcontrollers ,8bit 8051 MCUs ,Arm Cortex-M0 MCUs ,Arm Cortex-M23 MCUs ,Arm Cortex-M4 MCUs |
---|---|
Applications: | |
Function: | Software and Tools,Nu Tools,In System Programming (ISP) Tool |