Huada microcontroller HC32F460 debug pin SWCLK SWDIO PA15 PB3 PB4 pin multiplexing problem

Jesus said: It is more blessed to give than to receive
. Directly to the picture above.
insert image description here
The first time the LCD display did not use PA15, the revised version put it on PA15, and found that the display does not display. After the pins are initialized, they become high configuration mode.

program

void LCD_GPIO_Init(void)
{
    stc_port_init_t stcPortInit;  
    /*配置结构初始化*/
    MEM_ZERO_STRUCT(stcPortInit);
    
    stcPortInit.enPinMode = Pin_Mode_Out;//输出模式
    stcPortInit.enExInt =  Enable;//Enable//Disable
    stcPortInit.enPullUp = Enable;//enPinDrv
    
    /* Port/Pin 初始化 */
    PORT_Init(LCD_SI_PORT,LCD_SI_PIN, &stcPortInit);
    PORT_Init(LCD_SCL_PORT,LCD_SCL_PIN, &stcPortInit);
    PORT_Init(LCD_A0_PORT,LCD_A0_PIN, &stcPortInit);
    PORT_Init(LCD_RES_PORT,LCD_RES_PIN, &stcPortInit);
    PORT_Init(LCD_CS_PORT,LCD_CS_PIN, &stcPortInit);
    
    LCD_SI_L();
    LCD_SCL_L();
    LCD_A0_L();
    LCD_RES_L();
    LCD_CS_L();
}

The manual says:
Note:
– The initial state of the PA13, PA14, PA15, PB3, PB4 ports after reset is that the JTAG/SWD function is valid. When configuring the FSEL[5:0]
selection function, you need to write 0 to the corresponding bit of the register PSPCR. Invalid JTAG /SWD function. The initial state of PC14 and PC15 ports
after reset is the digital function disabled state. When selecting the digital function, it is necessary to write 0 to the DDIS bit of the corresponding register PCRxy to enable the
effective digital function.

Translation: The debug port is open by default, and the initialization function (normal IO, serial port, etc.) first closes the default debug port.

function to be used

insert image description here

extern en_result_t PORT_DebugPortSetting(uint8_t u8DebugPort, en_functional_state_t enFunc);

insert image description here
insert image description here

The following are the key points to note

insert image description here

void LCD_GPIO_Init(void)
{
    
    
	///重点初始化
    PORT_DebugPortSetting(TDI,Disable); //关闭JTDI 调试管脚
    stc_port_init_t stcPortInit;  
    /*配置结构初始化*/
    MEM_ZERO_STRUCT(stcPortInit);
    
    stcPortInit.enPinMode = Pin_Mode_Out;//输出模式
    stcPortInit.enExInt =  Enable;//Enable//Disable
    stcPortInit.enPullUp = Enable;//enPinDrv
    
    /* Port/Pin 初始化 */
    PORT_Init(LCD_SI_PORT,LCD_SI_PIN, &stcPortInit);
    PORT_Init(LCD_SCL_PORT,LCD_SCL_PIN, &stcPortInit);
    PORT_Init(LCD_A0_PORT,LCD_A0_PIN, &stcPortInit);
    PORT_Init(LCD_RES_PORT,LCD_RES_PIN, &stcPortInit);
    PORT_Init(LCD_CS_PORT,LCD_CS_PIN, &stcPortInit);
    
    LCD_SI_L();
    LCD_SCL_L();
    LCD_A0_L();
    LCD_RES_L();
    LCD_CS_L();
}

So it can be used. Bye

Guess you like

Origin blog.csdn.net/weixin_42839808/article/details/120142513