Skip to content

Commit

Permalink
✨ SERIAL_DMA (for some STM32Fx) (MarlinFirmware#26328)
Browse files Browse the repository at this point in the history
  • Loading branch information
rondlh authored Dec 12, 2023
1 parent 01aa87c commit b94a335
Show file tree
Hide file tree
Showing 12 changed files with 637 additions and 57 deletions.
24 changes: 17 additions & 7 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2649,10 +2649,12 @@
//#define FULL_REPORT_TO_HOST_FEATURE // Auto-report the machine status like Grbl CNC
#endif

// Bad Serial-connections can miss a received command by sending an 'ok'
// Therefore some clients abort after 30 seconds in a timeout.
// Some other clients start sending commands while receiving a 'wait'.
// This "wait" is only sent when the buffer is empty. 1 second is a good value here.
/**
* Bad Serial-connections can miss a received command by sending an 'ok'
* Therefore some clients abort after 30 seconds in a timeout.
* Some other clients start sending commands while receiving a 'wait'.
* This "wait" is only sent when the buffer is empty. 1 second is a good value here.
*/
//#define NO_TIMEOUTS 1000 // (ms)

// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
Expand All @@ -2665,6 +2667,15 @@
// For serial echo, the number of digits after the decimal point
//#define SERIAL_FLOAT_PRECISION 4

/**
* This feature is EXPERIMENTAL so use with caution and test thoroughly.
* Enable this option to receive data on the serial ports via the onboard DMA
* controller for more stable and reliable high-speed serial communication.
* Only some STM32 MCUs are currently supported.
* Note: This has no effect on emulated USB serial ports.
*/
//#define SERIAL_DMA

/**
* Set the number of proportional font spaces required to fill up a typical character space.
* This can help to better align the output of commands like `G29 O` Mesh Output.
Expand Down Expand Up @@ -3442,9 +3453,8 @@
/**
* TWI/I2C BUS
*
* This feature is an EXPERIMENTAL feature so it shall not be used on production
* machines. Enabling this will allow you to send and receive I2C data from slave
* devices on the bus.
* This feature is EXPERIMENTAL but may be useful for custom I2C peripherals.
* Enable this to send and receive I2C data from slave devices on the bus.
*
* ; Example #1
* ; This macro send the string "Marlin" to the slave device with address 0x63 (99)
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/HAL/AVR/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@
#include "../../core/types.h"
#include "../../core/serial_hook.h"

#ifndef SERIAL_PORT
#define SERIAL_PORT 0
#endif

#ifndef USBCON

// The presence of the UBRRH register is used to detect a UART.
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/HAL/AVR/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@
*
*/
#pragma once

#ifndef SERIAL_PORT
#define SERIAL_PORT 0
#endif
10 changes: 0 additions & 10 deletions Marlin/src/HAL/LPC1768/MarlinSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@
#endif
#include "../../core/serial_hook.h"

#ifndef SERIAL_PORT
#define SERIAL_PORT 0
#endif
#ifndef RX_BUFFER_SIZE
#define RX_BUFFER_SIZE 128
#endif
#ifndef TX_BUFFER_SIZE
#define TX_BUFFER_SIZE 32
#endif

class MarlinSerial : public HardwareSerial<RX_BUFFER_SIZE, TX_BUFFER_SIZE> {
public:
MarlinSerial(LPC_UART_TypeDef *UARTx) : HardwareSerial<RX_BUFFER_SIZE, TX_BUFFER_SIZE>(UARTx) { }
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/HAL/LPC1768/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@
*
*/
#pragma once

#ifndef SERIAL_PORT
#define SERIAL_PORT 0
#endif
7 changes: 7 additions & 0 deletions Marlin/src/HAL/LPC1768/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@
#if DISABLED(NO_SD_HOST_DRIVE)
#define HAS_SD_HOST_DRIVE 1
#endif

#ifndef RX_BUFFER_SIZE
#define RX_BUFFER_SIZE 128
#endif
#ifndef TX_BUFFER_SIZE
#define TX_BUFFER_SIZE 32
#endif
Loading

0 comments on commit b94a335

Please sign in to comment.