I assume that you have an A518 transmission. The problem could be the transmission speed sensor, a dirty shift solenoid, or you could have a bad throttle position sensor. I had a 3500 Dodge Diesel, and when the throttle position sensor went bad, the truck would constantly shift in and out of overdrive on the highway. The throttle position sensor is just a variable resistor, but it is easy to replace, too bad the cost is about $300 for the part.
The $39 code readers used by parts retailers are, in most cases are not going to tell you anything. You need to take it to a dealer or an independent specialist to have them extract the codes. Most retail employees have ZERO automotive experience, and even if they could extract the code, it just tells you a path to start to follow to trace down the fault. The OEM/Independent shops use code readers that cost $2000+ and Advance, Autozone, etc. is not going to spend that kind of money, or provide the training necessary to help customers solve their problems.
Your vehicle also likely has two speed sensors, and input shaft speed sensor and an output shaft speed sensor. If either one is bad, it will send a bad signal to the TCM