Main Site Documentation

Cellular Radio Module Driver - sendSMS Bug?


#1

Hi,

I found an issue with the Cellular Radio Module Driver.

The function SendSMS works only once.

The second call returns always with a “ModuleIsBusy” error.
I took a look at the driver and I noticed that the variable isModuleBusy is set to true by the sendSMS but never set to false again. I think that the variable should be set to false before the function returns or that it is necessary to call the function ProcessATCommandResponse (that will take care of setting the isModuleBusy to false).

Below the code with the isModuleBusy set to false before the function returns. This works for me, but I will try to call the ProcessATCommandResponse instead.


public ReturnedState SendSms(string number, string message)
		{
			// Check if module is on
			if (!isPowerOn) return ReturnedState.ModuleIsOff;

			// Check if serial line is open
			if (serialLine.IsOpen)
			{
				//Check if module is busy
				if (isModuleBusy) return ReturnedState.ModuleBusy;
				isModuleBusy = true;

				serialLine.Write("AT+CMGS=\"+" + number + "\"\r\n");
				Thread.Sleep(100);
				serialLine.Write(message);
				Thread.Sleep(100);
				serialLine.Write((char)26 + "\r");
				//semaphore = true;
				//while (semaphore) Thread.Sleep(10);
        // **********************
				isModuleBusy = false;
         // ********************** 
                                return ReturnedState.OK;
			}
			else return ReturnedState.Error;
		}

Hope this could be of some help to other users.

Bye!

Stefano.


#2

It has a more generic error in the serial/parsing of commands inside the driver. I’ve posted a longer thread investigating the issue here on the forums. Upping the serial line to max speed seemed to make it stable longer, but it’s not fixing the problem. Also, since there is a buffer overflow on the serial communication with the module, parsing of commands from the module fails, and the driver is left in an inconsistent state (is busy is newer cleared) and nothing works/module is non responsive.

Edit:

More here: https://www.ghielectronics.com/community/forum/topic?id=15018