I've now recompiled the gateway, removed the debug definition and digitalio.h
Still, the gateway blinks TX led once in like 10 minutes, no rx, no error. Leds are connected properly, code seems to be ok and of course they are declared.
Still no idea why it's behaving like that.