Additional Configuration for MCUs - devilhyt/lump-device-builder-library GitHub Wiki
RP2040
If the handshake consistently fails, try manually setting the RX pin to INPUT
mode before calling begin()
:
void setup() {
pinMode(RX_PIN, INPUT);
device.begin();
}
ATmega328/P
Disable the automatic host type detection feature by defining the LUMP_HOST_DETECT_OFF
macro before including the library header:
#define LUMP_HOST_DETECT_OFF
#include <LumpDeviceBuilder.h>
Reason:
During the handshake phase, to perform AutoID, the UART is required to:
- Ground the TX pin to indicate UART mode to the host.
- Enable RX to receive information from the host for automatic host type detection.
To achieve this, the library follows a simple sequence:
- Initializes the UART.
- Grounds the TX pin.
However, this sequence may not work on all MCUs due to hardware differences. For example, on the ATmega328/P, register manipulation is required to ground the TX pin after UART initialization.
Therefore, on such MCUs, automatic host type detection must be manually disabled to ensure proper operation.