[Solved] Regarding Promiscuous Mode

Rutharesh
Posts: 6
Joined: Tue Dec 01, 2015 3:09 pm

[Solved] Regarding Promiscuous Mode

Postby Rutharesh » Tue Dec 01, 2015 3:16 pm

As per the Documentation provided in the link "http://nonnoise.github.io/ESP-WROOM-02/_downloads/2C-ESP8266__SDK__Programming%20Guide__EN_v1.1.1.pdf", i have used the esp8266 to connect it in Promiscuous Mode, using the "ESP8266_RTOS_SDK" in the link "https://github.com/espressif/ESP8266_RTOS_SDK". In the sdk folder examples/project_template/user i have edited the file user_main.c with the code,

#include "esp_common.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

/*
* To set the Buad rate
*/
void ICACHE_FLASH_ATTR
UART_SetBaudrate(uint8 uart_no, uint32 baud_rate)
{
uart_div_modify(uart_no, UART_CLK_FREQ / baud_rate);
}

void ICACHE_FLASH_ATTR
wifi_promiscuous_cb_t1(uint8 *buf, uint16 len)
{

printf("Received packet");
}
wifi_promiscuous_cb_t wifi_promiscuous_cb_t2 = wifi_promiscuous_cb_t1;
/*
* This is entry point for user code
*/
void ICACHE_FLASH_ATTR
user_init(void)
{
UART_SetBaudrate(0,115200);
struct station_config * config = (struct station_config *)zalloc(sizeof(struct
station_config));
wifi_set_opmode(0x01);
sprintf(config->ssid, "SSID");
sprintf(config->password, "password");
wifi_station_set_config(config);
free(config);
wifi_station_connect();
vTaskDelay(2000);
wifi_station_disconnect;
wifi_promiscuous_enable(1);
wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t2);

}


after building the project template using gen_misc.sh, i have flashed it using "esptool".
By using the minicom i see the serial monitor output where it prints that esp8266 is connected to ssid and by using the dhcp it gets ip and it prints,after that nothing is happening. can you help to get working in the Promiscuous mode. here is the minicom output.

mode : sta(18:fe:34:fa:36:87)
add if0
f r0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 14
pm open phy_2,type:2 0 0
cnt

connected with SSID, channel 7
dhcp client start...
ip:10.10.10.50,mask:255.255.255.0,gw:10.10.10.1

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

Re: Regarding Promiscuous Mode

Postby ESP_Faye » Tue Dec 01, 2015 4:48 pm

Hi,

Please do not put codes below in the user_init, you can use a task to call them.

Code: Select all

wifi_station_connect();
vTaskDelay(2000);
wifi_station_disconnect;
wifi_promiscuous_enable(1);
wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t2);


Thanks for your interest in ESP8266 !

Rutharesh
Posts: 6
Joined: Tue Dec 01, 2015 3:09 pm

Re: Regarding Promiscuous Mode

Postby Rutharesh » Fri Feb 26, 2016 12:24 am

When i use a task to call this code it works :D :D thanks a lot

Code: Select all

wifi_station_connect();
vTaskDelay(2000);
wifi_station_disconnect;
wifi_promiscuous_enable(1);
wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t2);

redduck1234
Posts: 1
Joined: Fri Feb 26, 2016 12:06 pm

Re: Regarding Promiscuous Mode

Postby redduck1234 » Fri Feb 26, 2016 12:09 pm

:D

Who is online

Users browsing this forum: No registered users and 16 guests