espressif / esp-protocols

Collection of ESP-IDF components related to networking protocols
165 stars 115 forks source link

Choosing The Right Mode For SIMCOM or Any Modem... (AT or DialUP) (IDFGH-12638) #552

Open parthbhat13 opened 2 months ago

parthbhat13 commented 2 months ago

Answers checklist.

General issue report

Hi all, and specifically @david-cermak

Just a bit of background

apologies in advance as i do not know, what i am going to produce below in terms of issue or suggestion would fall under this title or not. bare with me as i would be summarizing my issue and work of past 3 years together in some limited words.

The Problem Statement

Basically since past 3 years ive been working and developing some UPI (Unified Payments Interface) system based payment devices for the vending machine, there has been a lot of upgrades and different versions have been developed and now there another final version which i am supposed to be launching. so far ive completed around 1000pcs in the market and we are trying to deploy even more. the stack which i am using is as follows

summary of a problem statement i need a real time communication with a server over GSM.. simple.

The Problem I'm facing and reason for this post ?

This will definitely be very long so bare with me please. after deploying multiple products in the market we have started receiving multiple complains from the field. mainly where the network drops, or the ping request fails or some other minor things which had been hard for me to figure out since i did not use my enough brains to have the OTA update function and remote LOG monitoring function.

Taking matters in my own hands i started talking with some of the other people in the market, including my close mentors in india,

as well since it was hard to get in touch with mr.David Cenmark i was lucky enough to watch your youtube video where you mentioned few things which lead me to more confusions.

to summarize the decisions from all the mentors mentioned above, all i could say is the ones from india asked to go with AT commands and use the internal GSM Http and MQTT stack to talk with the server. where in Mr.Franz and Mr.David asked to go for PPPOS dial Up connection.

now with the updated and latest product, i need to not only have the payment transactions working, but also OTA update, real time logs and much more other things. where in i spent 2 months to write my own AT commands based library for the GSM which can be used by any modem (that was the plan), i came with some results .

Ofcourse the right answer is to go with the esp-modem library but again cant forget the issues which ive had from the field where they complained of network loss, connection drop, http failed to ping and on and on.

out of my curiosity, i even tested the Arduino and TinyGsm library, and it seems they are doing all AT commands and its all over the TCP stack of the gsm modem. to my surprise arduino with a vanilla HTTP request over tcp. takes 840mS for response lol. idk what have they used in the tinyGsm library for it to be so fast. all of my stack is developed on esp-idf V4.4.6 and C .

Solutions I Can Think Of..

eventually, i am genuinely stuck between what to do? and below are my options

  1. add CTS and RTS lines, Use the PPPOS dialUp connection, and use only single protocol MQTT/HTTP not both
  2. add custom code on top of esp-modem library to handle the GSM HTTP/MQTT Stack AT commands.
  3. Try and find ways to implement the TinyGsm based communication DTE driver for the GSM for faster Result in reading and writing to and from uart.

with the above solutions, i can add the cts and rts to my existing payment device since i have spare pins, but my other products which involves Tea Coffee Vending Machine and Even Vending Machine controller, has no ESP32 pins left whatsoever. so idk how would that be of any help. yes i can shift to esp32S3 and use the USB. but now there no time for redeveloping the whole pcbs and sample it and test all the other loads of protocols which are running on the board..

so what shall be done and are there any inputs ?

