Skip to content

Commit 2772581

Browse files
committed
Add support for XMC4700_RELAX kit
1 parent 5977866 commit 2772581

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2021, Ha Thach (tinyusb.org)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*
24+
* This file is part of the TinyUSB stack.
25+
*/
26+
27+
#ifndef BOARD_H_
28+
#define BOARD_H_
29+
30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
34+
#define LED_PIN P5_9
35+
#define LED_STATE_ON 1
36+
37+
#define BUTTON_PIN P15_13
38+
#define BUTTON_STATE_ACTIVE 0
39+
40+
#define UART_DEV XMC_UART0_CH0
41+
#define UART_TX_PIN P1_5
42+
#define UART_TX_PIN_AF P1_5_AF_U0C0_DOUT0
43+
#define UART_RX_PIN P1_4
44+
#define UART_RX_INPUT USIC0_C0_DX0_P1_4
45+
46+
static inline void board_clock_init(void)
47+
{
48+
/* Clock configuration */
49+
/* fPLL = 144MHz */
50+
/* fSYS = 144MHz */
51+
/* fUSB = 48MHz */
52+
const XMC_SCU_CLOCK_CONFIG_t clock_config =
53+
{
54+
.syspll_config.p_div = 2,
55+
.syspll_config.n_div = 48,
56+
.syspll_config.k_div = 1,
57+
.syspll_config.mode = XMC_SCU_CLOCK_SYSPLL_MODE_NORMAL,
58+
.syspll_config.clksrc = XMC_SCU_CLOCK_SYSPLLCLKSRC_OSCHP,
59+
.enable_oschp = true,
60+
.calibration_mode = XMC_SCU_CLOCK_FOFI_CALIBRATION_MODE_FACTORY,
61+
.fsys_clksrc = XMC_SCU_CLOCK_SYSCLKSRC_PLL,
62+
.fsys_clkdiv = 2,
63+
.fcpu_clkdiv = 1,
64+
.fccu_clkdiv = 1,
65+
.fperipheral_clkdiv = 1
66+
};
67+
68+
/* Setup settings for USB clock */
69+
XMC_SCU_CLOCK_Init(&clock_config);
70+
71+
XMC_SCU_CLOCK_SetUsbClockDivider(6);
72+
XMC_SCU_CLOCK_SetUsbClockSource(XMC_SCU_CLOCK_USBCLKSRC_SYSPLL);
73+
XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_USB);
74+
}
75+
76+
77+
#ifdef __cplusplus
78+
}
79+
#endif
80+
81+
#endif /* BOARD_H_ */
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
MCU_VARIANT = XMC4700
2+
CFLAGS += \
3+
-DXMC4700_F144x2048 \
4+
5+
# mcu driver cause following warnings
6+
CFLAGS += -Wno-stringop-overread
7+
8+
LD_FILE = $(MCU_DIR)/CMSIS/Infineon/COMPONENT_$(MCU_VARIANT)/Source/TOOLCHAIN_GCC_ARM/XMC4700x2048.ld
9+
10+
JLINK_DEVICE = XMC4700-2048
11+
12+
flash: flash-jlink

0 commit comments

Comments
 (0)