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 keep helping me with this topic. Yes, I contacted the GS2200M module manufacturer (Telit) and they asked me to contact the supplier (IDY) instead.
-
I'm trying to contact IDY to see if they have any answers.
I'll let you know if they answer me. -
@CamilaSouza Hi. I was thinking in load the certificates in a SD Card for the SSL connection. Do you know is there a compatible SD card module that I can use instead of the SPRESENSE extension board ?
-
@jp04 Do you use the SD Card only for the certificates?
It would be much easier to use the internal flash at "/mnt/spif/...". I had them on SD card too in the beginning but I copied them to the flash memory.
Only if you want to replace the certificates, a SD Card is convenient. -
In case you really prefer to use the SD card:
We don't have any official SD card reader that has been tested and approved by our engineers to give as a recommendation.
But you can try something like this:
https://www.elfa.se/en/microsd-card-breakout-board-adafruit-254/p/30091189A microSD breakout that you can communicate via SPI.
-
@jens6151-0-1-1 Hi. Thanks for your reply. Can you show me on your code how did you do that? Do i just have to save them in that path? How can I read them? I am sorry if this questions sounds silly but I a little lost on how accomplish this.
-
@jp04
Actually I copied it to SD card and used then the copy command (cp) of nsh (NuttX Shell).As you do not have an SD card I would recommend this sample to download to SPI flash.
- Replace SRC_start and SRC_size with your certificate.
- Manipulate DSP_MOUNTPT_SPIFLASH with the path to copy it to and dsplist with the file name.
- Flash and start the script. Choose SPI-Flash
Accessing the data is a simple read using open(...) from stdio.h or you use the File library.
See the File library here.Hint:
Do not useint File::read() ;
but
int File::read(void *buf, size_t nbyte) ;
It will be 100x faster.
-
@jens6151-0-1-1 Hi. I am sorry for keep bothering. I tested the following code:
#include <stdio.h> #include <sys/stat.h> #include <unistd.h> // Include each file generated by bin2c #include "SRC.h" #define DSP_MOUNTPT_SPIFLASH "/mnt/spif/BIN" #define _FILEELEM(elem) { \ .name = #elem, \ .addr = elem##_start, \ .size = &elem##_size, \ } struct fileinfo_s { const char *name; const unsigned char *addr; const size_t *size; }; struct fileinfo_s dsplist[] = { // Add each file here _FILEELEM(SRC), }; void setup() { // put your setup code here, to run once: unsigned int i; int ret; FILE *fp; char dirpath[64] = {0}; char filepath[64] = {0}; Serial.begin(115200); Serial.println("SPI-Flash"); strncpy(dirpath, DSP_MOUNTPT_SPIFLASH, sizeof(dirpath)); mkdir(dirpath, 0777); for (i = 0; i < sizeof(dsplist) / sizeof(dsplist[0]); i++) { snprintf(filepath, sizeof(filepath), "%s/%s", dirpath, dsplist[i].name); Serial.print("Install: "); Serial.print(filepath); unlink(filepath); fp = fopen(filepath, "wb"); ret = fwrite(dsplist[i].addr, *dsplist[i].size, 1, fp); Serial.println((ret) ? " Done." : " Fail."); fclose(fp); }
and got the following answer:
17:09:13.834 -> SPI-Flash 17:09:13.834 -> Install: /mnt/spif/BIN/SRC Done.
I would like to know if there is a way to list all the files located at /mnt/spif/BIN. Thanks a lot for all your help.
-
Update on support for WiFi Add on Board iS110B:
I contacted IDY and was told the support for this board was handed to Restar Electronics Corporation.
https://www.restar-ele.com/I sent them a message asking for support on the issue of uploading SSL certificates to the board.
Will keep you posted on the issue. -
@jp04 I suggest you install the nsh sample
You will get a shell and have commands like cd (change directory), ls (list directory), mv (move), rm (remove) and cat (prints the content) available. See a list of all commands by typing "help".
ls /mnt/spif/BIN cat /mnt/spif/BIN/SRC
Seems like you named the certificate file "SRC"".
-
-
@CamilaSouza Thank you for contacting them. I will keep follow this topic. I hope they can help me to solve this issue.
-
@jens6151-0-1-1 Thank you for your support. I managed to check the files located at the flash memory. I had to do some modifications to the code of the example due to the following error compile messages:
error: #error "Core selection is wrong!!"
Solution. Comment the line 22: #error "Core selection is wrong!!"
After that I got the following compile error:
Compilation error: no matching function for call to 'MPClass::begin()'
Solution. Add the following:
int subcore = 1;
and
MP.begin(subcore);
instead of
MP.begin();
After that the code runs without any problem.
-
Hello @jp04
I received a response from Lester Electronics.
They said their technical support is limited, but they did point me to a good documentation.You can find the manual in this link.
https://www.roundsolutions.com/media/pdf/700-0052_GS2101M-S2W-Adapter-Command-Reference-Guide-r1.0.pdfCheck section "7.2.1 Certificate Addition".
-
@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