My Custom AT library At parser code..

  1. Function To Send AT Command

    gsm_err_t DTECommand(gsmConfig_t *config, char *at)
    {
    char sendBuf[strlen(at) + 3];
    
    vTaskDelay(1 / portTICK_PERIOD_MS);
    uart_flush(config->gsmUartConfig.uartNum);
    
    memset(sendBuf, 0, sizeof(sendBuf));
    memcpy(sendBuf, at, strlen(at));
    
    strncat(sendBuf, "\r\n", strlen(sendBuf) + 2);
    
    if (config->debugDTE)
        ESP_LOGI(TAG, "Sending Cmd: %s", sendBuf);
    
    uart_write_bytes(config->gsmUartConfig.uartNum, sendBuf, strlen(sendBuf));
    uart_wait_tx_done(config->gsmUartConfig.uartNum, 100 / portTICK_PERIOD_MS);
    
    return GSM_OK;
    }
  2. Function To Receive AT Command

    gsm_err_t DTEResponse(gsmConfig_t *config, char buffer[], size_t bufferSize, unsigned long timeout)
    {
    unsigned long t = esp_timer_get_time() / 1000;
    while (1)
    {
        uart_get_buffered_data_len(config->gsmUartConfig.uartNum, (size_t *)&config->gsmBuffer.bufferedReadLength);
    
        // we keep this just so that we can make the size of the buffer according to this in the other function which we use.
        config->gsmBuffer.lastBufferedReadLength = config->gsmBuffer.bufferedReadLength;
    
        if (config->gsmBuffer.bufferedReadLength > 0)
            break;
    
        if ((esp_timer_get_time() / 1000) - t > timeout)
        {
            if (config->debugDTE)
                ESP_LOGW(TAG, "No Response, Timeout");
    
            return GSM_TIMEOUT;
        }
    
        vTaskDelay(100 / portTICK_PERIOD_MS);
    }
    
    t = esp_timer_get_time() / 1000;
    unsigned int i = 0;
    
    while (1)
    {
        while ((config->gsmBuffer.bufferedReadLength) > 0)
        {
            uart_read_bytes(config->gsmUartConfig.uartNum, (char *)&buffer[i], 1, 1 / portTICK_PERIOD_MS);
            config->gsmBuffer.bufferedReadLength--;
            i++;
            t = esp_timer_get_time() / 1000;
        }
    
        if (i > 2)
        {
            if (buffer[i - 2] == '\r' && buffer[i - 1] == '\n')
            {
                buffer[i - 2] = '\0';
                if (strlen(buffer) > 0)
                    break;
                else
                    i = 0;
            }
        }
    
        if ((esp_timer_get_time() / 1000) - t > 50 || i >= (bufferSize - 1))
        {
            buffer[i] = '\0';
            break;
        }
    }
    
    // we can log the data here
    if (config->debugDTE)
    {
        ESP_LOGI(TAG, "Response: %s", buffer);
        ESP_LOG_BUFFER_HEX(TAG, buffer, strlen(buffer) + 1);
    }
    
    return GSM_OK;
    }
  3. Function to receive AT command but it checks if there is valid ASCII. ive made this just because after power reset of gsm it sends garbage and the code crashes at strstr. and i cannot use this everywhere as during OTA update we need nonAscii data.

    gsm_err_t DTEResponseForAT(gsmConfig_t *config, char buffer[], size_t bufferSize, unsigned long timeout)
    {
    unsigned long t = esp_timer_get_time() / 1000;
    uint8_t gsmRespBuff[1030] = {'\0'};
    gsm_err_t ret = GSM_ERROR;
    while (1)
    {
        uart_get_buffered_data_len(config->gsmUartConfig.uartNum, (size_t *)&config->gsmBuffer.bufferedReadLength);
    
        // we keep this just so that we can make the size of the buffer according to this in the other function which we use.
        config->gsmBuffer.lastBufferedReadLength = config->gsmBuffer.bufferedReadLength;
    
        if (config->gsmBuffer.bufferedReadLength > 0)
            break;
    
        if ((esp_timer_get_time() / 1000) - t > timeout)
        {
            if (config->debugDTE)
                ESP_LOGW(TAG, "No Response, Timeout");
    
            return GSM_TIMEOUT;
        }
    
        vTaskDelay(100 / portTICK_PERIOD_MS);
    }
    
    t = esp_timer_get_time() / 1000;
    unsigned int i = 0;
    uint8_t noAsciiFlag = 0;
    memset(gsmRespBuff, 0, sizeof(gsmRespBuff));
    
    while (1)
    {
        while ((config->gsmBuffer.bufferedReadLength) > 0)
        {
            uart_read_bytes(config->gsmUartConfig.uartNum, &gsmRespBuff[i], 1, 1 / portTICK_PERIOD_MS);
    
            // check if the data is falling into the ASCII
            // TODO: okay parth, you do know you are being an absolute idiot by adding same functions twice.. make sure you dont show this to anyone and fix it. 
            // TODO: maybe make two tasks? send and receive?
            if (isascii(gsmRespBuff[i]))
            {
                buffer[i] = (char)gsmRespBuff[i];
            }
            else
            {
                noAsciiFlag = 1;
            }
            config->gsmBuffer.bufferedReadLength--;
            i++;
            t = esp_timer_get_time() / 1000;
        }
    
        if ((i > 2) && (noAsciiFlag == 0))
        {
    
            if (buffer[i - 2] == '\r' && buffer[i - 1] == '\n')
            {
                buffer[i - 2] = '\0';
                if (strlen(buffer) > 0)
                {
                    ret = GSM_OK;
                    break;
                }
    
                else
                    i = 0;
            }
        }
    
        if (((esp_timer_get_time() / 1000) - t > 50 || i >= (bufferSize - 1)) && noAsciiFlag == 0)
        {
    
            buffer[i] = '\0';
            ret = GSM_OK;
            break;
        }
        else if(noAsciiFlag == 1)
        {
    
            memset(buffer, '\0', bufferSize);
            ret = GSM_ERROR;
            break;
        }
    }
    
    if (config->debugDTE)
    {
        ESP_LOGI(TAG, "Response: %s", buffer);
        ESP_LOG_BUFFER_HEX(TAG, buffer, strlen(buffer) + 1);
    }
    
    return ret;
    }

