Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't save baud rate settings?

The GSM modem I have is set to 115200 baud-rate by default. I have PIC18 Microcontroller connected to it with 19200 baud-rate. I changed the modem baud-rate to 19200 then saved the settings but every time I reset the modem, the baud-rate changes back to 115200.

These are the following commands I used.

Change baudrate

AT+IPR=19200

Then I reopened the hyper-terminal (Putty) with 19200 baud-rate to save the current settings.

Save settings

AT&W

But upon reset of the modem, the baud-rate changes back to 115200. I am using M6000 GSM/GPS Module(Tk115 Gps Tracker) but there isn't a lot of support for it, here is the datasheet for reference.

Am I saving the settings correctly?

I was thinking about changing the baud-rate to 115200 on my PIC18F87j11 but it's not possible with the current 8 mhz oscillator. Any feedback would be helpful.

Thanks!

like image 829
Ammar Avatar asked Oct 20 '22 03:10

Ammar


1 Answers

A possible workaround, (but probably not the best option), is to save your baud rate into the internal flash storage, and then have a separate thread that continuously sets the baud rate of your port.

OR A thread like;

while (true)
{
  MySerialPort.BaudRate = 19200; //this will set/update baud rate
  Thread.Sleep(30000); //this will sleep for 30 seconds 
}

Will save the Baud rate every 30 seconds;

First Example

Or going with my first example (where baud rate is saved to flash)

is that in your program startup, you read your internal flash storage, and from the value stored there you assign the baud rate.

As for setting the baud rate in HyperTerminal/etc - these are only 'temporary' baud rates - A bit like tuning a radio - you can hear different things from different baud rates - that's how hyperterminal works - it doesn't 'save' the baud rate, only assigns it for a temporary time (until you turn off and on your radio).

As for BootLoader, there should be a way of 'exiting' bootloader mode - have a look at your microcontrollers' documentation as it should only be on when you are updating your MC or 'Flashing' an update - not on constantly (Bootloader is like pressing the 'reset' button on your PC)!

like image 131
jbutler483 Avatar answered Oct 23 '22 23:10

jbutler483