Your attempt to fix baudrate by combining AT+IPR
and AT&W
is correct, but unfortunately it does not neccessarily work.
The AT&W
command is actually not specified in any standard (see my question Which standard specifies the AT&W AT command?), so that means that exactly what is saved by AT&W
is completely up to the manefacturer and you (unfortunately) cannot assume anything with regards to baudrate being saved or not.
Of course, if the manefacturer explicitly specifies that AT&W
indeed does save baudrate, then you're good to go (for that specific device) but the document you linked does not even include AT&W
in the list of commands... So when you test and find that your modem does not save baudrate, then that is an unfortunate fact that you have to accept.
When you say that it is not possible to change baudrate I assume you mean that the problem is that 8MHz is not easily dividable down to 115200 so that the error marging becomes non-negletible large like shown in the 8MHz table at WormFood's AVR Baud Rate Calculator, right?
The table indicates 7.8% error for 8MHz, but maybe the modem is tolerant in its reception? If one in X attempts succeed, that is all you need since the speed will be set to what you need, e.g. try AT+IPR=19200
at 115200 and then test AT
at 19200. If successful, done, else try again. Maybe this will be good enough and resolve itself after a resonable time? I think it would be worth trying.
Alternatively you could perhaps try to write an interrupt routine to send out the start+data+stop bits for "AT+IPR=19200\r"
at speed 115200 on a GPIO pin and connect just to see if it is possible that way to jumpstart the modem speed (see http://www.fpga4fun.com/SerialInterface2.html for calculations to step down frequency). You will probably need some additional electrical signal adaption for this as well and find some way of multiplexing GPIO and UART.