Hello and welcome to JustAnswer!
When the trans control module sees a problem it thinks could cause potential damage to the trans it will shut off the relay that powers the solenoid pack, and it locks you in second gear. When it does this it will set fault codes so you know where to start diagnosis. The first thing you need to do is have the codes read. Almost all parts stores will read codes for free with a code reader now. The most common cause for this would be either the input or output speed sensor on the front of the trans. These run a little over $20 each, and are easy to replace. It could also be the solenoid pack, trans controller, wiring, or internal to the trans.