Skip to content

Commit b6d5d9b

Browse files
thinkbergtheotherjimmy
authored andcommitted
fixed clock config, fixed UART pins
fixed clock config, fixed UART pins fixed clock config, fixed UART pins fixed clock config, fixed UART pins
1 parent 0d50234 commit b6d5d9b

File tree

3 files changed

+54
-87
lines changed

3 files changed

+54
-87
lines changed

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/TARGET_USENSE/PinNames.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ typedef enum {
115115
//Push buttons
116116
SW0 = PTE2,
117117

118-
USBTX = PTA1,
119-
USBRX = PTA2,
120-
118+
USBRX = PTA1,
119+
USBTX = PTA2,
120+
121121
UART_RTS = PTC1,
122122
UART_CTS = PTC2,
123123
UART_RX = PTC3,

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/TARGET_USENSE/fsl_clock_config.c

Lines changed: 33 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,3 @@
1-
/*
2-
* Copyright (c) 2015, Freescale Semiconductor, Inc.
3-
* All rights reserved.
4-
*
5-
* Redistribution and use in source and binary forms, with or without modification,
6-
* are permitted provided that the following conditions are met:
7-
*
8-
* o Redistributions of source code must retain the above copyright notice, this list
9-
* of conditions and the following disclaimer.
10-
*
11-
* o Redistributions in binary form must reproduce the above copyright notice, this
12-
* list of conditions and the following disclaimer in the documentation and/or
13-
* other materials provided with the distribution.
14-
*
15-
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16-
* contributors may be used to endorse or promote products derived from this
17-
* software without specific prior written permission.
18-
*
19-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23-
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26-
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29-
*/
30-
311
/*
322
* How to setup clock using clock driver functions:
333
*
@@ -56,14 +26,14 @@
5626
* 4. Call CLOCK_SetSimConfig to set the clock configuration in SIM.
5727
*/
5828

59-
/* TEXT BELOW IS USED AS SETTING FOR THE CLOCKS TOOL *****************************
60-
!!ClocksProfile
61-
product: Clocks v1.0
29+
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
30+
!!GlobalInfo
31+
product: Clocks v3.0
6232
processor: MKL82Z128xxx7
6333
package_id: MKL82Z128VLL7
6434
mcu_data: ksdk2_0
65-
processor_version: 1.1.0
66-
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR THE CLOCKS TOOL **/
35+
processor_version: 2.0.0
36+
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
6737

6838
#include "fsl_clock_config.h"
6939

@@ -99,44 +69,53 @@ static void CLOCK_CONFIG_SetFllExtRefDiv(uint8_t frdiv)
9969
MCG->C1 = ((MCG->C1 & ~MCG_C1_FRDIV_MASK) | MCG_C1_FRDIV(frdiv));
10070
}
10171

72+
/*******************************************************************************
73+
************************ BOARD_InitBootClocks function ************************
74+
******************************************************************************/
75+
void BOARD_InitBootClocks(void)
76+
{
77+
BOARD_BootClockRUN();
78+
}
79+
10280
/*******************************************************************************
10381
********************** Configuration BOARD_BootClockRUN ***********************
10482
******************************************************************************/
105-
/* TEXT BELOW IS USED AS SETTING FOR THE CLOCKS TOOL *****************************
83+
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
10684
!!Configuration
10785
name: BOARD_BootClockRUN
86+
called_from_default_init: true
10887
outputs:
109-
- {id: Bus_clock.outFreq, value: 24 MHz}
110-
- {id: Core_clock.outFreq, value: 48 MHz, locked: true, accuracy: '0.001'}
88+
- {id: Bus_clock.outFreq, value: 16 MHz}
89+
- {id: Core_clock.outFreq, value: 48 MHz}
11190
- {id: Fast_bus_clock.outFreq, value: 48 MHz}
112-
- {id: Flash_clock.outFreq, value: 24 MHz}
91+
- {id: Flash_clock.outFreq, value: 16 MHz}
11392
- {id: IRC48MCLK.outFreq, value: 48 MHz}
11493
- {id: LPO_clock.outFreq, value: 1 kHz}
115-
- {id: LPUARTCLK.outFreq, value: 28.8 MHz}
116-
- {id: MCGPLLCLK.outFreq, value: 144 MHz}
117-
- {id: MCGPLLCLK2X.outFreq, value: 288 MHz}
118-
- {id: PLLFLLCLK.outFreq, value: 144 MHz}
94+
- {id: LPUARTCLK.outFreq, value: 48 MHz}
95+
- {id: MCGPLLCLK.outFreq, value: 96 MHz}
96+
- {id: MCGPLLCLK2X.outFreq, value: 192 MHz}
97+
- {id: PLLFLLCLK.outFreq, value: 96 MHz}
11998
- {id: System_clock.outFreq, value: 48 MHz}
12099
settings:
121100
- {id: MCGMode, value: PEE}
122101
- {id: LPUARTClkConfig, value: 'yes'}
123-
- {id: MCG.FLL_mul.scale, value: '640', locked: true}
124102
- {id: MCG.IREFS.sel, value: MCG.FRDIV}
125103
- {id: MCG.OSCSEL.sel, value: SIM.IRC48MCLK}
126104
- {id: MCG.OSCSEL_PLL.sel, value: SIM.IRC48MCLK}
127105
- {id: MCG.PLLS.sel, value: MCG.PLL_DIV2}
128-
- {id: MCG.PRDIV.scale, value: '3'}
129-
- {id: MCG.VDIV.scale, value: '18'}
106+
- {id: MCG.PRDIV.scale, value: '4'}
107+
- {id: RTC_CR_OSCE_CFG, value: Enabled}
108+
- {id: SIM.FLEXIOSRCSEL.sel, value: SIM.PLLFLLDIV}
130109
- {id: SIM.LPUARTSRCSEL.sel, value: SIM.PLLFLLDIV}
131-
- {id: SIM.OUTDIV1.scale, value: '3'}
110+
- {id: SIM.OUTDIV1.scale, value: '2'}
132111
- {id: SIM.OUTDIV2.scale, value: '6'}
133112
- {id: SIM.OUTDIV4.scale, value: '6'}
134-
- {id: SIM.OUTDIV5.scale, value: '3'}
135-
- {id: SIM.PLLFLLDIV.scale, value: '5'}
113+
- {id: SIM.OUTDIV5.scale, value: '2'}
114+
- {id: SIM.PLLFLLDIV.scale, value: '2'}
136115
- {id: SIM.PLLFLLSEL.sel, value: MCG.MCGPLLCLK}
137116
sources:
138117
- {id: IRC48M.IRC48M.outFreq, value: 48 MHz}
139-
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR THE CLOCKS TOOL **/
118+
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
140119

