p3p / pio-framework-arduino-lpc176x

10 stars 20 forks source link

Reduce SoftwareSerial priority and allow configuration through LPC_SERIAL_IRQ_PRIORITY #50

Closed mh-dm closed 1 month ago

mh-dm commented 2 months ago

Reduce SoftwareSerial priority and allow configuration through LPC_SERIAL_IRQ_PRIORITY

Added option is similar in function and style to the existing LPC_UART_IRQ_PRIORITY define from HardwareSerial.

(edit, undid this: Comment out a FORCE_BAUD_RATE of 19200.)

Tested on LPC1768 (SKR v1.3) that it still communicated fine with some TMC2208 stepper drivers (which goes over SoftwareSerial).

p3p commented 1 month ago

FORCE_BAUD_RATE is set because even with the overly high ISR priority even a slight timing shift with corrupt the data at higher rates, users of Marin will (and did) set it at "normal" rates that are far to high, there are also some features of the TMC drivers that constantly poll the driver over serial, I think Marlin now has warnings if you enable them though.

Adding a configuration option and reducing the priority by default is a good change though.

mh-dm commented 1 month ago

Make sense. I undid FORCE_BAUD_RATE change to decouple from the main change.

p3p commented 1 month ago

LPC_SERIAL_IRQ_PRIORITY should probably be renamed LPC_SOFTWARE_SERIAL_IRQ_PRIORITY, getting a bit long but that is the feature it is configuring.

mh-dm commented 1 month ago

I agree it should be more specific. Trying LPC_SWSERIAL_IRQ_PRIORITY as swserial is somewhat in common use (though not in this repo) but if you prefer LPC_SOFTWARE_SERIAL_IRQ_PRIORITY let me know and I'll swap.