This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Sending Data and AT Commands to an LTE Module forwarding it to a webserver

Other Parts Discussed in Thread: LAUNCHXL2-570LC43, HALCOGEN

 Hi guys,

i am using a TI launchpad LAUNCHXL2-570LC43 and a Telit LTE Module LE910EU-V2. On my Launchpad i have connected a temp sensor DS1621 (which is currently not working so i send something else). I want to send data over the SCI Uart interface to the telit module which can interact with AT commands and i want to send this to a webserver.

Basically my questions are:

1) Can i pass data and AT commands over the SCI interface?
2) What would be the best solution for a webserver to get followed data.

I have a normal c struct containing four uint8 variables. One for the field length, one for the channel (this is for later that i can say on channel 1 i have the button/led and on channel 2 comes data from the temp.sensor), and the last two are now for the example specified for the led example like which led ID (because on the board i have led 3 and 4) and the ledCMD is On/off. i have attached my testrproject.

Basically what i want to achieve at first sight is that i press on button GIOB_4 that LED2 gets on or off and by button GIOB_5 LED5 gets on/off (depending if they are already on or not). And i want to implement a button on the webpage that i can turn the led on/off from the webpage. so it should work in both directions.
Lets assume both leds are off. If i press button giob_4 i want that led2 gets on and i want to send this to the LTE Module. This module can be used as a pipe and send data to a webserver.
i could already achieve that the Ti can send and receive the C-struct (i tested it with hTerm, a hyper terminal programm).

3) But since there are many options to program a webserver, one question is what would be the easiest webserver? Apache? or should i programm a php-file on my own?
And this is basically important to know how to use the webserver, because i need to know how i have to pass the data to it.

4) Is the Socket the best solution or should i use TCP or UDP?

I also attached two pictures. how it should look like. The first picture shows just the ti board connected with a ttl to rs232 converter and the second picture should show the lte module.

I am gratefull for every hints or answers i can get what is possible to program and achieve with the Ti MCU for my project and what i have to consider or what doesnt work with the Ti and what i have to do separatly to CCS / Halcogen.

regards
Markus

