Search code examples
tcpembeddedascii

AI Thinker A9G TCP\IP Data Transmission Problem


Hello, community

I have a problem with AT+CIPSEND Command. It receives the input data as ASCII data, so when I check the server I receive the data in the wrong format. I expect to receive the data in bytes. So I have converted the byte array to an ASCII array to receive it correctly. But in ASCII there is a unique characters like 1 and 8 the serial communication performs the action of these special characters rather than sending them.

Bytes array to send char bytes[] = { 120, 120, 13, 1, 8, 103, 149, 144, 52, 66, 103, 130, 0, 13, 51, 81, 13, 10 };

I receive { 120, 120, 13, 103, 149, 144, 52, 66, 103, 130, 0, 13, 51, 81, 13, 10 };

Thanks a lot.


Solution

  • Solution use AT+CIPSEND=n where n is a number of bytes to send.

    Example char bytes[] = { 120,120,13,1,8,103,149,144,52,66,103,130,0,13,51,81,13,10 };

    execute AT+CIPSEND=18

    then send the 18 bytes value.

        char bytes[] = { 120,120,13,1,8,103,149,144,52,66,103,130,0,13,51,81,13,10 };
        A9G.print("AT+CIPSEND=18\r\n");
        for (int i = 0; i < 18; ++i) { A9G.write(bytes[i]); }