i am not at all a good programmer so im sorry if its too much of stupid things i must've done.

thank you very much if you have read all of the above. thanks a lot.

david-cermak commented 2 months ago

Hi @parthbhat13

I'm afraid I cannot give a general suggestion about the "right" mode, and I'd just repeat myself on what I've already said in that devcon talk: "depends on your application". You've been talking about your customer's complaints on unstable connectivity, and also a bit about your application needs -- occasional HTTP request and MQTT communication. So I'd assume the number one priority of your project is the fast and fail save mechanism and recovery on signal loss while the communication is not so frequent and kind of slow. In this case, I'd agree that using the AT commands only is probably a better choice (just mind the disadvantages, like security and portability)

Unfortunately we don't have any example which deals with connectivity losses and recoveries, as it's usually device and application dependent. I'll think about it -- my general suggestion in this scenario would be the CMUX manual mode or the USB dual channel mode. Here's a simple example which demonstrates these retries and recoveries in the PPPoS mode:

https://github.com/espressif/esp-protocols/blob/bd6e12050928464b4357015c7c8c1b215432d580/examples/esp_netif/multiple_netifs/main/ppp_connect_esp_modem.c#L54-L93

you can also check this file, which does the same thing directly, without esp_modem

https://github.com/espressif/esp-protocols/blob/bd6e12050928464b4357015c7c8c1b215432d580/examples/esp_netif/multiple_netifs/main/ppp_connect_simple.c#L71-L95

parthbhat13 commented 2 months ago

Hi @david-cermak, Thanks a lot for your reply, I'd like to add few more to what you've mentioned.

  1. Fail safe is important yes! While you mentioned having fail safe as important aspect, at the same time, it's not needed to have two communication protocols hence it was decided to choose only one protocol either Mqtt or http.

  2. You mentioned to use cmux over usb. The biggest concern as of now which you can already see I've mentioned, I cannot change the hardware now, neither can I add esp32 S2 or S3. So USB goes out of question. In the Devcon you had even mentioned about using the RTS and CTS lines ? Do you think it's important for me for the Mqtt or HTTP And ota updates ?

  3. Yes going vanilla AT command sounds good to me to that now you have mentioned. But what DTE driver code would you recommend ? To use the esp-modems C function which allows me to send at commands ? Or make my own? Which I already have made and shown the code above which doesn't really work that fluent at times. ?

