GSM QuectelM95

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

GSM QuectelM95

Post by jollybv »

Hi Guys

I have built a GSM Modual using the Quectel M95 will the GSM component in flowcode work with this chip, are all AT commands standard?

Brian

tello
Posts: 94
Joined: Wed Jan 16, 2013 11:37 am
Has thanked: 56 times
Been thanked: 16 times
Contact:

Re: GSM QuectelM95

Post by tello »

Hello Jollybv , my new project for 2015 is a small GSM QuectelM95 too.
I've never worked with AT commands, I have a lot of illusion to begin work.
I'll be happy to share with you my tests.

A greeting.

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi Tello

Thanks that will be great as we both in the same boat never worked with AT commands and I'm still learning Flowcode.

seasonal greeting to you

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi Guys

Have my GSM board now trying to talk to it, is it possible to test by connecting to the PC UART port and running the program using the com Injector

Brian

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi guys

Im trying to talk to a the Quectel M95 GSM module, the set up I have is as follows. I'm using the PIC18F46K80 CPU what in trying to do is send a string from the PC to UART 1 when received then send it out on UART 2 then when The M95 Modual Responds it must receive on UART 2 and Transmit back on UART 1 . I'm quite lost been trying to get this right for some time. I'm not sure if the setting are right but i have checked and both UART'S are set at 9600 baud rate my USB to RS232 is set at 9600 so everything should be right.
Attachments
RX_TX_RS232.fcfx
(13.3 KiB) Downloaded 275 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Hello,

I have changed your program a bit so that it sends and receives bytes rather than strings and has additional buffering using the circular buffer component so this should allow the program to be much more reliable. You may need to play with the sizes of the buffers to allow the code to work reliably with the hardware and yet not eat up too much RAM. At the moment both buffers can store a maximum of 20 bytes.

My only remaining concern is the 50ms delays in your LED macros. At 9600 baud 50ms is approx 50 bytes that could potentially come in. Therefore I have also removed these and tried to provide something similar yet better than simply waiting around. The Power LED flash I did via a timer interrupt just to try and simplify things.
RX_TX_RS232.fcfx
(16.58 KiB) Downloaded 271 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Whoops noticed a bug where I'm not actually pulling the data back out the circular buffer,

This should work...
RX_TX_RS232.fcfx
(16.54 KiB) Downloaded 325 times

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi Guys

Can anyone tell me if the GSM component will work with other GSM Modules other than the Telit GL865 on the EB066 board??

Brian

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Hello Brian,

The GSM component simply deals in AT commands and so should be compatible with most off the shelf GSM modules. The AT commands themselves might change slightly between manufacturers.

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi Benj

That is great can you please explain the Initialise dose that send the AT cmd 10 times or until it receives the OK back from the modual??

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Hello Brian,

The Initialise performs the following tasks.

Startup the UART
Send the command "AT+CMGF=1"
Check for OK, if not return failure
Send the command "AT+CNMI=1,2,0,0,0"
Check for OK, if not return failure
Return Success

These commands simply set the SMS text message format to ASCII instead of raw data and the other command might have something to do with the mailbox, would have to look at the AT command manual to know for sure. These are both fairly standard commands and should be supported on most modern GSM modems.

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi Benj

Thanks I see in my Module it also sets up the SMS. Is it possible to send more than 1 AT CMD in a string or do i have to send string then send character 13 for each AT CMD if I'm using the RS232 UART

Brian

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Hi Brian,

Each command needs to be terminated with a \r character or decimal 13 and you should send the command, wait for the response and then send the next command.

A typical serial transaction should look something like this.

Send "AT\r"
Receive "AT\rOK\r\n"

We often wait until the "\n" or value 10 decimal is received before sending the next command.

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi Benj

Thanks Iv'e sort of got it how would I receive the bytes back from the circular buffer so i can compare and see if OK or err Iv'e tried in a loop using the circular buffer component WaitForValue then compare but dont seem to be getting it right should i just wait for the 10 Char.

Brian

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Hi Brian,

One way would be to wait for the 10 char without deleting the contents of the buffer and then once you receive the 10 you can check for the keywords ERROR and OK before clearing the buffer ready for the next command.

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi Benj

Thanks again for your help I'm not quit sure how to check for key words Iv'e made a small program of what i think i should be doing but not sure if I'm on the right track please check and let me know.
Attachments
Receive_&_compare.fcfx
(9.41 KiB) Downloaded 151 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Hello Brian,

I have changed your code a bit to give you a hopefully fairly bullet proof send command macro with a timeout.
Receive_&_compare.fcfx
(13.48 KiB) Downloaded 196 times
Let me know how you get on.

Edit. After doing this I realised the CircularBuffer wait also had a time out so I could have simplified the macro quite a bit. Anyway you live and learn, not good when it's your own code though :D .

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi Benj

Thanks it works great for sending & reviving the response :D I also probably have not been asking the right question the module sends a long string of DATA say for example if call the module it sends me back

0d 0a 52 49 4e 47 0d 0a 0d 0a 2b 43 4c 49 50 3a ..RING....+CLIP:
20 22 2b 32 37 37 34 31 30 31 36 37 30 35 22 2c "+27741016705",
31 34 35 2c 22 22 2c 2c 22 22 2c 30 0d 0a 145,"",,"",0..

now what would like to do is just take the Phone number out or the RING out and send it back to the main processor for various functions. I have tried using the RS323 component but strings can only be 20 Characters long so not going to work and really not sure how the circular buffer works but have had a go at it hopefully I'm on the right track please let me know.

