Swap input/output pins and set them properly