Thanks in advance !

david-cermak commented 2 months ago

1) Add fail safe: Yes, it's easier to cover that in the AT mode only, since you'd just get an ERROR or DISCONNECTED reply to your commands, while in the data mode you'd have to take care of different phases of PPP state machine and some devices just exit this data mode.

2) You can also use CMUX over UART, no need for USB. As for the UART flowcontrol signals, there're useful and prevent from buffer overflows, but you can easily tune up your application without them -- set the appropriate baud rate, move the UART ISR to RAM, increase Rx buffer sizes -- and according to my tests, the OTA should work seamlessly.

3) The problem is that you would really have to implement everything on your own, including OTA, and communication. You can check this file https://github.com/espressif/esp-protocols/blob/master/examples/esp_netif/multiple_netifs/main/ppp_connect_simple.c which uses UART driver directly, but with queues and interrupts, so should be faster than your code. You can also use esp_modem with AT commands only, maybe just the DTE class and the command library. I'd suggest using C++ in this case, as it's easily extensible.

parthbhat13 commented 2 months ago

thanks for the response mr.david.

so let me summarize the things i shall test.

  1. No need to change the hardware to use the CTS and RTS lines
  2. Increase the uart buffer (i already did that i guess) and move uart isr to ram
  3. i can choose to go with esp_modem dte class for my communication or i will have to find ways to port the TinyGsm library way of communication.
  4. i wonder what to do for OTA? use the TCP/IP custom code or get the Dialup?

what i can see from above list of things which i would do is that, using C++ is what i was avoiding at time. but i wonder how much would it change? since the esp's uart driver is written in C? only some string manipulation would end up being helpful if im using c++.

let me get back to you with all the results. as i can see i will have to do multiple tests. i even had decided to work with CMUX mode where we can simply use the Data as well as AT commands to check for the network stability.

honestly i cant yet come to any conclusion on what method to use. so if you have any more ideas please do share. thanks in advance.

david-cermak commented 2 months ago

just a few comments:

parthbhat13 commented 2 months ago

Thanks for the response, I'm gonna take 4-5 different production boards and test all the different scenarios. I recently was with a professor of mine he was working on php and a commercial project which used a7672S and stm32, I was amazed to see how quick the http post request response was being received. Many pointed out to me that apart from the network drop in my product, there might be the server issues as well. So will even test it out and get back to you with results so it helps others as well.

One small help I'd ask for, can you point me to the specific function in esp-modem which waits for the AT response ?

I'd like to wait for gsm to get stable once I toggle the power pin, and wait to receive its own Startup at messages like

And only then I'd send the At commands to the gsm. I saw there's a function to send at command and there's a timeout mentioned, but I'd wanna simply wait for a valid data to be received.

Thanks in advance.

david-cermak commented 2 months ago

You can either send a null command or use dce->command() API or even supply your own callback in got_line argument.

parthbhat13 commented 2 months ago

hi, thanks for the response, since i am not fluent with C++ there are issues i am facing trying to make things working. i was even stuck with initializing the modem where i did not wanna pass the apn and init the

esp_modem_new_dev

perhaps so far this is what i have done and ported some of the espmodem function to work with mine, below are the code snippets.

