Shop OBEX P1 Docs P2 Docs Learn Events
Little serial confusion — Parallax Forums

Little serial confusion

arnoarno Posts: 43
edited 2006-06-05 19:06 in General Discussion
Hello,
Sorry for this simple question but how did you define if you have to invert or dontInvert a serial signal ?

I have some problem to make my Javelin talk to a GSM/GPS Siemens XT55

It's look like they can't talk together, and I can't figure out Why.
I try all kind of config and nothing happen. The module is on, and by default it's in autobaud mode.

but I send an AT then an AT+PIN and I have no error code back and no connection to the GSm.

I try to connect a PC in parallel of the TX (from the GSM) and at 9600, N, 8, 1 (same as the javelin config) I have a bunch of code but can't find what speed or config it is.

Any clue on how to debug this ?


thanks in advance,
arno
«1

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-02 08:15
    static final int txPin = CPU.pin0;
    static final int rxPin = CPU.pin1;

    You define a transmit uart as

    Uart tx = new Uart(Uart.dirTransmit,txPin,Uart.dontInvert,Uart.speed9600,Uart.stop1);
    or
    Uart tx = new Uart(Uart.dirTransmit,txPin,Uart.invert,Uart.speed9600,Uart.stop1);

    You define a receive uart as

    Uart rx = new Uart(Uart.dirReceive,rxPin,Uart.dontInvert,Uart.speed9600,Uart.stop1);
    or
    Uart rx = new Uart(Uart.dirReceive,rxPin,Uart.invert,Uart.speed9600,Uart.stop1);

    Note that the javelin has TTL level signals (0/5V).
    To convert to RS232 level signals (-10/+10V), use the COM connector on the javelin demoboard
    or connect a level shifter like max232 to the javelin.

    regards peter
  • arnoarno Posts: 43
    edited 2006-06-02 08:21
    well here it what i use:

    final static int GSM_RX_PIN = CPU.pin1; // DB9 pin 3
    final static int GSM_TX_PIN = CPU.pin2; // DB9 pin 2
    final static int GSM_POWER_PIN = CPU.pin3; // DB9 pin 3

    // GSM serial init, IN and OUT
    static Uart rxGSM = new Uart( Uart.dirReceive, GSM_RX_PIN, Uart.invert,
    Uart.speed9600, Uart.stop1 );
    static Uart txGSM = new Uart( Uart.dirTransmit, GSM_TX_PIN, Uart.invert,
    Uart.speed9600, Uart.stop1 );

    // GSM init (power, on, PIN code, wait for GSM network
    CPU.delay(21); //21*98.5usec= ~20msec after power up
    CPU.writePin(GSM_POWER_PIN, true);
    if ( DEBUG )
    System.out.print("GSM on\n\r");
    CPU.delay(205); //205*98.5usec= ~200msec
    CPU.writePin(GSM_POWER_PIN, false);
    // wait form GSM on
    CPU.delay(32767);
    CPU.delay(32767);
    CPU.delay(32767); //total 9.68 sec
    txGSM.sendString ("AT+CPIN=9878\r");
    if ( DEBUG )
    System.out.print("PIN code send\n\r");
    CPU.delay(32767);
    if ( ReadGsm() > 0 ) {
    if ( DEBUG )
    Format.printf( "PIN error: %s\n\r", GSMcode.toString() );
    }
    else if ( DEBUG )
    System.out.print( "PIN OK\n\r" );


    // Read any GSM messages
    // return 0 if OK, and > 1 if code -> and data stored into Code
    private static int ReadGsm() {
    while ( rxGSM.byteAvailable() ) {
    GSMbyte = (char)rxGSM.receiveByte();
    if ( GSMbyte == CR || GSMbyte == LF ) // remove any CR/LF code
    continue;
    GSMdata.append( GSMbyte );
    }

    if ( ! GSMdata.equals( "OK" )){
    GSMcode.clear();
    GSMdata.subString( 1, GSMdata.length()-1, sbuf );
    GSMcode.append( sbuf.toString() );
    return GSMcode.length();
    }
    return 0;
    }


    but that dosen't help !!!

    I still don't have anue clue in when you should use invert and when donInvert (at least this point)

    but thanks for looking into my problem
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-02 09:13
    I added some extra debug statements to your code.
    What exactly is your output with this program?
    Do you have any manual for your GSM?

    regards peter
  • arnoarno Posts: 43
    edited 2006-06-02 09:29
    Well the output of this program is just an empty string after the error messages
    so It can be a code that can't be displayed.
    Good idea to put in hexa.

    Yes I do have all the manual for it, 2 tine 2.5 meg (the hardware guide and the AT code set)

    Thanks for your input I will try it

    is the t.timeout better than the CPU.delay ? (it's look like the timeout is based on msec and the delay is in 98.5 usec)

    why did you do thta:
    if ( ((GSMbyte&0xFF) == CR) || ((GSMbyte&0xFF) == LF) )

    since CR and LF hare decimal code and this (char)rxGSM.receiveByte() return a decimal value no ?
  • arnoarno Posts: 43
    edited 2006-06-02 09:35
    I just send you an email with the manual and the full code
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-02 09:41
    Both char/byte and int take 2 bytes in memory,
    the exception is array of char/byte (1byte per element)
    By ANDing with 0xFF I make sure there is no sign extend to
    the higher byte. I therefore always use int for simple variables.
    I use char only in char array. Note that the uart receive returns
    an int with its high byte cleared.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-02 10:00
    From the manual page 55 chapter 3.9.3 I Tablee 14 I read

    Table 14: DCE-DTE wiring of 2nd serial interface (GSM/GPRS part)
    [font=Arial,Bold size=2]V.24 DCE (XT55) DTE (application)
    circuit Pin function Signal direction Pin function Signal direction
    [/font]103···· GSM_TXD1··· Input·················· /TXD············ Output
    104···· GSM_RXD1·· Output················ /RXD············ Input
    105···· GSM_RTS1·· Input·················· /RTS············ Output
    106···· GSM_CTS1·· Output··············· /CTS············· Input

    It looks you must use the 2nd serial interface for AT control, using the pins /TXD /RXD /RTS /CTS.
    These pins have RS232 level signals (V24).
    you need to connect these pins through a level shifter to the javelin.
    You can make a local handshake by connecting /RTS to /CTS,
    or use the javelin Uarts with handshake.
    If you use the javelin demoboard then you can use its onboard level shifter.
    Otherwise you need to use an external levelshifter like MAX232.

    Do you have a schematic how you connected the javelin to your gsm?

    regards peter
  • arnoarno Posts: 43
    edited 2006-06-02 10:22
    I use port 0 not the port 1
    and it is a straigth connexion, no level convert
    And I didn't implemet flow control neither hardware or woftware.

    And on page 54:
    interfaces conforming to ITU-T V.24 protocol DCE signaling. The electrical characteristics do
    not comply with ITU-T V.28. The significant levels are 0V (for low data bit or ON condition)
    and 2.65V (for high data bit or OFF condition). For electrical characteristics please refer to
    Table 38. Figure 1 shows the serial interfaces of the XT55 module.


    So if the javelin is doing 0 and 5v, maybe my 2.65v is to low for it.But can I do just 5v with the MAX converter or is it +-12v ?
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-02 12:28
    Yes I see.
    2.65V should be suffient for the javelin to see it as a logic 1
    (the javelin logic has 2.5V treshold, so voltage<2.5V is logic 0 and voltage>2.5V is logic 1).
    Question is if the 5V that the javelin outputs is not too high for the gsm
    (it would if the gsm operates at 3.3V)

    But lets assume you are right.
    Port 0 pins for data:
    GSM_TXD0 then connects to the javelin uart transmit pin
    GSM_RXD0 then connects to the javelin uart receive pin
    for handshake:
    GSM_CTS0 then connects to the javelin uart transmit handshake pin
    GSM_RTS0 then connects to the javelin uart receive handshake pin
    or make local handshake by connecting GSM_CTS0 to GSM_RTS0
    Normally in modem connections DTR is monitored for connected devices.
    GSM_DTR0 then connects to javelin pin for ON/OFF

    The table 14 shows pin functions as inverted (/ in front of TXD0)
    so it maybe you must use Uart.invert in your uarts.
    The one thing that is different between your setup and the above, is the
    local handshake between RTS and CTS. If you do not have this, and your
    gsm communication parameter setup has RTS/CTS handshake enabled, then
    it may be the gsm is waiting for a logic low at pin GSM_RTS0.

    If you have the javelin pins to spare, I suggest using uarts with handshaking, for now,
    until you got the communication going.

    regards peter
  • arnoarno Posts: 43
    edited 2006-06-02 12:50
    Yes the GSM operate at 3.3V, so I will put a resistor in middle and use the hardware handshake to see if that help.

    Thanks for your help/advise

    regards,

    arno
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-02 12:59
    I hope the gsm input pins are then 5V tolerant (they usually are).

    You could make a resistor divider for javelin pins that are outputs
    to the gsm pins that is an input.

    javpin output ·
    [noparse][[/noparse]3k3]-+
    gsm pin input
    ··························|
    ························[noparse][[/noparse]6k8]
    ························· |
    ·························-+- 0V

    That turns 5V into 3.3V

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-02 13:13
    Description of TX55 evaluation board:
    http://www.mcs-nl.com/files/nl/m2m/siemens/xt55/gsm_gps_eval_board_v01.pdf
    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-02 13:28
    Firmware update manual, has serial schematic for mmi processor (figure 5, page 10).
    http://www.wdm.se/alla/XT55/Application%20Notes/xt55_an_16_fw_update_v06.pdf
    Figure 6 shows PC interface!
    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-02 15:48
    From the firmware update manual schematic,
    it looks like the module is powered on
    when /IGT pin is set to low.
    In that schematic a transistor is used to pull the /IGT pin low.

    You can use a javelin pin directly.
    Make the pin a low output·and \IGT gets pulled low.
    Make the pin an input and \IGT becomes HiZ.

    So, to power on:
    ··· CPU.writePin(GSM_POWER_PIN, false);
    to power off
    ··· CPU.setInput(GSM_POWER_PIN);

    regards peter

    Post Edited (Peter Verkaik) : 6/4/2006 8:20:46 AM GMT
  • arnoarno Posts: 43
    edited 2006-06-05 09:08
    Hello,
    So I did many change of my code. (thanks Peter for your idea)
    Actually the Javelin was talking to the GSM but due to some error (or misunderstanding) of the output of the GSM I wasn't able to handle correctly the return. (the GSM has the local echo turn on, and I didn't expect that, no I turn it on at the begining)
    So I did some cleaning of my ReadGsm function, but maybe to mutch !!
    It was working until I enter the PIN code to my gsm, the GSM give me an error 4 (operation not allowed) but that's because the PIN code wasn't need (maybe,never have the chance to test without it).
    So I handle a little more about the error return (this line: if ( !GSMdata.equals("ERROR") ))

    and know for what ever reason the Javelin go to the first 10-15 line the loop forever where their is no loop in my code, and sometime gos out with a indexOutofBounds exception or somthing like that (in string Buffer, but when the program crash I did't call it yet).

    so here is the ourput of my terminal:
    GSM on
    GSM on
    end delay 1
    GSM on
    end delay 1
    GSM on
    end delay 1
    GSM on
    end delay 1
    GSM on
    GSM on
    GSM on
    and going and going.

    what the heck is that ?!? whiy is he looping like that ?

    any clue/helpwill be greatly appreciate.

    I attached the cade also.
    maybe not the best I write but I thuink anybody can read it.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-05 09:45
    After the last line in your main(),
    add the line
    · while (true) ;

    This keeps the javelin alive doing nothing.
    Without it, main() exits and probably restarts, but that is undefined.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-05 09:57
    According to the output, the javelin resets in Initialize().
    I noticed you use CPU.writePin(GSM_POWER_PIN,true)
    to turn off the gsm.
    According to schematics the gsm is powered of if GSM_POWER_PIN is floating.
    It may be that driving that pin high creates a voltage dip which may
    result in the javelin's ·reset. The javelin is quite sensitive to power supply
    ripple.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-05 10:04
    Your CPU.delay(21) must be CPU.delay(210) for a 20 msec delay
    in Initialize().
    regards peter
  • arnoarno Posts: 43
    edited 2006-06-05 10:22
    Thanks for the 2 inputs.

    CPU.delay I change it, so now I realy wait 20ms

    GSM_POWER_PIN is active low, and regading the Manual I sould left it open or HiZ, how can I do that ? should left it low after m power on procedure ?

    Style the same result, actually I just got 1 time the GSM on messages then 3 time a messages main start (just a system.ou.println I had as a first line in main procedure.

    more clue for me ?
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-05 10:22
    It most likely is a generated bytecode sequence that is misinterpreted.
    Capture the start of Initialize in try/catch like

    ··· try {
    ··· GPSstate = NP_STATE_SOM;· // Ready to take commande '$' on GPS
    ··· GSMcmd.clear();
    ··· GSMdata.clear();

    ··· // GSM init (power, on, PIN code, wait for GSM network
    ··· CPU.delay(21); //21*98.5usec= ~20msec after power up
    ··· CPU.writePin(GSM_POWER_PIN, true);
    ··· GSMPower = false;
    ··· if ( DEBUG )
    ····· System.out.print("GSM on\n\r");
    ··· CPU.delay(2000); //2000*98.5usec= ~197msec
    ··· CPU.writePin(GSM_POWER_PIN, false);
    ··· GSMPower = true;
    ··· GSMstate = GSM_STATE_ON;
    ··· GSMstatus = GSM_STATUS_ON;
    ··· // wait form GSM on
    ··· CPU.delay(32767);
    System.out.println("end delay 1");
    ··· CPU.delay(32767);
    System.out.println("end delay 2");
    ··· CPU.delay(32767);· //total 9.68 sec
    ··· }
    ··· catch (Exception e) {
    ····· Format.printf("Init exception\n");
    ··· }

    That sometimes resolves these kind of errors.

    regards peter
  • arnoarno Posts: 43
    edited 2006-06-05 10:24
    oup sorry find the answer about the hiz stuff in a post before:
    CPU.setInput(GSM_POWER_PIN);

    I will do that
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-05 10:25
    Use CPU.setInput(GSM_POWER_PIN) to make the pin floating.
    It may be that setInput() is still private in class CPU.
    Then just make it public. Disable the readonly property
    of the CPU.java file before editing the file.
    regards peter
  • arnoarno Posts: 43
    edited 2006-06-05 10:43
    So I'm an idiot !!
    The probleme come from my power suplly, dosen't handle the load !!
    So the power come down to 4.5 volts and the Javelin do reset itself jst when the GSM start !!!

    Rhaaaa that unacceptable.

    So I change it and now I have :
    GSM on
    main start
    GSM on
    end delay 1
    end delay 2
    call readgsm
    Start while
    End while


    So the problem is on myReadGsm loop during the test of the answer from my GSM.
    if ( GSMdata.indexOf("OK") == -1 || ! GSMdata.equals("0") ) { // the GSM can answer the ok in 2 form OK or 0
    if ( !GSMdata.equals("ERROR") ) { // if I have the error messages in it treat it
    GSMret = GSMdata.indexOf(":");
    GSMdata.subString( GSMret+1, GSMindex-GSMret+1, GSMcode );
    }
    return 1; // if error code just return 1 and the error messages into GSMcode. The error can be: ERROR or +CME ERROR: bla bla bla
    }
    return 0; // If OK (or 0) just return with value 0
    Actually I have some proble to figure out what I need to do !!
    The answer can be:
    OK (or 0) if everything is in order
    ERROR (undefine error)
    +CME ERROR: bla bla bla
    +atcommand (like +CREG:bla bla bla, network registration) the answer to a request, and I'd like to have the bla bla bla copy into the GSMcode
    ^atcommand to (like at^SMGR read sms fromstorage) treat like a +atcommand

    can you give me some hint ? the return code has to be 0 for the ok, and 1 (or more) for an error or a command with answer
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-05 11:20
    Put the following lines just before your error code:

    ··· Format.printf("GSMdata in hexbytes\n");
    ··· for (int k=0; k<GSMdata.length(); k++) {
    ····· Format.printf("%02x ",GSMdata.toString().charAt(k)&0xFF);
    ··· }
    ··· Format.printf("\n");

    It displays all the GSMdata bytes in hexvalues.
    Then you know what you receive as response.

    regards peter
    ·
  • arnoarno Posts: 43
    edited 2006-06-05 11:26
    here is the output:
    main start
    GSM on
    Start while
    End while
    GSMdata in hexbytes


    then crash with
    IndexOutofBoundException in StringBuffer
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-05 11:28
    Also, I would not discard any byte, even if non-printable,
    before knowing exactly what is returned.

    // Read any GSM messages Len is the· At command len
    // return 0 if OK, and· 1 if code -> and data stored into Code
    · private static int ReadGsm2() {
    ··· GSMdata.clear();
    ··· GSMcode.clear();
    ··· GSMindex = 0;
    System.out.println( "Start while" );
    ··· while (· rxGSM.byteAvailable() ) {
    ····· GSMbyte = (char)rxGSM.receiveByte();
    //····· if( GSMbyte < 0x20 ) // if not printeable char or CR/LF forget it
    //······· continue;
    //····· if ( DEBUG )
    //······· Format.printf( "GSMbyte: %c\n\r", GSMbyte );
    //····· GSMindex++;
    ····· GSMdata.append( GSMbyte ); //·store to GSMdata
    ··· }
    System.out.println( "End while" );

    ··· Format.printf("GSMdata in hexbytes\n");
    ··· int k=0;
    ··· while (k<GSMdata.length) {
    ····· Format.printf("%02x ",GSMdata.toString().charAt(k++)&0xFF);
    ··· }
    ··· Format.printf("\n");
    ··· if (GSMdata.length > 0) {
    ····· if ( GSMdata.indexOf("OK") == -1 || ! GSMdata.equals("0") ) {
    ······· if ( !GSMdata.equals("ERROR") || ! GSMdata.equals("ERROR:") ) {
    ········· GSMret = GSMdata.indexOf(":");
    ········· GSMdata.subString( GSMret+1, GSMindex-GSMret+1, GSMcode );
    ······· }
    ······· return 1;
    ····· }
    ··· }
    ··· return 0;
    · }

    regards peter


    Post Edited (Peter Verkaik) : 6/5/2006 11:42:33 AM GMT
  • arnoarno Posts: 43
    edited 2006-06-05 11:44
    Many thing come out:
    main start
    GSM on
    Start while
    End while
    GSMdata in hexbytes
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F8
    AT send
    Start while
    End while
    GSMdata in hexbytes
    41 54 0D 0D 0A 4F 4B 0D 0A
    AT OK
    ATE0 send
    Start while
    End while
    GSMdata in hexbytes
    41 54 45 30 0D 0D 0A 4F 4B 0D 0A
    ATE OK
    AT+COPS=0
    Start while
    End while
    GSMdata in hexbytes
    0D 0A 4F 4B 0D 0A
    GSM auto reg OK
    AT+CREG=1
    Start while
    End while
    GSMdata in hexbytes
    0D 0A 4F 4B 0D 0A
    GSM registering OK
    AT+CREG?
    Start while
    End while
    GSMdata in hexbytes
    0D 0A 2B 43 52 45 47 3A 20 31 2C 30 0D 0A 0D 0A 4F 4B 0D 0A
    AT^ssync=1
    Start while
    End while
    GSMdata in hexbytes
    0D 0A 4F 4B 0D 0A
    SYNC OK
    AT+CMGF=1
    Start while
    End while
    GSMdata in hexbytes
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-05 11:46
    I just checked the StringBuffer class.
    The original StringBuffer had an error in the IndexOf().
    A corrected version is located here:
    http://groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/java/lang/

    The same applies to the String class. Corrected version also there.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-06-05 11:53
    Ok, now also print printable.

    // Read any GSM messages Len is the· At command len
    // return 0 if OK, and· 1 if code -> and data stored into Code
    · private static int ReadGsm2() {
    ··· GSMdata.clear();
    ··· GSMcode.clear();
    ··· GSMindex = 0;
    System.out.println( "Start while" );
    ··· while (· rxGSM.byteAvailable() ) {
    ····· GSMbyte = (char)rxGSM.receiveByte();
    //····· if( GSMbyte < 0x20 ) // if not printeable char or CR/LF forget it
    //······· continue;
    //····· if ( DEBUG )
    //······· Format.printf( "GSMbyte: %c\n\r", GSMbyte );
    //····· GSMindex++;
    ····· GSMdata.append( GSMbyte ); //·store to GSMdata
    ··· }
    System.out.println( "End while" );

    ··· Format.printf("GSMdata in hexbytes\n");
    ··· int k=0;
    ··· while (k<GSMdata.length) {
    ····· Format.printf("%02x ",GSMdata.toString().charAt(k++)&0xFF);
    ··· }
    ··· Format.printf("\n");
    ··· Format.printf("GSMdata in ascii bytes\n");
    ····k=0;
    ··· while (k<GSMdata.length) {
    ····· int c =·GSMdata.toString().charAt(k++)&0xFF;
    ····· if ((c>=32) && (c<=126)) Format.printf("%c",c);
    ····· else·Format.printf(".");
    ··· }
    ··· Format.printf("\n");
    ··· if (GSMdata.length > 0) {
    ····· if ( GSMdata.indexOf("OK") == -1 || ! GSMdata.equals("0") ) {
    ······· if ( !GSMdata.equals("ERROR") || ! GSMdata.equals("ERROR:") ) {
    ········· GSMret = GSMdata.indexOf(":");
    ········· GSMdata.subString( GSMret+1, GSMindex-GSMret+1, GSMcode );
    ······· }
    ······· return 1;
    ····· }
    ··· }
    ··· return 0;
    · }
  • arnoarno Posts: 43
    edited 2006-06-05 12:17
    here it goes:

    main start
    GSM on
    Start while
    End while
    GSMdata in hexbytes
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F8
    GSMdata in ascii bytes
    ........................................................................................
    AT send
    Start while
    End while
    GSMdata in hexbytes
    41 54 0D 0D 0A 4F 4B 0D 0A
    GSMdata in ascii bytes
    AT...OK..
    AT OK
    ATE0 send
    Start while
    End while
    GSMdata in hexbytes
    41 54 45 30 0D 0D 0A 4F 4B 0D 0A
    GSMdata in ascii bytes
    ATE0...OK..
    ATE OK
    AT+COPS=0
    Start while
    End while
    GSMdata in hexbytes
    0D 0A 4F 4B 0D 0A
    GSMdata in ascii bytes
    ..OK..
    GSM auto reg OK
    AT+CREG=1
    Start while
    End while
    GSMdata in hexbytes
    0D 0A 4F 4B 0D 0A
    GSMdata in ascii bytes
    ..OK..
    GSM registering OK
    AT+CREG?
    Start while
    End while
    GSMdata in hexbytes
    0D 0A 2B 43 52 45 47 3A 20 31 2C 30 0D 0A 0D 0A 4F 4B 0D 0A
    GSMdata in ascii bytes
    ..+CREG: 1,0....OK..
    AT^ssync=1
    Start while
    End while
    GSMdata in hexbytes
    0D 0A 4F 4B 0D 0A
    GSMdata in ascii bytes
    ..OK..
    SYNC OK
    AT+CMGF=1
    Start while
    End while
    GSMdata in hexbytes

    GSMdata in ascii bytes

    so at least now I can start to handle the return to have what I need: OK, + (or ^) result command, +error and discard the other (00, f8 ), CR/LF
Sign In or Register to comment.