We've had a small number of instances of DueX2/DueX5 boards on which a connection between the I/O expander chip and the PCB is intermittent. I suspect that's what's happening in your case, so please ask for the DueX5 to be replaced. I'm sorry for the inconvenience this is causing you.