Shop OBEX P1 Docs P2 Docs Learn Events
Need help with Extended_FDSerial. — Parallax Forums

Need help with Extended_FDSerial.

JMLStamp2pJMLStamp2p Posts: 259
edited 2011-11-27 07:00 in Propeller 1
I am sending commands from the Propeller to the TeLit-865cf (Cellular Chip) which operates via "AT" commands. When I send the following via Extended_FDSerial, is it necessary to convert the Numeric Values to ASCII equivalents? If I send these commands to the module in Hyper Terminal as is they work fine. Where can I find more detailed information on the Extended_FDSerial commands?
serial.str(String("AT+CNMI=1,1,0,0,0",13)) 

John.

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-11-24 20:10
    JMLStamp2p wrote: »
    When I send the following via Extended_FDSerial, is it necessary to convert the Numeric Values to ASCII equivalents?
    No, they already are their ASCII representation. Assuming you use PropTool press F8 and view the hex dump, look for the CNMI string, the numbers should be close by.
  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2011-11-25 07:08
    Thank you for your help ....
    John.
  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2011-11-25 09:13
    Would the correct way to send a "CTL+Z" at the end of this statement be:
    serial.str(String("AT+CNMI=1,1,0,0,0",26))
    
  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2011-11-25 09:32
    Can anyone tell me if they see anything wrong with this code. I simply want to send these ASCII commands to my cellular device "Telit-865cf". When I enter the commands in Hyper Terminal they work fine but if I enter them this way in code it does not work. I am using a Professional Development Board which is considered a DCE device. I am sending the commands to the TeLit which is also considered a DCE device. Also using a NULL Modem cable and have checked the Signals with my O'Scope and everything looks to be wired right. The TeLit has a MAX232 Device which converts the signals to the correct Level for the TeLit which is 2.8V. Using Extended_FDSerial, any Advise would be greatly appreciated.
    PUB MAIN
      
      serial.Stop                                             'Makes sure the Cog is stopped from running any processes.
      serial.RxFlush                                        'Flush the Cog's Receive Buffer.
      serial.start(26,25,0,115200)                     'Set-up Serial, Pin-26(Rx), Pin-25(Tx), Mode-0 "Invert Rx" & 115,200 Baud.
      
      serial.str(String("AT+CMGF=1",13))         'AT command that is sent to TeLit_865 Chip to set-up SMS Text Mode.
      wait
      
      serial.str(String("AT#SMSMODE=0",13))                  
      wait
                                                        
      serial.str(String("AT+CPMS=ME",13))                   
      wait
    
      serial.str(String("AT+CNMI=1,1,0,0,0",13))               
      wait
      
      serial.str(String("AT+CMGS+???????????",26))                'I need to send CTL+Z at the end of this line to get a > "to Enter the Message I want to send".
      wait
      
      serial.str(String("Testing Equipment",13))                         'Text Message to Send to Cellular Device with the ASCII "Enter" command at the end.                                             
      wait
    
  • Mike GMike G Posts: 2,702
    edited 2011-11-25 09:48
    Redirect the output to the Parallax Serial Terminal. If the data looks right verify your TeLit connections and serial configuration.
  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2011-11-25 10:38
    I have done both of those, I've read RS232 articles and looked St Data sheets until I feel like I wrote the Book :-)
    Everything looked good when porter to the Serial terminal, just having a Hard time figuring this one out.
  • Mike GMike G Posts: 2,702
    edited 2011-11-25 12:00
    If the Tx data is right, you have a configuration problem; hardware or software.
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-11-25 13:52
    My strategy to narrow down problems is for testing to use things that are well known to work properly.

    If you have a more simple command (i mean a single and shorter command than the ones in your code) try to make this command work.
    As you have tested the commands with hyperterminal. Check every detail how hypertemrinal was configured
    baudrate
    number of databits
    number of stop bits
    parity
    hardware handshaking
    software handshaking
    solder an Y-cable so that your telit device and hyperterminal can receive commands from a second PC at the same time
    Then send the commands from the propeller and compare each and every single byte sended from hyperterminal / sended from the propeller

    keep the questions coming
    best regards
    Stefan
  • kuronekokuroneko Posts: 3,623
    edited 2011-11-25 15:41
    Just an idle thought, have you tried inverting your rx/tx lines (I don't know your exact h/w setup but IIRC the 232 inverts the incoming and outgoing signals)? This can be done by starting the serial device with a different mode parameter.
    serial.start(26, 25, %00[COLOR="red"]11[/COLOR], 115200)
    
  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2011-11-25 18:02
    Hi Guy's, thank you for the advice! I have not been involved in programming for a while and really starting all over again. Do either of you guy's have a bit of sample code so I can Display the return statements from the TeLit in the serial terminal? On the first several commands the TeLit just responds with an "OK", that would give me some kind of Idea that I am on the right track. Also, the mode "%0011" statement in serial.start you have in Binary Right? I noticed that in the Driver the modes are listed in Dec. (0-3), is there only 4 options or am I missing something? In my Hyper Terminal session I have it set up for 115,200 Baud, No parity and One Stop Bit.

    Thanks again for your help, both of you !
    John.
  • Mike GMike G Posts: 2,702
    edited 2011-11-25 18:56
    Also, the mode "%0011" statement in serial.start you have in Binary Right? I noticed that in the Driver the modes are listed in Dec. (0-3)

    It's not decimal 0-3. It's bit index from LSB (Least significant bit) where 0 is the the right most bit. The example, 0011, is decimal 3 and inverted Rx/Tx in Extended_FDSerial.
    Index  3 2 1 0
    --------------------
    binary 0 0 1 1
    
  • StefanL38StefanL38 Posts: 2,292
    edited 2011-11-26 02:13
    with an the Y-cable you can se the telit-responds on hyperterminal or parallax serial terminal on a second serial prt (being a second PC or just a second port or USB-to-serial converter on the same PC)

    Propeller-pins 25,26<
    >telit

    Propeller-pins 30,31<----> any serial terminal software on your PC hyperterminal or parallax serial terminal or what ever you like else

    just define two Extended_FDX-objects and then
    just echo the received bytes from your telit-connection received on pin 26 towards the pc on pin 30

    keep the questions coming
    best regards
    Stefan
  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2011-11-26 08:00
    Thanks Mike, StephanL38 ...something you said fired a neuron as well :>) The TeLit uses Hardware handshaking, I need to Ground RTS to disable that !
    I am also re-writing my code to take advantage of ViewPort, I really appreciate you guy's taking the time to respond with your advice. This is the reason that I came back tot the Propeller for the great Forum !

    John.
  • electromanjelectromanj Posts: 270
    edited 2011-11-26 09:29
    Hello JMLStamp2p. It's been a while since I've done this, but I see a few things that might be causing you trouble. After you have done all the initial setup for the sms settings, try doing something like this to send an sms.

    serial.str(string("at+cmgs=",34,"phonenumber",34,13)) 'set where to send the sms and bring up the >
    waitcnt(clkfreq+cnt)
    serial.str(string("message you want to send")) ' tell the module what message to send
    waitcnt(clkfreq+cnt)
    serial.tx (26) 'send a control z to send the message.

    Hope this helps.

    traVis
  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2011-11-27 06:17
    electromanj, thank you for that suggestion ... Going to try it right now :>)
    One Question, on the command: AT+CPMS="ME"
    I'm not able to put Quotation marks around the "ME", like ( "AT+CPMS="ME"")
    Will this command still be interpreted right as: "AT+CPMS=ME"
    Where the "ME" is not in Quotation marks?

    Thanks so much for your help,
    John
  • Mike GMike G Posts: 2,702
    edited 2011-11-27 06:58
    $34 is the ASCII code for a double quote.
    http://www.asciitable.com/
  • JMLStamp2pJMLStamp2p Posts: 259
    edited 2011-11-27 07:00
    My Thanks to electromanj, Just got the Code to work with your suggestions ! I had to make a couple of other changes to my Code but the Propeller successfully sent the message.
    NOTE: Use a Null modem cable between the PDB and the TeLit, Ground DTR on the TeLit Eval board to disable Hardware Hand shaking, and Wire Jumper from Output Pin # 25 on the Prop Header to Tx output on the PDB female header (RS232 Serial output, Lower Bottom Left) of the PDB.

    Working Code:
    CON
       _clkmode = xtal1 + pll16x
       _clkfreq = 80_000_000
    
    OBJ
       serial: "Extended_FDSerial"
    
    VAR
       long Stack[400]
    
    PUB MAIN
    
       serial.stop
       serial.RxFlush
       serial.start(26,25,%0000,115200)
    
       serial.str(String("AT+CMGF=1",13))
       waitcnt(clkfreq+cnt)
    
       serial.str(String("AT#SMSMODE=0",13))
       waitcnt(clkfreq+cnt)
    
       serial.str(String("AT+CPMS=ME",13))
       waitcnt(clkfreq+cnt)
    
       serial.str(String("AT+CNMI=1,1,0,0,0",13))
       waitcnt(clkfreq+cnt)
    
       serial.str(String("AT+CMGS=",34,"+55555555555",34,13))        'Install your cell phone number in place of all the 5's ...
       waitcnt(clkfreq+cnt)
    
       serial.str(String("Testing the TeLit"))
       waitcnt(clkfreq+cnt)
    
       serial.tx(26)     'Send the message via CTL+Z
    
    
Sign In or Register to comment.