141120
/*******************************************************************************
142121
* Variables for BOARD_BootClockRUN configuration
@@ -154,17 +133,17 @@ const mcg_config_t mcgConfig_BOARD_BootClockRUN =
154133
.pll0Config =
155134
{
156135
.enableMode = MCG_PLL_DISABLE, /* MCGPLLCLK disabled */
157-
.prdiv = 0x2U, /* PLL Reference divider: divided by 3 */
158-
.vdiv = 0x2U, /* VCO divider: multiplied by 18 */
136+
.prdiv = 0x3U, /* PLL Reference divider: divided by 4 */
137+
.vdiv = 0x0U, /* VCO divider: multiplied by 16 */
159138
},
160139
};
161140
const sim_clock_config_t simConfig_BOARD_BootClockRUN =
162141
{
163142
.pllFllSel = SIM_PLLFLLSEL_MCGPLLCLK_CLK, /* PLLFLL select: MCGPLLCLK clock */
164-
.pllFllDiv = 4, /* PLLFLLSEL clock divider divisor: divided by 5 */
143+
.pllFllDiv = 1, /* PLLFLLSEL clock divider divisor: divided by 2 */
165144
.pllFllFrac = 0, /* PLLFLLSEL clock divider fraction: multiplied by 1 */
166145
.er32kSrc = SIM_OSC32KSEL_OSC32KCLK_CLK, /* OSC32KSEL select: OSC32KCLK clock */
167-
.clkdiv1 = 0x25052000U, /* SIM_CLKDIV1 - OUTDIV1: /3, OUTDIV2: /6, OUTDIV4: /6, OUTDIV5: /3 */
146+
.clkdiv1 = 0x15051000U, /* SIM_CLKDIV1 - OUTDIV1: /2, OUTDIV2: /6, OUTDIV4: /6, OUTDIV5: /2 */
168147
};
169148
const osc_config_t oscConfig_BOARD_BootClockRUN =
170149
{

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/TARGET_USENSE/fsl_clock_config.h

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,3 @@
1-
/*
2-
* Copyright (c) 2015, Freescale Semiconductor, Inc.
3-
* All rights reserved.
4-
*
5-
* Redistribution and use in source and binary forms, with or without modification,
6-
* are permitted provided that the following conditions are met:
7-
*
8-
* o Redistributions of source code must retain the above copyright notice, this list
9-
* of conditions and the following disclaimer.
10-
*
11-
* o Redistributions in binary form must reproduce the above copyright notice, this
12-
* list of conditions and the following disclaimer in the documentation and/or
13-
* other materials provided with the distribution.
14-
*
15-
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16-
* contributors may be used to endorse or promote products derived from this
17-
* software without specific prior written permission.
18-
*
19-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22-
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23-
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24-
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25-
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26-
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27-
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28-
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29-
*/
30-
311
#ifndef _CLOCK_CONFIG_H_
322
#define _CLOCK_CONFIG_H_
333

@@ -37,6 +7,24 @@
377
* Definitions
388
******************************************************************************/
399

10+
/*******************************************************************************
11+
************************ BOARD_InitBootClocks function ************************
12+
******************************************************************************/
13+
14+
#if defined(__cplusplus)
15+
extern "C" {
16+
#endif /* __cplusplus*/
17+
18+
/*!
19+
* @brief This function executes default configuration of clocks.
20+
*
21+
*/
22+
void BOARD_InitBootClocks(void);
23+
24+
#if defined(__cplusplus)
25+
}
26+
#endif /* __cplusplus*/
27+
4028
/*******************************************************************************
4129
********************** Configuration BOARD_BootClockRUN ***********************
4230
******************************************************************************/

0 commit comments

Comments
 (0)