Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Nijeesh Joshy
    hi guys
    Max VonSydow
    Hi Guys,
    any one tried mqtt in c
    I tried https://github.com/cesanta/mongoose-os/tree/master/fw/examples/c_mqtt this example but unable initiate the connection
    Hi guys. Can anyone help me in obtaining the local random UDP port when i'm creating a new UDP connection using mg_connect()?
    Is that available somewhere in the struct mg_connection parameter in the event callback method?
    As far as i know every esp has unique MAC address which also serves as its client id, but I am facing duplicate client id issue with aws provisioned esp devices. I confirmed the same with aws support and cloudwatch logs.could anyone please give me any clue how this kind of issue is possible.
    i am using nodemcu esp8266 with mongoose os
    Manfred Müller-Späth
    @abhishek125 - Unfortunately you are in the wrong conversation, this is for mongoose, Cesantas web server, not mongoose-os, but there your question should be posted.
    Hi Guys,
    Currently I'm working on esp32 using mongoose
    I tried to compile free rtos with mongoose
    but I'm able to compile but module were continuously getting restart
    for ref:
    void mg_task(void *arg) {
      printf("mg_task started\r\n");
      while (1) {
    enum mgos_app_init_result mgos_app_init(void){//void user_init(void) {
      printf("Free RAM: \r\n");//, system_get_free_heap_size());
      xTaskCreate(mg_task,"mongoose",1024, NULL, 0, NULL);
      printf("%s", "hello, my task");
                  //MG_TASK_STACK_SIZE / 4, /* in 32-bit words */
                  //NULL, MGOS_TASK_PRIORITY, NULL);
     //xTaskCreatePinnedToCore(&my_task, "tskmad", 2048, NULL, 5, NULL, 0);
     // while (1);

    rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)<CR><LF>
    configsip: 0, SPIWP:0xee<CR><LF>
    mode:DIO, clock div:1<CR><LF>
    entry 0x40080740<CR><LF>

    <ESC>W (58) boot: PRO CPU has been reset by WDT.<ESC><CR><LF>

    <ESC>W (58) boot: WDT reset info: PRO CPU PC=0x400803c0<ESC><CR><LF>

    <ESC>W (58) boot: WDT reset info: APP CPU PC=0x8a9e2587<ESC><CR><LF>

    <ESC>I (64) boot: ESP-IDF v3.2-r2 2nd stage bootloader<ESC><CR><LF>

    <ESC>I (69) boot: compile time 12:43:38<ESC><CR><LF>

    <ESC>I (73) boot: Enabling RNG early entropy source...<ESC><CR><LF>

    <ESC>I (79) qio_mode: Enabling default flash chip QIO<ESC><CR><LF>

    <ESC>I (84) boot: SPI Speed : 80MHz<ESC><CR><LF>

    <ESC>I (88) boot: SPI Mode : QIO<ESC><CR><LF>

    <ESC>I (92) boot: SPI Flash Size : 4MB<ESC><CR><LF>

    <ESC>I (96) boot: Partition Table:<ESC><CR><LF>

    <ESC>I (100) boot: ## Label Usage Type ST Offset Length Flags<ESC><CR><LF>

    <ESC>I (108) boot: 0 nvs WiFi data 01 02 00009000 00004000 00000000<ESC><CR><LF>

    <ESC>I (116) boot: 1 otadata OTA data 01 00 0000d000 00002000 00000000<ESC><CR><LF>

    <ESC>I (125) boot: 2 app_0 OTA app 00 10 00010000 00180000 00000000<ESC><CR><LF>

    <ESC>I (133) boot: 3 fs_0 SPIFFS 01 82 00190000 00040000 00000000<ESC><CR><LF>

    <ESC>I (141) boot: 4 app_1 OTA app 00 11 001d0000 00180000 00000000<ESC><CR><LF>

    <ESC>I (150) boot: 5 fs_1 SPIFFS 01 82 00350000 00040000 00000000<ESC><CR><LF>

    <ESC>I (158) boot: End of partition table<ESC><CR><LF>

    <ESC>I (162) boot: OTA data 0: seq 0x00000001, st 0x10, CRC 0x157a2b85, valid? 1<ESC><CR><LF>

    <ESC>I (170) boot: OTA data 1: seq 0x00000000, st 0x00, CRC 0x00000000, valid? 0<ESC><CR><LF>

    <ESC>I (177) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x245d0 (148944) map<ESC><CR><LF>

    <ESC>I (225) esp_image: segment 1: paddr=0x000345f8 vaddr=0x3ffb0000 size=0x0253c ( 9532) load<ESC><CR><LF>

    <ESC>I (228) esp_image: segment 2: paddr=0x00036b3c vaddr=0x40080000 size=0x00400 ( 1024) load<ESC><CR><LF>

    <ESC>I (232) esp_image: segment 3: paddr=0x00036f44 vaddr=0x40080400 size=0x090cc ( 37068) load<ESC><CR><LF>

    <ESC>I (252) esp_image: segment 4: paddr=0x00040018 vaddr=0x400d0018 size=0xa9c60 (695392) map<ESC><CR><LF>

    <ESC>I (434) esp_image: segment 5: paddr=0x000e9c80 vaddr=0x400894cc size=0x07b30 ( 31536) load<ESC><CR><LF>

    <ESC>I (453) boot: Loaded app from partition at offset 0x10000<ESC><CR><LF>

    <ESC>I (454) boot: Disabling RNG early entropy source...<ESC><CR><LF>

    <ESC>I (454) cpu_start: Pro cpu up.<ESC><CR><LF>

    <ESC>I (458) cpu_start: Single core mode<ESC><CR><LF>

    <ESC>I (462) heap_init: Initializing. RAM available for dynamic allocation:<ESC><CR><LF>

    <ESC>I (469) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM<ESC><CR><LF>

    <ESC>I (475) heap_init: At 3FFBA588 len 00025A78 (150 KiB): DRAM<ESC><CR><LF>

    <ESC>I (481) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM<ESC><CR><LF>

    <ESC>I (488) heap_init: At 40078000 len 00008000 (32 KiB): IRAM<ESC><CR><LF>

    <ESC>I (494) heap_init: At 40090FFC len 0000F004 (60 KiB): IRAM<ESC><CR><LF>

    <ESC>I (500) cpu_start: Pro cpu start user code<ESC><CR><LF>

    <ESC>I (181) cpu_start: Starting scheduler on PRO CPU.<ESC><CR><LF>
    mgos_hal_freertos.c:177 rtos 1.0 (20190326-164015)<CR><LF>
    mgos_hal_freertos.c:179 Mongoose OS 2.12.1 (20190326-124823/2.12.1-gdd403d6)<CR><LF>
    mgos_hal_freertos.c:182 CPU: 160 MH

    run time execption
    If any one knows please help me
    Ryan Truer
    @suryaobulareddy_gitlab i think you are in the wrong chat... use mongoose-os
    please help for flashing esp01 in MangooseOS
    Pim van Pelt
    Esp01 doesn’t have enough flash for Mongoose OS
    Also, this is the wrong channel for Mongoose OS
    I have a problem connecting to aws with a esp32 dev kit. I have existing certificates, key and policy for an existing aws connection that I use for testing various wifi boards. I setup my esp32 kit to point to my aws site and filled in all the proper information in the config files. AWS gives me a -2700 error (bad certificate). I have no problems connecting with non mongoose boards and I have no problem connecting to my own MQTT server (with different certs and key). Is there anything special about mongoose that wants its own type of cert/key rather than something that was generated directly in the aws cli rather than using the mongoose aws setup iot default command?
    This is the wrong channel for Mongoose OS. https://gitter.im/cesanta/mongoose-os
    Karthik Desai
    @cpq Sorry for the late reply. (Regarding the memory leaks question). Here is the valgrind-log gist again https://gist.github.com/karthikdesai/6380c611062e38c1a7944d15ef3c12eb
    The server was run for around a min. And from the log we see that:
    Sergey Lyubka
    @karthikdesai yes, please make sure there are no leaks from your own application first. When you can show valgrind output with only mongoose records, we might take a look.
    Karthik Desai
    @cpq Unfortunately these leaks are from other libraries i have no control over :(
    Sergey Lyubka
    @karthikdesai i am not sure that mongoose is to blame here - it could be that your application is guilty, not mongoose
    if you're convinced that mongoose is guilty, then provide a failing test in test/unit_test.c , we'll take a look
    i have a problem in rpc command,
    mos --port mqtt://my.mqtt.server:1883/esp32_6732ac ls
    above command run successfully when there is no authentication required, but when username and password was configured in mqtt broker, then what will be the method in rpc command to add username and password to execute rpc commands through mqtt. kindly help.
    @engrziarehman Wrong channel. Try https://gitter.im/cesanta/mongoose-os
    YueBing Tao

    while (1)
    //reconnect process
    if (mqttConnectState < 0)
    mg_mgr_init(&mgr, NULL);

            snprintf(port, sizeof(port), "%s:%d", GetSettings2("reportIp",""),1883);
            nc = mg_connect(&mgr, port, report_handler);
            if (nc)
                mg_set_timer(nc, mg_time() + 2.5);
                mqttConnectState = 0;
        mg_mgr_poll(&mgr, 10);


    this is a mqtt client code
    Pim ...
    Pim van Pelt
    hey :)
    so is the HA library a mqtt client ?
    Pim van Pelt
    just FYI, this is the underlying library Mongoose
    the thing you're looking for is Mongoose OS
    Pim van Pelt
    but yes, I started a library a few weeks ago
    have any public code ?
    Pim van Pelt
    because my wall switches and relays and thermo/hydro/baro etc sensors want to be exposed in my HA
    Pim van Pelt
    and I didn't like the alternatives like esphome and tasmota
    I haven't really finished the library yet but I am willing to put it online for you to play with
    some caveats: before I submit it to mongoos-os-libs/ it needs a few strong use cases
    currently all it does is expose gpio and a few sensors
    and it's not complete (and as well I have not run it in production, only in a few test instances where it seems to work well with MQTT auto discovery)
    YueBing Tao
    @pimvanpelt ...
    YueBing Tao


    void mbuf_resize(struct mbuf a, size_t new_size) {
    if(new_size==0)//if new_size ==0 will free(a->buf)?????
    if (new_size > a->size || (new_size < a->size && new_size >= a->len)) {
    buf = (char *) MBUF_REALLOC(a->buf, new_size);

    Anyone use GCP on ESP32?
    I have some problem... My device continously disconnett to MQTT broker
    [Jun 24 21:21:10.776] SW ECDSA verify curve 3 hash_len 32 sig_len 71
    [Jun 24 21:21:11.200] SW ECDH curve 3
    [Jun 24 21:21:11.726] mgos_mqtt_conn.c:227    MQTT0 TCP connect ok (0)
    [Jun 24 21:21:12.085] mgos_mqtt_conn.c:271    MQTT0 CONNACK 0
    [Jun 24 21:21:12.085] mgos_mqtt_conn.c:208    MQTT0 sub /devices/esp32_7C21F0/commands/# @ 1
    [Jun 24 21:21:12.091] mgos_mqtt_conn.c:208    MQTT0 sub /devices/esp32_7C21F0/config @ 1
    [Jun 24 21:21:12.189] mgos_mqtt_conn.c:253    MQTT0 Disconnect
    [Jun 24 21:21:12.189] mgos_mqtt_conn.c:544    MQTT0 connecting after 1883 ms
    [Jun 24 21:21:14.080] mgos_mqtt_conn.c:468    MQTT0 connecting to mqtt.2030.ltsapis.goog:8883
    [Jun 24 21:21:14.278] mg_ssl_if_mbedtls.c:31  0x3ffc8ee8 ciphersuite: TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
    [Jun 24 21:21:14.297] SW ECDSA verify curve 3 hash_len 32 sig_len 72
    [Jun 24 21:21:14.727] SW ECDSA verify curve 3 hash_len 32 sig_len 72
    [Jun 24 21:21:15.154] SW ECDSA verify curve 3 hash_len 32 sig_len 71
    Try the mongoose-os channel https://gitter.im/cesanta/mongoose-os
    @fcolasante_gitlab turn up debugging and look to see if it's saying certificate error and then rebooting the device. If so, do the gcp provision script again.