I had to struggle with two problems when starting / restarting a GPRS session. I would like to share this with you, maybe this could be helpful for you…
When starting a GPRS session with ed_DialupConnectionStart() I will get two OK’s on UART1. I assume the stack sends something like AT+CGDCONT and ATD… here. That always worked fine except when the application sent another AT command (with adl_atCmdCreate()) in between. Then the modem went into a funny mode: No other adl_atCmdCreate()d AT command would get an answer from the modem until the modem is turned off and on again. So, if you are for example using timers to create AT commands, you probably should make sure that while starting GPRS no AT commands are created. (After I did that, the funny mode didn’t happen anymore…)
In order to restart the session I did an ed_DialupConnectionStop() first, then another ed_DialupConnectionStart(). I noticed that my callback handler for starting the session wasn’t called (although the session was setup correctly!). I am pretty sure, that the problem was (and that wasn’t immediately obvious) that ed_DialupConnectionStart() was called indirectly through several function calls from the connection stop handler. So the stack didn’t get a chance to do processing after the connection stop callback to the ed_DialupConnectionStart() call. My solution to start a timer (which then would issue ed_DialupConnectionStart()) after the answer through the connection stop handler fixed the problem.