esp_err_t initGsmUartAndPower(gsmConfig_t *config)
{
    esp_err_t ret;

    // setup the esp modem stack and data 
    ESP_LOGI(TAG, "Setting Up GSM Modem");
    esp_modem_dte_config_t dteConfig = ESP_MODEM_DTE_DEFAULT_CONFIG();

    // Setup Uart Specific Configuration
    dteConfig.uart_config.tx_io_num = config->gsmUartConfig.txPin;
    dteConfig.uart_config.rx_io_num = config->gsmUartConfig.rxPin;
    dteConfig.uart_config.rts_io_num = UART_PIN_NO_CHANGE;
    dteConfig.uart_config.cts_io_num = UART_PIN_NO_CHANGE;

    dteConfig.uart_config.rx_buffer_size = config->gsmUartConfig.rxBufferSize;
    dteConfig.uart_config.tx_buffer_size = config->gsmUartConfig.txBufferSize;
    dteConfig.uart_config.event_queue_size = config->gsmModemTaskConfig.eventQueueSize;
    dteConfig.task_stack_size = config->gsmModemTaskConfig.taskSize;
    dteConfig.task_priority = config->gsmModemTaskConfig.taskPriority;
    dteConfig.dte_buffer_size = config->gsmUartConfig.dteBufferSize;

    // configure the dce 
    // here we can later call the command to set the APN in the library 
    // esp_err_t esp_modem_set_apn(esp_modem_dce_t *dce, const char *apn);
    dceConfig = ESP_MODEM_DCE_DEFAULT_CONFIG("airtelgprs.com");

    // Configure the PPP netif
    esp_netif_config_t netifPPPConfig = ESP_NETIF_DEFAULT_PPP();

    // Configure Netif Object
    if (espModemNetif == NULL)
    {
        espModemNetif = esp_netif_new(&netifPPPConfig);
        assert(espModemNetif);
    }

    if (dceConfig == NULL)
    {
        dce = esp_modem_new_dev(ESP_MODEM_DCE_SIM7600, &dteConfig, &dceConfig, espModemNetif);
        assert(dce);
    }

    // setup Power
    ret = gpio_set_direction(config->gsmUartConfig.powerPin, GPIO_MODE_OUTPUT);
    ret = gpio_set_pull_mode(config->gsmUartConfig.powerPin, GPIO_PULLUP_DISABLE);
    ret = gpio_set_pull_mode(config->gsmUartConfig.powerPin, GPIO_PULLDOWN_DISABLE);
    gpio_set_level(config->gsmUartConfig.powerPin, 0);

    return ret;
}

and even the wrapper function which i have called in all the other files, this is what i have done

gsm_err_t DTESendCommandGetResponse(gsmConfig_t *config, char *atCommand, char *atResponse, char *atResponse2, int timeout)
{
    // TODO: well try to keep on resending the data maybe?
    gsm_err_t gsmErr;
    esp_err_t espErr;

    char bufData[config->gsmUartConfig.rxBufferSize];
    memset(bufData, '\0', sizeof(bufData));

    espErr = esp_modem_at(dce, atCommand, &bufData[0], timeout);

    if (espErr == ESP_OK)
    {

        // we can log the data here
        if (config->debugDTE)
        {
            ESP_LOGI(TAG, "Response: %s", bufData);
            ESP_LOG_BUFFER_HEX(TAG, bufData, strlen(bufData) + 1);
        }

        if (atResponse != NULL && bufData != NULL)
        {

            if (strstr(bufData, atResponse) != NULL)
            {
                if (atResponse2 != NULL)
                {
                    if (strstr(bufData, atResponse2) == 0)
                        return GSM_OK;
                    else
                        return GSM_ERROR;
                }
                return GSM_OK;
            }
            //TODO: Check if this needs to be fixed
            // this is basically to check if we got an error from the other function 
            // for example during pdp context if we got a known valid response or ERROR, then we should return erro r
            else if (atResponse2 != NULL && bufData != NULL)
            {
                if (strstr(bufData, atResponse2) != NULL)
                {
                    // again ideally we would reach to the else loop but i am confused with this part.
                    return GSM_ERROR;
                }
            }
            else
            {
                // ideally we should send this back to the URC
                if (strstr(bufData, "ERROR") != NULL)
                {
                    if (config->debugDTE)
                        ESP_LOGE(TAG, "Got Error URC Should Be called");
                    return GSM_ERROR;
                }
            }
        }
        else
        {
            ESP_LOGE(TAG, "Data did not receive correctly");
            return GSM_ERROR;
        }
    }
    else if (espErr == ESP_FAIL)
    {
        return GSM_ERROR;
    }
    else if (espErr == ESP_ERR_TIMEOUT)
    {
        return GSM_TIMEOUT;
    }
    else 
    {
        return GSM_ERROR;
    }

    return GSM_ERROR;
}

