File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
source/hic_hal/nxp/lpc4322 Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 21
21
22
22
#include "LPC43xx.h"
23
23
#include "uart.h"
24
- #include "lpc43xx_cgu.h"
25
24
#include "lpc43xx_scu.h"
26
25
#include "util.h"
27
26
#include "circ_buf.h"
@@ -31,8 +30,6 @@ static uint32_t baudrate;
31
30
static uint32_t dll ;
32
31
static uint32_t tx_in_progress ;
33
32
34
- extern uint32_t SystemCoreClock ;
35
-
36
33
#define RX_OVRF_MSG "<DAPLink:Overflow>\n"
37
34
#define RX_OVRF_MSG_SIZE (sizeof(RX_OVRF_MSG) - 1)
38
35
#define BUFFER_SIZE (512)
@@ -56,11 +53,18 @@ static int32_t reset(void);
56
53
57
54
int32_t uart_initialize (void )
58
55
{
56
+ uint32_t tmp ;
59
57
NVIC_DisableIRQ (UART_IRQn );
60
58
61
59
// The baudrate calculations require the UART to be clocked as SystemCoreClock
62
- CGU_EntityConnect (CGU_CLKSRC_PLL1 , CGU_BASE_UART0 );
63
- CGU_EnableEntity (CGU_BASE_UART0 , ENABLE );
60
+ tmp = LPC_CGU -> BASE_UART0_CLK & ~(0x0F << 24 ); // clear CLK_SEL.
61
+ LPC_CGU -> BASE_UART0_CLK = tmp
62
+ | (0x01 << 11 ) // AUTOBLOCK: 0=Disabled, 1=Enabled.
63
+ | (0x09 << 24 ) // CLK_SEL = PLL1.
64
+ ;
65
+
66
+ LPC_CGU -> BASE_UART0_CLK &= ~1 ; // PD: 0=Power Up.
67
+
64
68
scu_pinmux (2 , 0 , UART_RX_TX , FUNC1 ); /* P2_0: U0_TXD */
65
69
scu_pinmux (2 , 1 , UART_RX_TX , FUNC1 ); /* P2_1: U0_RXD */
66
70
You can’t perform that action at this time.
0 commit comments