Brian
Attachments
TX_IN.fcfx
(11.53 KiB) Downloaded 128 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Hello Brian,

Strings can be any length you need them to be, the size of 20 is simply the default size. You can edit the string variable size by changing the number in the square brackets on the edit variable dialogue.
EditVarSize.jpg
EditVarSize.jpg (52.11 KiB) Viewed 12741 times

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi guys

I'm having a bit of trouble sending this DTMF CMD "AT+QLDTMF=5,"DTMF",1" where the DTMF is a string variable with the number being called in it e.g "0,7,4,1,0,1,6,6,6,6" . If i put the string called DTMF in and incest the semicolons either side it wont let me but if i leave them out it dose but won work. Is this because I'm already inserting a string variable in and don't need the semicolons. If i send this CMD (AT+QLDTMF=5,"0,7,4,1,0,1,6,6,6,6",1) from the PC it works not sure what I'm missing.

Brian

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Hi Brian,

The problem is your sending a string which has speech marks in which tells the compiler to close the string.

"AT+QLDTMF=5,"DTMF",1"

To get around this problem you need to escape the inner speech characters using the \ character.

"AT+QLDTMF=5,\"DTMF\",1"

As per your working PC example

AT+QLDTMF=5,"0,7,4,1,0,1,6,6,6,6",1

This would be

"AT+QLDTMF=5,\"0,7,4,1,0,1,6,6,6,6\",1"

Here is a bit of a guide on string escape characters.
http://en.wikipedia.org/wiki/Escape_character

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi Benj

Thanks but still dose not work

[2015-03-02 15:44:46:881_S:] "AT+QLDTMF=5,\"9,9,9,1,0,1,6,6,6,6\",1"<CR><LF>
[2015-03-02 15:44:46:943_R:] "AT+QLDTMF=5,\"9,9,9,1,0,1,6,6,6,6\",1"
[2015-03-02 15:44:46:990_R:]
[2015-03-02 15:44:46:990_R:] +CME ERROR: 3765

I send the string it echoes back the CMD with an Error but if i send the CMD as follows

AT+QLDTMF=5,"9,9,9,1,0,1,6,6,6,6",1
AT+QLDTMF=5,"9,9,9,1,0,1,6,6,6,6",1

OK

without the " and the \ it all works from PC But when i add the string to a string variable and send it, it wont work

I doing the following (DTMF ="9,9,9,1,0,1,6,6,6,6") then i add it to another string variable (send = "AT+QLDTMF=5,\"DTMF",1") and send it

Is there something I'm doing Wrong or should i be sending in a different format
Attachments
Send_CMD_Recive.fcfx
(16.73 KiB) Downloaded 139 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Hello,

Aha I didn't know DTMF was a variable. It all makes sense now, in this case this should work.

Replace

Code: Select all

send = "AT+QLDTMF=5,\".DTMF\",1"
With this...

Code: Select all

send = "AT+QLDTMF=5,"
send = send + .DTMF
send = send + ",1"

User avatar
jollybv
Flowcode v5 User
Posts: 374
Joined: Thu Feb 12, 2009 5:20 am
Location: Cape Town
Has thanked: 81 times
Been thanked: 25 times
Contact:

Re: GSM QuectelM95

Post by jollybv »

Hi Benj

Thanks that is nearly working just need the semicolons at the beginning and end of phone number, Iv"e have tried adding it but cant seem to get it right
What i had to do is split the String read_mem so i can put the coma in-between each number and thought i could add the semicolon's at the beginning and end of the string

It sends "AT+QLDTMF=5,+,2,7,9,9,1,0,1,6,6,6,6,1"

Instead of "AT+QLDTMF=5,"+,2,7,9,9,1,0,1,6,6,6,6","1" which the CMD requires I have tried adding the " " below but it won't accept it

.Dig1 = Left$ (read_mem,1)
.Dig2 = Mid$ (read_mem,1,1)
.Dig3 = Mid$ (read_mem,2,1)
.Dig4 = Mid$ (read_mem,3,1)
.Dig5 = Mid$ (read_mem,4,1)
.Dig6 = Mid$ (read_mem,5,1)
.Dig7 = Mid$ (read_mem,6,1)
.Dig8 = Mid$ (read_mem,7,1)
.Dig9 = Mid$ (read_mem,8,1)
.Dig10 = Mid$ (read_mem,9,1)
.Dig11 = Mid$ (read_mem,10,1)
.Dig12 = Mid$ (read_mem,11,1)

DTMF = "\"+.Dig1 + "," + .Dig2 + "," + .Dig3 + "," + .Dig4 + "," + .Dig5 + "," + .Dig6 + "," + .Dig7 + "," + .Dig8 + "," + .Dig9 + "," + .Dig10 + "," + .Dig11 + "," + .Dig12 + "," +\""

Any suggestions

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: GSM QuectelM95

Post by Benj »

Hi Brian,

How about this.

DTMF = "\"" +.Dig1 + "," + .Dig2 + "," + .Dig3 + "," + .Dig4 + "," + .Dig5 + "," + .Dig6 + "," + .Dig7 + "," + .Dig8 + "," + .Dig9 + "," + .Dig10 + "," + .Dig11 + "," + .Dig12 + "," + "\""

Might be better to split it up into multiple lines.

DTMF = "\"" +.Dig1
DTMF = DTMF + ","
DTMF = DTMF + .Dig2
....

Post Reply