apologies if my code and concepts are too noob. trying to get my head around things after spending 10months on this project.

parthbhat13 commented 2 months ago

You can either send a null command or use dce->command() API or even supply your own callback in got_line argument.

Hi David,

Can you please point me to more right direction on how can I possibly implement it? I'm too much confused with how can I use those above mentioned functions.

parthbhat13 commented 2 months ago

Hi, Quick update, One of the problem which was mentioned in terms of the HTTP request time used to be 3Seconds, Figured out that if we use AT commands and use the HTTP Stack of the gsm and make HTTPS request it is around 3~4Seconds. If we use the HTTP url instead of the HTTPS, then we end up much more faster and around 300mS of the time. Same with the DialUp with HTTPS its 1-2Seconds and with HTTP its 100-200mS. so one thing is clear over here that it is better to use HTTP rather than HTTPS.

what i am planning now is to add a feature and modem of A7672S like how Mr.Franz have added for the gnss, and push this on the esp_modem. i went through all the old issues trying to figure out how we can add custom modem and add more features like using the internal HTTP stack of the gsm using AT commands. i could not find a good documentation for the same, would simply keep going through the issues and see how others have added features. if there is any other better documentation which you can walk me through it will be really helpful.

will keep updating over here so others might as well get better idea on how and what stack to use when, specially in the indian market.

thanks again.

parthbhat13 commented 3 weeks ago

hi @david-cermak ,

sorry for the late update, i was trying out multiple solutions to my problem. i decided to go with the AT commands rather than dial-up for the http requests to the server but it seems due to the server being secure and the TLS certs it takes too much time or sometimes misses the response from the server. i did try to connect with the Simcom people and they gave me response to use the SSLG at commands which i was not aware of and was not sure how to use.

i decided to go with dialup and cmux mode so i can keep checking the RSSI on runtime. i did apply the below option to disable

ESP_MODEM_CMUX_DEFRAGMENT_PAYLOAD

but it seems that the modem is not exiting the CMUX mode correctly. moreover i have even added the uart in the IRAM if that helps but still no use. i ran the modem console example which i have noticed you asking to use often in all the other issues ive read. below is the log of the same if you can take a closer look.

i am using the SIMCOM-A7672S, i could not even see the option in the modem list to explicitly choose SIMCOM-A7672S, all i could see was SIM7600 so, maybe that can be the issue? i dont know. eventually i even decided to go with the CAVLI-C16QS but upon reading the following thread

https://github.com/espressif/esp-protocols/issues/507

it seems that even the CAVLI modem is not really supported with the library. so it would be really helpful if you can help with something on what is happening over here.

