Can't communicate two devices and ESP8266 in APMODE over UDP broadcast RTOS v1.5

domecar
Posts: 4
Joined: Fri Oct 27, 2017 8:37 am

Can't communicate two devices and ESP8266 in APMODE over UDP broadcast RTOS v1.5

Postby domecar » Fri Oct 27, 2017 8:55 am

Hi! im trying to communicate two phones over UDP protocol sending broadcast packets but with RTOS v1.5 i can't do this. If i change to NONOS works perfectly! what could be the problem?

this is my code, for RTOS (I edit it because is long) Cellphone 1 is in port 3331 and cellphone 2 is in port 3332. if i send broadcast data from Cell 1 to 2 it never come. but if i send to ESP AP at port 3330, data arrives perfectly to ESP. I cant comunicate between clients.

What could be the error?

Thanks!!!

Code: Select all

#include "esp_common.h"
#include "user_config.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/timers.h"
#include "freertos/queue.h"

#include "espconn.h"

#define WIFI_APSSID   "ESP8266"
#define WIFI_APPASSWORD   "0123456789"

/*Definicion de datos de Sockets*/
#define SOCKET_PORT_IN    3330
#define SOCKET_PORT_OUT 6666

static struct espconn ptrespconn;

LOCAL void user_udp_recv(void *arg, char *rdata, unsigned short length)
{
   //Do nothing for now...
}


void UDP_init(void)
{
    ptrespconn.type = ESPCONN_UDP;
    ptrespconn.proto.udp = (esp_udp *)os_zalloc(sizeof(esp_udp));
    ptrespconn.proto.udp->local_port = SOCKET_PORT_IN; 
    espconn_regist_recvcb(&ptrespconn, user_udp_recv);
    espconn_create(&ptrespconn);   
}

void SetAP()
{
   static struct softap_config apconf;

   wifi_set_opmode(SOFTAP_MODE);

   wifi_softap_get_config(&apconf);

   memset(apconf.ssid, 0, 32);
   memset(apconf.password, 0, 64);
   memcpy(apconf.ssid,WIFI_APSSID, sizeof(WIFI_APSSID));
   memcpy(apconf.password, WIFI_APPASSWORD, sizeof(WIFI_APPASSWORD));

   apconf.authmode = AUTH_WPA_WPA2_PSK;
   apconf.max_connection = 8;
   apconf.ssid_hidden = 0;
   apconf.ssid_len = strlen(WIFI_APSSID);
   apconf.channel = 1;
   apconf.beacon_interval = 100;

   wifi_softap_set_config(&apconf);
}

uint32 user_rf_cal_sector_set(void)
{
    flash_size_map size_map = system_get_flash_size_map();
    uint32 rf_cal_sec = 4;

    switch (size_map) {
        case FLASH_SIZE_4M_MAP_256_256:
            rf_cal_sec = 128 - 5;
            break;

        case FLASH_SIZE_8M_MAP_512_512:
            rf_cal_sec = 256 - 5;
            break;

        case FLASH_SIZE_16M_MAP_512_512:
        case FLASH_SIZE_16M_MAP_1024_1024:
            rf_cal_sec = 512 - 5;
            break;

        case FLASH_SIZE_32M_MAP_512_512:
        case FLASH_SIZE_32M_MAP_1024_1024:
            rf_cal_sec = 1024 - 5;
            break;
        case FLASH_SIZE_64M_MAP_1024_1024:
            rf_cal_sec = 2048 - 5;
            break;
        case FLASH_SIZE_128M_MAP_1024_1024:
            rf_cal_sec = 4096 - 5;
            break;
        default:
            rf_cal_sec = 0;
            break;
    }

    return rf_cal_sec;
}
/******************************************************************************
 * FunctionName : user_init
 * Description  : entry of user application, init user function here
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void user_init(void)
{
    uart_div_modify(0, UART_CLK_FREQ / 115200);
   os_delay_us(500);

   os_printf("SDK version : %s\n", system_get_sdk_version());
   SetAP();
   espconn_init(); //ESPCONN INIT
   UDP_init();
}
Last edited by domecar on Fri Oct 27, 2017 10:23 am, edited 1 time in total.

Her Majesty
Posts: 294
Joined: Mon Oct 27, 2014 11:09 am

Re: Can't communicate two devices and ESP8266 in APMODE over UDP broadcast RTOS v1.5

Postby Her Majesty » Fri Oct 27, 2017 9:57 am

For RTOS SDK, you need to call espconn_init first to use the espconn_xxxx APIs. You can have a try with it, maybe it can solve your problem.

domecar
Posts: 4
Joined: Fri Oct 27, 2017 8:37 am

Re: Can't communicate two devices and ESP8266 in APMODE over UDP broadcast RTOS v1.5

Postby domecar » Fri Oct 27, 2017 10:25 am

Thanks for your response! I edited my code with espconn_init(); but unfortunaly still not works! :(

ESP_Faye
Posts: 1637
Joined: Mon Oct 27, 2014 11:08 am

Re: Can't communicate two devices and ESP8266 in APMODE over UDP broadcast RTOS v1.5

Postby ESP_Faye » Fri Oct 27, 2017 1:37 pm

Hi,

Sorry that this feature has not released on ESP8266 RTOS SDK, it is only on the non OS SDK now.

We will add it in the future release.

So sorry for the inconvenience.

domecar
Posts: 4
Joined: Fri Oct 27, 2017 8:37 am

Re: Can't communicate two devices and ESP8266 in APMODE over UDP broadcast RTOS v1.5

Postby domecar » Sun Oct 29, 2017 5:49 am

Thank you very much!

I'll wait for it!

regards!

domecar
Posts: 4
Joined: Fri Oct 27, 2017 8:37 am

Re: Can't communicate two devices and ESP8266 in APMODE over UDP broadcast RTOS v1.5

Postby domecar » Mon Oct 30, 2017 9:10 pm

Sorry if this is not the correct place to post the problem, but i have a problem with esp-open-sdk compilation. When i try to compile the IoT_Demo example from ESP8266_NONOS_SDK_V2.0.0_16_08_10 folder, I have this error.

Code: Select all

../Makefile:136: warning: overriding recipe for target 'clean'
Makefile:95: warning: ignoring old recipe for target 'clean'
You cloned without --recursive, fetching submodules for you.
git submodule update --init --recursive
make -C crosstool-NG -f ../Makefile _ct-ng
make[1]: *** crosstool-NG: No such file or directory. Stop.
../Makefile:122: recipe for target 'crosstool-NG/ct-ng' failed
make: *** [crosstool-NG/ct-ng] Error 2


I editted code because it was in spanish. This is English Version of output when i try to make the example.

I don't know what is happening, could you help me?

Who is online

Users browsing this forum: No registered users and 2 guests