Question

Greetings,

My project is to send some data to http server from zedboard via GSM module(through AT commands). I have designed the hardware connection in vivado (conected rx,tx,vcc and gnd pins in JB connector) . I have set the baudrate to 115200(for module hilo) and I think I am sure that the tx and rx pins are perfectly working.

Now my question is how to send AT commands to GSM module. For those who dont know about GSM module , I ll just brief about its working.

Basically in GSM modules, if some characters(AT COMMANDS) are typed and sent , the GSM module will respond with some characters. For example,

1. If I type 'A','T' (2 characters in this case) , the response from GSM module will be OK('O','K')

2. If I type 'A','T','+','C','P','I','N','?' (7 characters), the response will be 'C','P','I','N',':','R','E','A','D','Y' (CPIN:READY)

So basically I have to send some commands from tx pin of zedboard to rx pin of GSM module. And I have to receive some response from tx pin of GSM to rx pin of zedboard. Hope everybody gets the basic idea.(only for those who doesnt know abt GSM module. Not for pros😀)

 

So I have wrote some code, which will send the commands to the baseaddress of UARTLITE ( I have used AXI UARTLITE for this module).  The problem is that I m sending the data to the UARTLITE address and searching for the response from the same UARTLITE baseaddres.  But I dont know from which address to read the response back..  Hope all got my question. For your convenience, I will post some part of the code.

 

    unsigned char Sender1[] = {'A','T','\0'};

    unsigned char Sender2[] = {'A','T','D','+','4','9','1','7','6','3','0','1','7','4','8','1','4',';','\0'};