esp> set_mode CMUX
I (22711) modem_console: Switching to CMUX name...
I (22951) modem_console: OK
esp> I (23001) esp-netif_lwip-ppp: Connected
I (23011) esp-netif_lwip-ppp: Name Server1: 10.174.107.166
I (23011) esp-netif_lwip-ppp: Name Server2: 8.8.8.8
esp> get_operator_name
I (32481) modem_console: Reading operator name...
I (32491) modem_console: OK. Operator name: 40405
esp> httpget
I (36691) modem_console_httpget: HTTP GET Status = 200, content_length = 271
esp> set_mode CMD
I (47011) modem_console: Switching to CMD name...
I (47021) esp-netif_lwip-ppp: User interrupt
I (47021) esp_modem_netif: PPP state changed event 5
W (47051) CMUX: Restarting CMUX state machine (reason: 3)
I (47051) CMUX: Protocol recovered
E (48071) modem_console: Failed to set the desired mode
Command returned non-zero error code: 0x1 (ERROR)
esp> get_operator_name
I (71411) modem_console: Reading operator name...
W (71411) CMUX: Restarting CMUX state machine (reason: 3)
I (71411) CMUX: Protocol recovered
E (146411) modem_console: Failed with TIMEOUT
Command returned non-zero error code: 0x1 (ERROR)
esp> set_mode CMUX
I (158281) modem_console: Switching to CMUX name...
E (158281) modem_console: Failed to set the desired mode
Command returned non-zero error code: 0x1 (ERROR)
esp> reset
I (163031) modem_console: Resetting the module...
W (163041) CMUX: Restarting CMUX state machine (reason: 3)
E (223031) modem_console: Failed with TIMEOUT
Command returned non-zero error code: 0x1 (ERROR)
esp> 

thanks in advance.

david-cermak commented 3 weeks ago

the modem is not exiting the CMUX mode correctly. i am using the SIMCOM-A7672S

https://github.com/espressif/esp-protocols/blob/7f248bd03f30d5054ac7a8faa0c2a42cd47413dc/docs/esp_modem/en/README.rst?plain=1#L212-L236

it seems that even the CAVLI modem is not really supported with the library

https://github.com/espressif/esp-protocols/issues/507#issuecomment-2020854916


Hi @parthbhat13

I have experienced couple of minor deviations in CMUX protocol implementation with some modems. For both of the issues above, the deviation seems to be on the modem side -- please see the references to the spec & linked explanations.

TBH, I'm not sure how to handle this in the library; so far, I'm publishing patches in the docs, feeling a bit reluctant to add those directly to the sources, as they break the CMUX spec.

Not a big problem for the SIM-A7672, as exiting CMUX mode is a marginal feature, with no actual usecase for embedded applications. The CAVLI device, however, doesn't even enter the CMUX mode properly and I don't see a good workaround, nor any add-on sources that would alter the initialization on the application level. I'd probably also add a patch and attach it to the esp_modem docs.

parthbhat13 commented 3 weeks ago

Hi @david-cermak, Thanks a lot for the prompt reply, since the documentation specifically mentioned the patch for the A7670C I didn't spend much time trying to implement the patch. I will try to do it tomorrow and update you. As far for the 2nd question what modem shall I be selecting when starting the dce? Like mentioned before I've selected the SIM7600, would that be any problem? Since I noticed while running the esp-console example, for reset it sends AT+CRESET rather than the AT+RESET required by the A7672S.

Does choosing the Sim7600 for dce makes any issues? Thanks.

david-cermak commented 3 weeks ago

Does choosing the Sim7600 for dce makes any issues?

haven't seen any protocol related issues with SIM7600. if there's a problem with specific commands, like missing AT commands, timeouts or the reset command, it could be easily updated on the application layer.

parthbhat13 commented 3 weeks ago

Does choosing the Sim7600 for dce makes any issues?

haven't seen any protocol related issues with SIM7600. if there's a problem with specific commands, like missing AT commands, timeouts or the reset command, it could be easily updated on the application layer.

Hey David, I failed to convey the right question here

esp_modem_dce_device

This does not have A7672S as an option, so is it okay if we have selected SIM7600 as device and use A7670S ?

david-cermak commented 3 weeks ago

Oh, sorry.

This does not have A7672S as an option, so is it okay if we have selected SIM7600 as device and use A7670S ?

These are different devices, so it depends on what you're trying to do. The essential commands for switching modes and basic terminal operations are the same, so if you just use the CMUX for networking and, from time to time ,check the signal quality or connection details, that's okay. If you need some advanced, device specific AT commands, you'd probably have to implement a custom device supporting these features, or use a generic command and parse the output manually.