3362.Test.zip

  • Hi Markus,
    do you want to make an autonomous weather station like device?
    Regards, Szilárd
  • Hi Szilard,


    no at the beginning i want to send data (c-struct or hello World or temp. data) over the sci/uart connection and send them via AT commands to a webserver (like apache) and then i want to open a browser and see the data i have sent.

    But to the LTE module i am using is listening to AT-commands like "AT#HTTPCFG" etc. and i need to send this over the uart to the module.

    For me it is important to know if this is somehow possible whether i can send at commands or not. Because if not i have to send i special string with the data i want to send and then the module has to listen whether this string came or not. But i would like to use only one code and one programme to transmit the data to the webserver.


    can you help me or give me some hints?

    regards, markus

  • Hi Markus,
    Sorry for late answer, I was on holiday. So I don't really understand what the problem is. You can configure SCI for example 9600,8N1 and there is two functions in HALCoGen generated API sciSendByte() and sciSend() for sending character or string.
    Regards: Szilárd
  • Hey szilard,

    thanks you are right its working now with the functions.

    But i have one more question:
    On my telit module i see that it has the character set for mobile equipment to "IRA". So if i make "at+cscs?" the answer ist "IRA".
    The supported sets are: "+CSCS: ("GSM","IRA","8859-1","PCCP437","UCS2","HEX")"

    now my question is:
    I have the function: void atCommand(char atcmd[], uint32 atcmdLen, uint32 minResponLen, char debugInfo[]);

    so my question is:
    if iwant to send "atCommand("at+cgdcont=3,IP,testest\r", 36, 46, "Step 4: PDP Conetext defined")," over the sci interface, is this "GSM" or how do i know this?
    And can i set it to "IRA" or anything else?

    i never saw IRA before so i have no clue what this is to be honest.

    i am thankful for every advice and hint.

    regards

    Markus

  • Hi Markus,
    There is a wikipedia article about IRA see: en.wikipedia.org/.../ITU_T.50.
    Do I understand right, that you have to implement your own version of atCommand() function?
    Regards, Szilárd
  • Hi szilard,

    ok but the wikipedia article doesnt tell me the encoding of the ti mcu :). Do you know this if it is one of the list i posted above (which are supported from my lte module)?

    i want to send data over the internet to a webserver with the lte module. For this i have to configure the lte module and open a socket internet connection over at commands and make a http GET request to my webserver.
    For this i know a sequenz of at commands which i have to execute one after another. i will post the at commands in the end of this post. (i know that it works with this combination because with the lte module and a terminal like hTerm i could switch an led connected to my webserver on and off with at commands).

    The Problem is now just the right(!!) communication settings between the two devices. For this i want to be sure that the settings to send this to my lte module is correct.

    I will attach my ccs and halcogen code too.

    here is the list of at commands:
    1)   at+cgdcont=1,IP,internetm2m.air.com  (Define PDP context)
    2)   at#sgact=1,1            (Context activation = open socket)
    3)   at#httpcfg=0,markusauer.ddns.net,80,0,0,0,0,120,1   (configure http server paramteter)
    4)   at#httpqry=0,0,/gpio.php?on=ON    (send http get request and turn led on)    off=OFF to turn in off obv.

    and when i type in a terminal to check the encoding from my lte module with at+cscs? it comes "IRA". And due to that this seems to be the standard for this module (it doenst matter if i set GSM after a reboot of the device its again IRA) i need to know which encoding the ti mcu uses and if it has anotherone how to set up another one.

    Hope you can help !!! Or you know someone you can help :).

    regards
    Markus

    6366.uC-LTE-Simulation.zip

  • Hi Markus,
    As I see, IRA, ASCII, CP1250, even UTF8 contains same characters on the first 127 place. Actually MCU has no "encoding" it sends series of 8 bit long numbers from 0 to 255 (dec). Encoding is a property of your text editor, but you dont have to care about it, if your application uses only english characters.

    Check your hTerm serial setting for the right communication parameters (for example 9600 baud, 8 bit, No parity, 1 stop bit) and use them for configuring SCI(x) port in HALCogen. After generating HALCoGen code firstly you have to call scInit() in your main() function, and after that you can call sciSend() or sciSendByte() functions as  mentioned before.

    Sorry, I had no time for checkinkg your project yet.

    Regards, Szilard

  • Hi Szilard,

    1) okay. So basically if i just want to send a set of AT-commands as char array like "at+cgdcont=3,IP,testest"  (char atcmd[ ] ) and if its then not working it can't be the encoding. is that right?

    2) i saw that my settings in halcogen were 9600 baud, 8 bit, no par, 2 stop bits and in hTerm it is 115200 baud, 8 bit, no par, 1 stop bit(!). the baudrate difference shouldnt be a problem because i have made an own function "initSCI()" where i execute "sciInit()" and then i change the baudrate with "sciSetBaudrate()" to 115200. I will also read it in the internet to know it better but can you maybe also discribe what the stop bits are really doing and if it can cause the problem?
    Now i will change the baudrate to 115200 and the stop bit from 2-->1 in halcogen and i try it again.

    3) yes i first initialise it with the function i made (which includes the function sciInit() which you mentioned) and then i use in the while loop in the main function the functions sciSend and sciReceive etc..

    Tell me when you had time to check my project. my time is running for this project and i get more and more to the end of my knowledge :).
    Thanks for the help though!

    regards,
    Markus

  • Hi Markus,
    Baud rate, parity, and number of stop bit are also important! Use same settings on both side. I assume, that you have some usb/serial interface with 3.3V logical level. In this case you can check the MCU's communication with your terminal program. If it looks good, you can try with the LTE module.
    Regards, Szilárd
  • Hi Szilard,

    ok i have another problem now (i made a new post for this, a link is at the bottom of this post).
    how can i find out about the logical level?
    i mean the communication from mcu to laptop and from laptop to lte module (separatly) works fine. just if i connect mcu to lte module it doesnt work.
    the strange part is even when in halcogen its 9600,8N2 and i just change inside my ccs code the baudrate and i connect mcu to laptop and i connect the terminal with com port 1 with 115200, 8N1 its working. so i assume it is not the stop bit what causes the problem, right?

    regards
    Markus

    Error occurs Post:
    e2e.ti.com/.../542892


  • Hi Markus,
    Please set up same settings on both side! Don't play with different communication settings - just wasting your time. Check, that RX connected to the TX at the other side (and reverse: TX connected to RX). For your other question, hercules uses 3.3V I/O similar to the most of nowadays circuits. Check the datasheet of the particular device for its I/O (logical level) compatibility. I'd like to recommend a tutorial about serial line:
    www.sparkfun.com/.../215
    And there is a good book www.sparkfun.com/.../215 on embedded systems.

    Regards, Szilárd