Skip to content

Commit

Permalink
Merge pull request #6958 from haukepetersen/fix_kinetis_uart
Browse files Browse the repository at this point in the history
cpu/kintis+boards: fixed UART configuration
  • Loading branch information
miri64 committed Apr 25, 2017
2 parents 032c3b6 + 9dabbdd commit 0cc1595
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 31 deletions.
3 changes: 3 additions & 0 deletions boards/frdm-k64f/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ static const uart_conf_t uart_config[] = {
.irqn = UART0_RX_TX_IRQn,
},
};

#define UART_0_ISR (uart_0_rx_tx)

#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
/** @} */

Expand Down
5 changes: 4 additions & 1 deletion boards/mulle/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@ static const uart_conf_t uart_config[] = {
.irqn = UART1_RX_TX_IRQn,
},
};
#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))

#define UART_0_ISR (isr_uart0_rx_tx)
#define UART_1_ISR (isr_uart1_rx_tx)

#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
/** @} */

/**
Expand Down
5 changes: 0 additions & 5 deletions boards/pba-d-01-kw2x/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ extern "C"
{
#endif

/**
* @brief Use the UART2 for STDIO on this board
*/
#define UART_STDIO_DEV UART_DEV(2)

/**
* @name LED pin definitions and handlers
* @{
Expand Down
34 changes: 14 additions & 20 deletions boards/pba-d-01-kw2x/include/periph_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,6 @@ extern "C"
* @{
*/
static const uart_conf_t uart_config[] = {
{
.dev = UART0,
.clken = (volatile uint32_t*)(BITBAND_REGADDR(SIM->SCGC4, SIM_SCGC4_UART0_SHIFT)),
.freq = CLOCK_CORECLOCK,
.pin_rx = GPIO_PIN(PORT_D, 6),
.pin_tx = GPIO_PIN(PORT_D, 7),
.pcr_rx = PORT_PCR_MUX(3),
.pcr_tx = PORT_PCR_MUX(3),
.irqn = UART0_RX_TX_IRQn,
},
{
.dev = UART1,
.clken = (volatile uint32_t*)(BITBAND_REGADDR(SIM->SCGC4, SIM_SCGC4_UART1_SHIFT)),
.freq = CLOCK_CORECLOCK,
.pin_rx = GPIO_UNDEF,
.pin_tx = GPIO_UNDEF,
.pcr_rx = PORT_PCR_MUX(3),
.pcr_tx = PORT_PCR_MUX(3),
.irqn = UART1_RX_TX_IRQn,
},
{
.dev = UART2,
.clken = (volatile uint32_t*)(BITBAND_REGADDR(SIM->SCGC4, SIM_SCGC4_UART2_SHIFT)),
Expand All @@ -112,7 +92,21 @@ static const uart_conf_t uart_config[] = {
.pcr_tx = PORT_PCR_MUX(3),
.irqn = UART2_RX_TX_IRQn,
},
{
.dev = UART0,
.clken = (volatile uint32_t*)(BITBAND_REGADDR(SIM->SCGC4, SIM_SCGC4_UART0_SHIFT)),
.freq = CLOCK_CORECLOCK,
.pin_rx = GPIO_PIN(PORT_D, 6),
.pin_tx = GPIO_PIN(PORT_D, 7),
.pcr_rx = PORT_PCR_MUX(3),
.pcr_tx = PORT_PCR_MUX(3),
.irqn = UART0_RX_TX_IRQn,
}
};

#define UART_0_ISR (isr_uart2_rx_tx)
#define UART_1_ISR (isr_uart0_rx_tx)

#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
/** @} */

Expand Down
20 changes: 15 additions & 5 deletions cpu/kinetis_common/periph/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,27 +178,37 @@ static inline void irq_handler(uart_t uart)
cortexm_isr_end();
}

void isr_uart0_rx_tx(void)
#ifdef UART_0_ISR
void UART_0_ISR(void)
{
irq_handler(UART_DEV(0));
}
#endif

void isr_uart1_rx_tx(void)
#ifdef UART_1_ISR
void UART_1_ISR(void)
{
irq_handler(UART_DEV(1));
}
#endif

void isr_uart2_rx_tx(void)
#ifdef UART_2_ISR
void UART_2_ISR(void)
{
irq_handler(UART_DEV(2));
}
#endif

void isr_uart3_rx_tx(void)
#ifdef UART_3_ISR
void UART_3_ISR(void)
{
irq_handler(UART_DEV(3));
}
#endif

void isr_uart4_rx_tx(void)
#ifdef UART_4_ISR
void UART_4_ISR(void)
{
irq_handler(UART_DEV(4));
}
#endif

0 comments on commit 0cc1595

Please sign in to comment.