mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-16 05:42:56 +00:00
change uart baudrate for tm4c123 to 115200
This commit is contained in:
parent
03835c8183
commit
8e0400d531
@ -7,7 +7,13 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void USB0_Handler(void)
|
void USB0_Handler(void)
|
||||||
{
|
{
|
||||||
|
#if TUSB_OPT_HOST_ENABLED
|
||||||
|
tuh_int_handler(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if TUSB_OPT_DEVICE_ENABLED
|
||||||
tud_int_handler(0);
|
tud_int_handler(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
@ -23,10 +29,12 @@ static void board_uart_init (void)
|
|||||||
GPIOA->PCTL |= (1 << 0) | (1 << 4); // Configure the GPIOPCTL register to select UART0 in PA0 and PA1
|
GPIOA->PCTL |= (1 << 0) | (1 << 4); // Configure the GPIOPCTL register to select UART0 in PA0 and PA1
|
||||||
GPIOA->DEN |= (1 << 0) | (1 << 1); // Enable the digital functionality in PA0 and PA1
|
GPIOA->DEN |= (1 << 0) | (1 << 1); // Enable the digital functionality in PA0 and PA1
|
||||||
|
|
||||||
/** BAUDRATE = 9600 bits per second, refer manual for calculation **/
|
// BAUDRATE = 115200, with SystemCoreClock = 50 Mhz refer manual for calculation
|
||||||
|
// - BRDI = SystemCoreClock / (16* baud)
|
||||||
|
// - BRDF = int(fraction*64 + 0.5)
|
||||||
UART0->CTL &= ~(1 << 0); // Disable UART0 by clearing UARTEN bit in the UARTCTL register
|
UART0->CTL &= ~(1 << 0); // Disable UART0 by clearing UARTEN bit in the UARTCTL register
|
||||||
UART0->IBRD = 325; // Write the integer portion of the BRD to the UARTIRD register
|
UART0->IBRD = 27; // Write the integer portion of the BRD to the UARTIRD register
|
||||||
UART0->FBRD = 33; // Write the fractional portion of the BRD to the UARTFBRD registerer
|
UART0->FBRD = 8; // Write the fractional portion of the BRD to the UARTFBRD registerer
|
||||||
|
|
||||||
UART0->LCRH = (0x3 << 5); // 8-bit, no parity, 1 stop bit
|
UART0->LCRH = (0x3 << 5); // 8-bit, no parity, 1 stop bit
|
||||||
UART0->CC = 0x0; // Configure the UART clock source as system clock
|
UART0->CC = 0x0; // Configure the UART clock source as system clock
|
||||||
@ -40,8 +48,7 @@ static void initialize_board_led (GPIOA_Type *port, uint8_t PinMsk, uint8_t dirm
|
|||||||
SYSCTL->RCGCGPIO |= (1 << 5);
|
SYSCTL->RCGCGPIO |= (1 << 5);
|
||||||
|
|
||||||
/* Let the clock stabilize */
|
/* Let the clock stabilize */
|
||||||
while ( !((SYSCTL->PRGPIO) & (1 << 5)) )
|
while ( !((SYSCTL->PRGPIO) & (1 << 5)) ) {}
|
||||||
;
|
|
||||||
|
|
||||||
/* Port Digital Enable */
|
/* Port Digital Enable */
|
||||||
port->DEN |= PinMsk;
|
port->DEN |= PinMsk;
|
||||||
@ -60,9 +67,13 @@ static void board_switch_init (void)
|
|||||||
static void WriteGPIOPin (GPIOA_Type *port, uint8_t PinMsk, bool state)
|
static void WriteGPIOPin (GPIOA_Type *port, uint8_t PinMsk, bool state)
|
||||||
{
|
{
|
||||||
if ( state )
|
if ( state )
|
||||||
|
{
|
||||||
port->DATA |= PinMsk;
|
port->DATA |= PinMsk;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
port->DATA &= ~(PinMsk);
|
port->DATA &= ~(PinMsk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t ReadGPIOPin (GPIOA_Type *port, uint8_t pinMsk)
|
static uint32_t ReadGPIOPin (GPIOA_Type *port, uint8_t pinMsk)
|
||||||
@ -99,8 +110,7 @@ void board_init (void)
|
|||||||
SYSCTL->RCGCGPIO |= (1u << 3);
|
SYSCTL->RCGCGPIO |= (1u << 3);
|
||||||
|
|
||||||
/* Let the clock stabilize */
|
/* Let the clock stabilize */
|
||||||
while ( !(SYSCTL->PRGPIO & (1u << 3)) )
|
while ( !(SYSCTL->PRGPIO & (1u << 3)) ) {}
|
||||||
;
|
|
||||||
|
|
||||||
/* USB IOs to Analog Mode */
|
/* USB IOs to Analog Mode */
|
||||||
GPIOD->AFSEL &= ~((1u << 4) | (1u << 5));
|
GPIOD->AFSEL &= ~((1u << 4) | (1u << 5));
|
||||||
@ -119,6 +129,7 @@ void board_init (void)
|
|||||||
/* Initialize board UART */
|
/* Initialize board UART */
|
||||||
board_uart_init();
|
board_uart_init();
|
||||||
|
|
||||||
|
TU_LOG1_INT(SystemCoreClock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void board_led_write (bool state)
|
void board_led_write (bool state)
|
||||||
|
@ -28,6 +28,7 @@ INC += \
|
|||||||
|
|
||||||
SRC_C += \
|
SRC_C += \
|
||||||
src/portable/mentor/musb/dcd_musb.c \
|
src/portable/mentor/musb/dcd_musb.c \
|
||||||
|
src/portable/mentor/musb/hcd_musb.c \
|
||||||
$(MCU_DIR)/Source/system_TM4C123.c \
|
$(MCU_DIR)/Source/system_TM4C123.c \
|
||||||
$(MCU_DIR)/Source/GCC/tm4c123_startup.c
|
$(MCU_DIR)/Source/GCC/tm4c123_startup.c
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user