Upcoming maintenance
Dear Customers and Partners.
This website will be undergoing scheduled maintenance on June 14, 2023. Please be aware there may be disruption to the developer portal website and associated services during the scheduled maintenance period.
This upgrade is essential to ensure the continued performance, reliability, and security of Developer World.
We apologize for any inconvenience.
WiFi Add board: Connection Problem
-
@CamilaSouza Hi. Thanks for all your help. I found that document before, and the problem with that command (AT+TCERTADD) is that they use the Tera Term VT interface to add the certificate after this command is sent. I dont know how to do it from Arduino IDE because after using that command and trying to connect to the server it always appears that it can't find the certificates, despite the fact that the "AT+TCERTADD" command shows me an "OK" after executing it. I do not know what else can I do.
-
@jp04 I assume you are using Serial.print() to send the command, right? (Or Serial5, Serial3)
const unsigned char myCertificate[] = { 0x7F, 0x45, 0x4C, 0x46, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, .... } const size_t myCertificateSize = sizeof(myCertificate); Serial5.printf("AT+TCERTADD=SSL_CA,0,%d,1\r\n", myCertificateSize); sleep(1); Serial5.write(myCertificate, myCertificateSize); sleep(1); Serial5.printf("AT+CERTINFOGET=SSL_CA\r\n");
I do not have the board. I did not compile above.
Please check if \r\n is the correct termination. Serial.write writes the bytes. This can be also file content from a SD card or Flash Memory.I was evaluating buying this wifi board but I am not sure buying hardware that is already EOL. Could you please tell me how the performance of this wifi board is? How long does it take to send large data like camera images?
-
@jp04 Does the "AT+TCERTADD"show OK two times?
-
@jens6151-0-1-1 Ah sorry. The certificate is likely a string ...
#define CERTS_DIGICERT_GLOBAL_ROOT_CA \ "-----BEGIN CERTIFICATE-----\n" \ "MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh\n" \ "CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97\n" \ "nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt\n" \ "43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P\n" \ "T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4\n" \ "gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO\n" \ "BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR\n" \ "TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw\n" \ "DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr\n" \ "hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg\n" \ "06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF\n" \ "PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls\n" \ "YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk\n" \ "CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=\n" \ "-----END CERTIFICATE-----\n" static const char* certs = CERTS_DIGICERT_GLOBAL_ROOT_CA; // the setup function runs once when you press reset or power the board void setup() { Serial.begin(115200); while (!Serial) {} Serial.printf("AT+TCERTADD=SSL_CA,0,%d,1\r\n", strlen(certs)); sleep(1); Serial.write((const uint8_t*) certs, strlen(certs)); sleep(1); Serial.printf("AT+CERTINFOGET=SSL_CA\r\n"); } // the loop function runs over and over again forever void loop() {}
If it does not work, could you please post your code (replacing or cutting the certificate if it is a secret one)
-
@jens6151-0-1-1 Thank you very much for your help. I tried it and it didn't work. Initially I used the following code and the "OK" does not appear at any time after sending the commands (I don't show the certificate in the code below)
const char* certs1= \ "-----BEGIN CERTIFICATE-----\n" \ "-----END CERTIFICATE-----\n"; void setup() { /* initialize digital pin of LEDs as an output. */ pinMode(LED0, OUTPUT); pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); pinMode(LED3, OUTPUT); digitalWrite( LED0, LOW ); // turn the LED off (LOW is the voltage level) digitalWrite( LED1, LOW ); // turn the LED off (LOW is the voltage level) digitalWrite( LED2, LOW ); // turn the LED off (LOW is the voltage level) digitalWrite( LED3, LOW ); // turn the LED off (LOW is the voltage level) Serial.begin( CONSOLE_BAUDRATE ); // talk to PC /* Initialize SPI access of GS2200 */ Init_GS2200_SPI(); digitalWrite( LED0, HIGH ); // turn on LED /* Initialize AT Command Library Buffer */ AtCmd_Init(); digitalWrite( LED1, HIGH ); // turn on LED /* GS2200 Association to AP */ App_InitModule(); digitalWrite( LED2, HIGH ); // turn on LED App_ConnectAP(); digitalWrite( LED3, HIGH ); // turn on LED Serial.printf("AT+TCERTADD=SSL_CA,1,%d,0\r\n", strlen(certs)); sleep(1); Serial.write((const uint8_t*) certs, strlen(certs)); sleep(1); Serial.printf("AT+CERTINFOGET=SSL_CA\r\n"); }
18:01:59.012 -> AT+TCERTADD=SSL_CA,0,54,1 18:02:00.783 -> -----BEGIN CERTIFICATE----- 18:02:00.783 -> -----END CERTIFICATE----- 18:02:01.021 -> AT+CERTINFOGET=SSL_CA
In the documentation they mention a specific function to send the AT commands, so I made the change in the above code. This time only the OK appears with the first AT command and at the moment of verifying the loaded certificate I get an error.
const char* certs1= \ "-----BEGIN CERTIFICATE-----\n" \ "-----END CERTIFICATE-----\n"; void setup() { /* initialize digital pin of LEDs as an output. */ pinMode(LED0, OUTPUT); pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); pinMode(LED3, OUTPUT); digitalWrite( LED0, LOW ); // turn the LED off (LOW is the voltage level) digitalWrite( LED1, LOW ); // turn the LED off (LOW is the voltage level) digitalWrite( LED2, LOW ); // turn the LED off (LOW is the voltage level) digitalWrite( LED3, LOW ); // turn the LED off (LOW is the voltage level) Serial.begin( CONSOLE_BAUDRATE ); // talk to PC /* Initialize SPI access of GS2200 */ Init_GS2200_SPI(); digitalWrite( LED0, HIGH ); // turn on LED /* Initialize AT Command Library Buffer */ AtCmd_Init(); digitalWrite( LED1, HIGH ); // turn on LED /* GS2200 Association to AP */ App_InitModule(); digitalWrite( LED2, HIGH ); // turn on LED App_ConnectAP(); digitalWrite( LED3, HIGH ); // turn on LED AtCmd_SendCommand( (char *) "AT+TCERTADD=SSL_CA,1,54,0\r\n"); sleep(1); Serial.write((const uint8_t*) certs1, strlen(certs1)); sleep(1); AtCmd_SendCommand( (char *) "AT+CERTINFOGET=SSL_CA\r\n"); }
18:19:31.185 -> >AT+TCERTADD=ssl_cacert,1,54,0 18:19:31.221 -> 18:19:31.221 -> 18:19:31.221 -> OK 18:19:31.221 -> GS Response: 1 18:19:32.192 -> -----BEGIN CERTIFICATE----- 18:19:32.192 -> -----END CERTIFICATE----- 18:19:33.212 -> >AT+CERTINFOGET=ssl_cacert 18:19:33.212 -> 18:19:33.212 -> CA certificate not found 18:19:33.212 -> ERROR 18:19:33.212 -> GS Response: 4
Then I tried another change, but with no positive results. I changed the Serial_write function to the WiFi_Write function, because reviewing the source code I noticed that they use this function to send data to the wifi module. However, in this case an error occurs. So far I still do not know what to do to achieve the successful upload and SSL connection with this wifi module.
18:25:28.063 -> >AT+TCERTADD=ssl_cacert,1,54,0 18:25:28.097 -> 18:25:28.097 -> 18:25:28.097 -> OK 18:25:28.097 -> GS Response: 1 18:25:30.082 -> >AT+CERTINFOGET=ssl_cacert 18:25:30.082 -> 18:25:30.082 -> ERROR: INVALID INPUT 18:25:30.082 -> GS Response: 4
-
@jens6151 0 1 1 in one of the previous codes I had an error. I made the corresponding change of the variable certs to the variable certs1. The "OK" did not appear.
-
@jp04 Thanks for posting the code. It brings clarity.
- You use a library. Maybe this https://github.com/jittermaster/GS2200-WiFi?
- My assumption that you communicate via Serial was wrong.
It is required to send the certificate by SPI.
Did you already try this?AtCmd_SendCommand( (char *) "AT+TCERTADD=SSL_CA,1,54,0\r\n"); sleep(1); AtCmd_SendCommand( (char *) certs1); sleep(1); AtCmd_SendCommand( (char *) "AT+CERTINFOGET=SSL_CA\r\n");
Alternatively
WiFi_Write(certs1, strlen(certs1));
Does your certificate have more than 1400 bytes (characters)? If so you might try to raise the buffer inside the library or cut the certificate into smaller pieces, sending them one by one.
#define SPI_MAX_SIZE 1400 #define TXBUFFER_SIZE SPI_MAX_SIZE #define RXBUFFER_SIZE 1500
-
@jens6151-0-1-1 Thanks for your help. Thats correct, I am using that library.
When I tried the following
AtCmd_SendCommand( (char *) "AT+TCERTADD=SSL_CA,1,1505,0\r\n"); sleep(1); AtCmd_SendCommand( (char *) certs); sleep(1); AtCmd_SendCommand( (char *) "AT+CERTINFOGET=SSL_CA\r\n");
I got
17:23:47.969 -> >AT+TCERTADD=SSL_CA,1,1505,0 17:23:47.969 -> 17:23:47.969 -> 17:23:47.969 -> OK 17:23:47.969 -> GS Response: 1 17:23:49.026 -> >-----BEGIN CERTIFICATE----- 17:23:49.567 -> ERROR: INVALID INPUT 17:23:49.567 -> GS Response: 4 17:23:50.076 -> >AT+CERTINFOGET=SSL_CA 17:23:50.076 -> 17:23:50.076 -> 17:23:50.076 -> ERROR: INVALID INPUT
Then, I changed it for
AtCmd_SendCommand( (char *) "AT+TCERTADD=SSL_CA,1,1505,0\r\n"); do{ s = WiFi_Write( certs, strlen(certs) ); if( s != SPI_RESP_STATUS_OK ) delay(100); }while( s != SPI_RESP_STATUS_OK ); AtCmd_SendCommand( (char *) "AT+CERTINFOGET=SSL_CA\r\n");
and got
17:37:03.433 -> >AT+TCERTADD=SSL_CA,1,1505,0 17:37:03.433 -> 17:37:03.433 -> 17:37:03.433 -> OK 17:37:03.433 -> GS Response: 1 17:37:03.433 -> >AT+CERTINFOGET=SSL_CA 17:37:03.471 -> 17:37:03.471 -> 17:37:03.471 -> ERROR: INVALID INPUT 17:37:03.471 -> GS Response: 4
It seems that something is missing after using the WiFi_Write instruction because any command I send after that instruction I get "ERROR: INVALID INPUT". I keep looking for a solution to this, but I can't find anything about it. Thank you very much for your continued support and I hope we can find a solution soon.
-
Also already raised the buffer inside the library
-
@jp04 I see.
I read the manual more carefully. I noticed- 2.3 Command Processing Mode
Each command is terminated with a carriage return <CR> or line feed <LF>.
I think we always send both - 2.4 Data Handling
In Data Processing Mode, data transfers are managed using various escape sequences.
There is a data mode entered by escape sequences - 7.2.1 Certificate Addition
<ESC>W<certificate of the above size>
Note the <ESC>W
-> How about trying this?
char escape[2]; escape[0] = 0x1B; escape[1] = 'W'; AtCmd_SendCommand( (char *) "AT+TCERTADD=SSL_CA,1,1505,0\r\n"); sleep(1); WiFi_Write( escape, 2 ); AtCmd_SendCommand( (char *) certs); sleep(1); AtCmd_SendCommand( (char *) "AT+CERTINFOGET=SSL_CA\r\n");
- 2.3 Command Processing Mode
-
@jp04 yes I had to do this too btw @CamilaSouza if you talk to IDY could you please ask them why they decided to use an OBSOLETED and very old Telit wifi module? (I can't believe it when I checked the actual module!)
Just for funI am now trying to use a more modern ATWINC1500 (Microchip/Atmel) just using an Adafruit shield but left with a lot of homework as Wifi101 library is incompatible with spresense (conflict/duplicate in the socket module-data types are not even the same).
While spresense is OK for homegrown project for anyone who is considering to start with this platform and then take it to "production" might be disappointed . I would suggest to look at solutions form Microcontroller companies (Renesas, Microchip, ST) should your goal is "production". At the end of the day you are most likely would be unable to buy the Sony MCU unless you are ordering a huge qty from Sony imho.
-
@maxieaussie-0
What exactly did you have to do too?
You referred to modifying the library. You used that module too? Can you give any feedback on the performance of this very old module? I am looking for something to stream camera images (1280x960, jpeg, can be even 1fps) over network. Just for hobby, 1 piece.This Wifi add on board itself is also EOL.
Let me make one guess. There are only a very few wifi/BLE/LTE modules available that are certified for usage in Japan. About 90% (my feeling) is not allowed to be used, even for prototyping. Since a few years there is a system where you can apply for exceptions if the module is FCC certified. But it is limited to 6 months, then you must dispose the hardware ...
For what I have seen on the vendors' sites as documentation or samples or availability .. forget about all 3rd party modules. (sorry to overgeneralize if I missed a good vendor)
-
@jens6151-0-1-1 I am sorry for my late response. Thank you for continuing to help me with this issue. I really don't know what else to do, once I execute those commands I get OK as a response, however after sending the information I get "SPI Timeout".
10:38:21.758 -> >AT+TCERTDEL=SSL_CACERT 10:38:21.758 -> OK 10:38:21.758 -> GS Response: 1 10:38:21.758 -> >AT+TCERTDEL=SSL_CLIENTCERT 10:38:21.758 -> OK 10:38:21.758 -> GS Response: 1 10:38:21.758 -> >AT+TCERTADD=SSL_CACERT,1,1472,0 10:38:21.795 -> OK 10:38:21.795 -> GS Response: 1 10:38:24.794 -> >AT+TCERTADD=SSL_CLIENTCERT,1,1424,0 10:38:24.794 -> OK 10:38:24.794 -> GS Response: 1 10:38:27.844 -> >AT+TCERTADD=SSL_CLIENTKEY,1,1704,0 10:38:27.844 -> OK 10:38:27.844 -> GS Response: 1 10:38:30.859 -> >AT+MQTTCONNECT=XXX,8883,User1,,,1,SSL_CACERT,SSL_CLIENTCERT,SSL_CLIENTKEY,30 10:38:30.859 -> OK 10:38:35.895 -> >AT+MQTTPUBLISH= 10:38:55.877 -> SPI: Timeout
-
@jp04 I cannot see what you send. It is only AT+MQTTPUBLISH=
Are you sending according to the documentation? Note the <ESC>N<CID>
This is the documentation
This Command is used to send an Application Messages from client to the server. Command SyntaxAT+MQTTPUBLISH=<CID>,<TopicName>,<Length>,<Qos>[,<Retain Flag>]
MCU sends MQTT data using the following Escape <ESC> sequence:
<ESC>N<CID><DataofaboveLength>
Also connect should return not just OK
<IP>:<xxx.xxx.xxx.xxx> <CID> OK
-
@jens6151-0-1-1 Hi. I just uploaded the code related with the certifications. Already fixed the MQTT Publish problem but i think the problem persist on the certifications.
AtCmd_SendCommand( (char *) "AT+TCERTADD=SSL_CACERT,1,1472,0\r\n"); sleep(1); WiFi_Write( escape, 2 ); sleep(1); WiFi_Write(ca_cert, strlen(ca_cert)); sleep(1); AtCmd_SendCommand( (char *) "AT+TCERTADD=SSL_CLIENTCERT,1,1424,0\r\n"); sleep(1); WiFi_Write( escape, 2 ); sleep(1); WiFi_Write(client_cert, strlen(client_cert)); sleep(1); AtCmd_SendCommand( (char *) "AT+TCERTADD=SSL_CLIENTKEY,1,1704,0\r\n"); sleep(1); WiFi_Write( escape, 2 ); sleep(1); WiFi_Write(client_key, strlen(client_key));
Output:
15:04:02.476 -> >AT+MQTTCONNECT=XXX,8883,User1,,,1,SSL_CACERT,SSL_CLIENTCERT,SSL_CLIENTKEY,30 15:04:02.476 -> OK 15:04:02.476 -> GS Response: 1 15:04:02.476 -> No CID! 15:04:04.503 -> >AT+MQTTPUBLISH=0,XXX,322,0,0 15:04:04.503 -> OK 15:04:04.503 -> GS Response: 1 15:04:09.534 -> >AT+MQTTPUBLISH=0,XXX,322,0,0 15:04:09.534 -> OK 15:04:09.534 -> GS Response: 1 15:04:14.534 -> >AT+MQTTPUBLISH=0,XXX,322,0,0 15:04:14.534 -> IP:XXX 15:04:14.534 -> ERROR 15:04:14.534 -> GS Response: 4
-
@jp04 I have a brief question before continuing here.
Do you plan to connect to AWS IoT as you have the certificates and no password?
Could you think of using the Spresense SDK? -
@jens6151-0-1-1 Hi jens sorry I have been "offline" a bit. No I have not had chance to look at the library modification for using the ATWINC1500 shield due to my work load. I have not tested the "performance" of the Japanese IDY module (that use the EOL Telit wifi) .either but did run their example codes with no issues (after taking care of the version/red or yellow dots)
-
I don't really feel comfortable asking them why they chose an obsolete module
But hopefully once Spresense user base grows a little more we will have more add on boards to choose from and more wifi compatible libraries.
-
@CamilaSouza Perhaps ask them in a "japanese way" : Ask when or if they are planning to release a new version of the board , instead of asking why the decided to pick up that one :
-
@maxieaussie-0 said in WiFi Add board: Connection Problem:
lanning to release a new version of the board , instead of asking why the decided to pick up that one :
hahaha ok.
I emailed them asking,
If I get a response, I'll let you guys know.