cAT icon indicating copy to clipboard operation
cAT copied to clipboard

cAT returning ERROR when running embedded.

Open andrewstillie opened this issue 1 year ago • 2 comments

I have been testing cAT locally using a Linux machine and compiling with GCC and all is working fine.
This is how I have the comms interface set. static int write_char(char ch) { putc(ch, stdout); return 1; }

static int read_char(char *ch) { *ch = getc(stdin); return 1; }

I now want to run the code embedded in a SiLabs Microcontroller via a UART and TeraTerm. Serial output from the application is working fine. But when I send AT#HELP (or any other command) I get the "ERROR" response.

The main loop is calling handleATProcessing() every iteration.

struct cat_object at; is declared as a global.

int handleATProcessing(void) {

    while ((cat_service(&at) != 0) && (quit_flag == 0))
    {
        sl_sleeptimer_delay_millisecond(1);
    };


    printf("Bye!\n");

    return 0;

}

My gut feeling is that a command is not being built as characters are received, so command buffer is empty when CR is received. Can you see where I am going wrong or advise how to debug this?

andrewstillie avatar Feb 12 '24 10:02 andrewstillie

I had to add code to my .read as getc was returning 255 when no characters where detected.

andrewstillie avatar Feb 13 '24 08:02 andrewstillie

My issue - not cAT

andrewstillie avatar Feb 13 '24 08:02 andrewstillie