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.

CCS/CC1310: CC1310 UART Problems

Part Number: CC1310

Tool/software: Code Composer Studio

Hello,

I'am working now since 2 months with my Launchpad-CC1310 and everything worked fine.
I send AT+Commands via Uart to an GSM-Modul and a also get an answer.

Now I only changed a size from an Array from 60 to 70, and my Programm get stucked at Uart_read or Uart_write
This Array have nothing to do with the Uart, so I don't know how this can be the Problem.

I also have a Uart_Timeout of 100ms, and normally it workes, but wenn I Change the size, I stucked endless in Uart_read/write.


Here is my Code. When I Change the sendstringsize to sendstring[70], I get stucked, when I call the Funktion if(send_AT_Commands(PostCommand,"CONNECT",uart)),
So I don't even reach the Funktion send_AT_Commands(sendstring,"OK",uart), where the sendstring is used.


int send_ADCValueSTR(char value[60], UART_Handle uart)
{
    int valuesize = strlen(value);
    int i=0;
    char PostCommand[30] = {"\0"};
    char valuesize_in_bit[3] = {"\0"};
    char sendstring[60]={"\0"};


    strcat(sendstring,"value=");
    strcat(sendstring,value);
    strcat(sendstring,"\r");

    sprintf(valuesize_in_bit, "%d",valuesize+6);

    // Initialisieren des Strings mit den Post-ATCommand
    PostCommand[0] = 'A';
    PostCommand[1] = 'T';
    PostCommand[2] = '+';
    PostCommand[3] = 'Q';
    PostCommand[4] = 'H';
    PostCommand[5] = 'T';
    PostCommand[6] = 'T';
    PostCommand[7] = 'P';
    PostCommand[8] = 'P';
    PostCommand[9] = 'O';
    PostCommand[10] = 'S';
    PostCommand[11] = 'T';
    PostCommand[12] = '=';

    // Einfügen der Ziffernanzahl(Bytes) in den Post-ATCommand (maximal 99 Ziffern)
    i=0;
    if(valuesize+6<10)
    {
        PostCommand[13+i]=valuesize_in_bit[i];
        i++;
    }
    else if(valuesize+6>=10)
    {
        for(i=0;i<2;i++)
            PostCommand[13+i]=valuesize_in_bit[i];
    }

    // Anhängen des Resten vom Post-ATCommand
    PostCommand[13+i] = ',';
    PostCommand[14+i] = '8';
    PostCommand[15+i] = '0';
    PostCommand[16+i] = ',';
    PostCommand[17+i] = '8';
    PostCommand[18+i] = '0';
    PostCommand[19+i] = '\r';

    //Wenn der PostCommand erfolgreich war, dann Senden vom String und Return 1, wenn nicht erfolgreich, dann return 0
    if(send_AT_Commands(PostCommand,"CONNECT",uart))
    {
        send_AT_Commands(sendstring,"OK",uart);
            return 1;
    }

Here is the functioncode of send_AT_Commands.

I get stucked at the Line: while(UART_read(uart, &input[i], 1)) endless and I don't now why. 

So it would be great, if somebody can help me out here

thank you

beste regards

sini1104

int send_AT_Commands(char tempATCommand[30], char* expected_answer, UART_Handle uart)
{
    // input wird mit Dummy 'ö' initialisiert
    int j=0;
    do
    {
        char ATCommand[35];

        memset(ATCommand,0,sizeof(ATCommand));
        strncpy(ATCommand,tempATCommand,(sizeof(ATCommand))-1);

        char input[50]={'\0'};

        int i=0;
        int m=1;
        int k=0;
        int uart_read_end = 0;
        int expected_answer_length = strlen(expected_answer);
        int status = 0;
        uint32_t startTick;

        // So lange einlesen, solange was am Serielanschluss anliegt
        while(UART_read(uart, &input[i], 1));

        for(i=0;i<50;i++)

  • Sinesa,

    The only reason for that to happen is if your code somehow is modifying locations in memory that it is not suppose to. I suggest setting some break points based on data changing in the newly modified buffer range. Then you will find that a piece of code somewhere is doing something you did not expect.

    Regards,
    /TA