mirror of
https://github.com/andreili/klipper.git
synced 2025-08-24 03:44:06 +02:00
This change is required to sucessfully use PA13/PA14 for UART. Otherwise they function as SWDIO/SWCLK. Relevant excerpt from the reference manual (translated): The initial state of PA13, PA14, PA15, PB3, and PB4 ports is that the JTAG/SWD function is valid after reset. When configuring FSEL[5:0] to select the function, you need to write 0 to the corresponding bit of the register PSPCR to invalidate the JTAG/SWD function. Signed-off-by: Boris-Chengbiao Zhou <bobo1239@web.de>
35 lines
978 B
C
35 lines
978 B
C
// Code to setup clocks on Huada HC32F460
|
|
//
|
|
// Copyright (C) 2022 Steven Gotthardt <gotthardt@gmail.com>
|
|
//
|
|
// This file may be distributed under the terms of the GNU GPLv3 license.
|
|
|
|
#include "autoconf.h" // CONFIG_MACH_AVR
|
|
#include "sched.h"
|
|
#include "system_hc32f460.h"
|
|
#include "hc32f460_gpio.h"
|
|
|
|
|
|
/****************************************************************
|
|
* Startup
|
|
****************************************************************/
|
|
|
|
// Main entry point - called from armcm_boot.c:ResetHandler()
|
|
void __attribute__((noreturn))
|
|
armcm_main(void)
|
|
{
|
|
// sets the system clock speed variable for library use
|
|
SystemInit();
|
|
|
|
// disable JTAG/SWD on pins PA13, PA14, PA15, PB3, PB4
|
|
// SWD still works until the relevant pins are reconfigured. Proprietary
|
|
// flash program (XHSC ISP) must be used to reflash afterwards.
|
|
PORT_DebugPortSetting(ALL_DBG_PIN, Disable);
|
|
|
|
// manage the system
|
|
sched_main();
|
|
|
|
// never get here
|
|
for (;;) ;
|
|
}
|