int Index =0;
        int i = 0;
        int u=0;
        SendBuffer[Index]='\0';
        RecvBuffer[Index]='\0';

        while(Sender != '\0'){
                        for (Index = 0; Index < TEST_BUFFER_SIZE; Index++) {
                                         SendBuffer[Index] = Sender[i+Index];
                                            XUartLite_SendByte(UARTLITE_BASEADDR, SendBuffer[Index]);
                        }

                        for (Index = 0; Index < TEST_BUFFER_SIZE; Index++) {
                            RecvBuffer[Index] = XUartLite_RecvByte(UARTLITE_BASEADDR);

                            Receiver[i+Index] =  RecvBuffer[Index];
                        }
                        i = i + TEST_BUFFER_SIZE;
                        u++;

Share this post


Link to post
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Hi,

I think your question until now is completely independent of the GSM module, but it's about the UART.

To debug that, put the GSM module aside for now and simply connect the Tx- and Rx pins on the zedboard side (loopback test).You should be able to read back the same data you're writing.

 

Share this post


Link to post
Share on other sites
  • 0

Hello @xc6lx45 Thanks for ur reply. Its completely dependent on the GSM module. And I have verified the loopback test as well. They are perfectly working.

The response should be from the tx pin of GSM module. I have to send some commands from tx pin of UART of zedboard. And I should receive some response from the GSM module from the tx pin of GSM to the rx of zedboard. I think I have explained my doubt clearly in the above post. Please go through the post once again and do the needful

\

Share this post


Link to post
Share on other sites
  • 0

yaaa sure......

1. I will share the link which will help to get the response from gsm module when connected with ARDUINO...

 https://stackoverflow.com/questions/36884514/get-at-command-response 

Just have a look at it ,so that you will get a flow of what is happening. And I will also share the datasheet as well..

2. This is the link for the user manual of HILO module.

https://fccid.io/VW3HILOC/User-Manual/Users-Manual-965333

I will also attach AT commands list in a file and what will be the response from the GSM module. PFA the file. Just have a look at it and help me in this process.

AT Command Set for SAGEMCOM Hilo3G Module draft 0.2.pdf

Share this post


Link to post
Share on other sites
  • 0

Hi @Sridhar Prasath Aruppukottai Ganesan,

From the users guide it looks like the GSM module uses a uart interface like the Pmod GSM IP Core.  Typically the process i would take when creating an IP Core is to get the interface working, then configure the module.  Lastly, i get the send/receive data working then manipulate the data to what i want. We will be able to help you when you get stuck in this process. Unfortunately, I have not used AT commands. It looks like the AT command pdf you linked is where you will want to look for the configure information. 

cheers,

Jon

Share this post


Link to post
Share on other sites
  • 0

Dear @jpeyron

Thanks for the reply. As far as I know, this does not  require any ip customization and block modification. For your understanding, I thought it would be a good  idea to post the arduino code as well. The module sagem HILOC works at a baudrate of 115200. 

1. I have attached the screenshot of the arduino code for sending a simple command "AT" to GSM. For that, the reply from GSM would be "OK". PFA the file(file name: 1)

2. Hardware part(vivado): 
   I thought of replicating the same in xilinx sdk. But here, the baudrate could be configured in vivado. So first, I have created AXI uartlite(baudrate 115200) and 
   connected the pins rx and tx to JC2_N and JC2_P pins of JC connector. I have used zync block for processing the data. Finally, I have created a bitstream and exported
   the code to xilinx sdk. (file name: 4)

3. Software part(xilinx sdk):
   Then I have done a simple coding in xilinx sdk. I am sending "AT" to GSM. And expecting response "OK" from GSM.(file names:2 and 3)

   Note: First I used sleep function to create a delay. It doesnt seem to be working. Hence I have created a manual delay.
   So I have created a simple timer which goes inside the loop and count the seconds.(Its functionality is checked in other codes as well).

   I could not able to find what I am doing wrong. I have tried to change the stdin and stddout (bsp settings) to axi_uartlite_1, the block i m using for GSM module.
   Its also not working. Please help me with this process. If the staff members have any idea about this, I would be really thanful to them.

 

2.JPG

1.JPG

3.JPG

4.JPG

Share this post


Link to post
Share on other sites
  • 0

Dear @jpeyron I might have found what is causing the problem. Ur valuable advice is needed.

1. As you can see from the uploaded image, the first xil_printf statements(  xil_printf("AT");) is the command which needed to be sent to rx of uartlite_1 block(GSM module is connected).

2. But the default stdin and stdout of xilinx sdk is ps7_UART 1. So whatever the xil_printf statemets are, they are redirected towards uart 1(and not towards uartlite) . GSM module will only work if it receives commands from uartlite. I hope I have explained this clearly.

3. So I tried to change the stdin and stdout to uartlite so that the xil_printf statements are directed towards uartlite. But the problem is that now I am not able to view anything in the terminal.

Is there a way to change the stdin and stdout to uartlte and still view the xil_printf statements?????? ur valuable advice is needed. Thank u in advance

 

2.JPG

Share this post


Link to post
Share on other sites
  • 0

Hi @Sridhar Prasath Aruppukottai Ganesan,

Here is a forum thread where they are using multiple uarts in sdk. You need to initialize uartlite_1

Status = XUartLite_Initialize(&UartLite_1, UARTLITE_DEVICE_ID_1);
if (Status != XST_SUCCESS) {
return XST_FAILURE;

and then use the uartlite_1 xparameters in your sdk code when communicating with the GSM module.

thank you,

Jon

Share this post


Link to post
Share on other sites
  • 0

Dear @jpeyron sorry to disturb you again. But I think that i have found the problem. There is nothing wrong about the initialization of uartlite or using multiple uarts. I will list out the  problem i am facing . There is some problem with the coding . I dont know what that is. If you see the previous example with arduino, If I send some commands to GSM module,it will send some response.(only once)

1. Here in SDK, I have written some code for sending  command "AT". Usually the response should be "OK" and it happens only one time(as you can see in the arduino code). Here, I am getting the response from the GSM but I have to give it in a while loop to get the response (see files:  file1 and file4). I donno  why I have to give in a while loop and it contain the correct response as well as some of the characters("T") from the given command("AT"). And since it is infinetely running, i could not take a screenshot. Thats y I stopped the cursor and took a photo.

2. For the next command "AT+CPIN?" , the response should be "+CPIN: READY". Here also , I have to give it in  a WHILE loop to get the response back . And it contains some of the characters("T+CPIN?") from the given command. I dont know why that is happening. (see files: file2 and file3)

3. I tried to give the commands without the WHILE loop. Then I am not getting any correct response("+CPIN: READY") . I am getting only the characters("T+CPIN?") from the already given command.(see file5).

I hope I have explained the problem to your proper understanding. 

file1.JPG

file2.JPG

file3.jpeg

file4.jpeg

file5.jpeg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now