I am providing you with the wiring diagram for the four wheel drive actuation system. Near the bottom you will note the actuator motor and the transfer case encoder motor. You may have a short or bad ground in one of these components. Check wires for good fit and bare spots where insulation is missing and could cause a short. Also check all grounds for a tight corossion, rust, free fit that is metal to metal. I f all the wires seem good the actuator is the first things I would be suspect of.
Take the truck and have the trouble codes pulled. Any Advance Auto or Auto Zone will do this for free.
If no codes come up there is a mechanical problem that may be in the hubs. Take them off and clean and re-grease them while checking for broken or mal-functioning components.
The ECU may be at fault is all othere possibilities are eliminated, but this is unlikely. Check the ground for it as well as the main power wire.