TWR-K60N512-KEIL Freescale Semiconductor, TWR-K60N512-KEIL Datasheet - Page 103

no-image

TWR-K60N512-KEIL

Manufacturer Part Number
TWR-K60N512-KEIL
Description
K60N512 Keil Tower Kit
Manufacturer
Freescale Semiconductor
Series
Kinetisr
Type
MCUr

Specifications of TWR-K60N512-KEIL

Rohs Compliant
YES
Contents
4 Boards, Documentation, DVD
Peak Reflow Compatible (260 C)
Yes
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
For Use With/related Products
Freescale Tower System, K60N512
}
The initialization above can be simplified to the following steps:
Freescale Semiconductor
1. Enable the UART pins by configuring the appropriate PORTx_PCRn registers (not
2. Enable the clock to the UART module.
3. Disable the transmitter and receiver. This step is included to make sure that the
4. Configure the UART control registers for the desired format. For 8-N-1 operation no
5. Calculate the baud rate dividers. This includes calculating the 13-bit whole number
6. Enable the transmitter and receiver to start the UART.
/* Make sure that the transmitter and receiver are disabled while we
UART_C2_REG(uartch) &= ~(UART_C2_TE_MASK | UART_C2_RE_MASK );
/* Configure the UART for 8-bit mode, no parity */
/* We need all default settings, so entire register is cleared */
UART_C1_REG(uartch) = 0;
/* Calculate baud settings */
ubd = (uint16)((sysclk*1000)/(baud * 16));
/* Save off the current value of the UARTx_BDH except for the SBR */
temp = UART_BDH_REG(uartch) & ~(UART_BDH_SBR(0x1F));
UART_BDH_REG(uartch) = temp |
UART_BDL_REG(uartch) = (uint8)(ubd & UART_BDL_SBR_MASK);
/* Determine if a fractional divider is needed to get closer to the baud rate */
brfa = (((sysclk*32000)/(baud * 16)) - (ubd * 32));
/* Save off the current value of the UARTx_C4 register except for the BRFA */
temp = UART_C4_REG(uartch) & ~(UART_C4_BRFA(0x1F));
UART_C4_REG(uartch) = temp |
/* Enable receiver and transmitter */
UART_C2_REG(uartch) |= (UART_C2_TE_MASK | UART_C2_RE_MASK );
shown in the code example).
UART is not active while it is being configured. This step is not needed if the
uart_init function is always called while the UART is already in a disabled state (the
UART is disabled after reset by default).
UART registers actually need to be configured (the default register settings configure
the UART for 8-N-1 operation).
baud rate divider, the SBR field stored in the UARTx_BDH and UARTx_BDL
registers, and the 5-bit fractional baud rate divider, the UARTx_C4[BRFA] field.
* change settings.
*/
else
if(uartch == UART4_BASE_PTR)
else
Kinetis Quick Reference User Guide, Rev. 0, 11/2010
SIM_SCGC1 |= SIM_SCGC1_UART4_MASK;
SIM_SCGC1 |= SIM_SCGC1_UART5_MASK;
Chapter 11 Universal Asynchronous Receiver and Transmitter (UART) Module
UART_C4_BRFA(brfa);
UART_BDH_SBR(((ubd & 0x1F00) >> 8));
103

Related parts for TWR-K60N512-KEIL