Check IOD fuse, check that battery cables are tight (that'll mess it up believe it or not), check that wires at the OBD2 plug are tight and not corroded, make sure that the PCM mounting screws are not loose, make sure that connectors at the PCM are not loose, check the ground wires that are under the battery down by the cruise control module. Sometimes a scantool refuses to read codes, there is a problem with ground at the OBD2 connector, or a ground somwhere. Otherwise it may be a bad PCM.
The key trick should work as well. Also might be a dumb question but are you reading codes with the key in the RUN position?
Also you can try this. Note that this will most likely clear the codes, so if you can't get the truck to duplicate them again or you don't want to lose them don't do this! Unhook the negative battery cable, turn the key to the RUN position for 30 seconds, to the START position for 30 seconds, back to the RUN position for 30 seconds, turn the key off, then hook up the negative battery cable again and try establishing a connection with the PCM again. What this does is clear the PCM's temporary memory and helps dissipate static electricity.