Skip to content

Commit

Permalink
Fix no response on Serial* with high BAUDRATE
Browse files Browse the repository at this point in the history
Fix no response on Serial* for LPC1768 (SKR v1.3) with BAUDRATE > 250000
Fix no response on Serial* for LPC1769 (SKR v1.4 Turbo) with BAUDRATE >= 1000000

Fix derived from MarlinFirmware/Marlin#22284 that was tested on Marlin with SERIAL_PORT 0 on SKR v1.3 and with SERIAL_PORT 0, 1, 3 on SKR v1.4 Turbo . With that fix verified 57600, 115200, 250000, 460800, 500000, 921600, 1000000 BAUDRATEs work.
  • Loading branch information
Mihai authored Jul 4, 2021
1 parent eec10fe commit 6bc69a6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cores/arduino/HardwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <Stream.h>

extern "C" {
#include <lpc17xx_clkpwr.h>
#include <lpc17xx_uart.h>
#include "lpc17xx_pinsel.h"
}
Expand Down Expand Up @@ -102,6 +103,7 @@ class HardwareSerial : public Stream {
PINSEL_ConfigPin(&PinCfg);
PinCfg.Pinnum = 3;
PINSEL_ConfigPin(&PinCfg);
CLKPWR_SetPCLKDiv(CLKPWR_PCLKSEL_UART0, CLKPWR_PCLKSEL_CCLK_DIV_1);
} else if ((LPC_UART1_TypeDef *) UARTx == LPC_UART1) {
// Initialize UART1 pin connect
PinCfg.OpenDrain = 0;
Expand All @@ -122,7 +124,7 @@ class HardwareSerial : public Stream {
PinCfg.Pinnum = 16;
PINSEL_ConfigPin(&PinCfg);
#endif

CLKPWR_SetPCLKDiv(CLKPWR_PCLKSEL_UART1, CLKPWR_PCLKSEL_CCLK_DIV_1);
} else if (UARTx == LPC_UART2) {
// Initialize UART2 pin connect
PinCfg.OpenDrain = 0;
Expand All @@ -143,7 +145,7 @@ class HardwareSerial : public Stream {
PinCfg.Pinnum = 11;
PINSEL_ConfigPin(&PinCfg);
#endif

CLKPWR_SetPCLKDiv(CLKPWR_PCLKSEL_UART2, CLKPWR_PCLKSEL_CCLK_DIV_1);
} else if (UARTx == LPC_UART3) {
// Initialize UART3 pin connect
PinCfg.OpenDrain = 0;
Expand Down Expand Up @@ -171,7 +173,7 @@ class HardwareSerial : public Stream {
PinCfg.Pinnum = 1;
PINSEL_ConfigPin(&PinCfg);
#endif

CLKPWR_SetPCLKDiv(CLKPWR_PCLKSEL_UART3, CLKPWR_PCLKSEL_CCLK_DIV_1);
}

/* Initialize UART Configuration parameter structure to default state:
Expand Down

0 comments on commit 6bc69a6

Please sign in to comment.