RTOS 1.5 + wifi_station_scan --- BUG???

jhinkle
Posts: 32
Joined: Tue Apr 19, 2016 12:09 am

RTOS 1.5 + wifi_station_scan --- BUG???

Postby jhinkle » Wed Dec 07, 2016 2:32 am

I have a simple test program to acquire AP's.

I keep getting fatal exceptions -- can't see an issue with my code -- does RTOS 1.5 have a bug?

Any help or comments would be thankful.


Code: Select all

User_Init Joe
mode : sta(5c:cf:7f:14:b0:3b)
add if0
Hello, welcome to scan-task!
Calling Scan
Delay another 5
Fatal exception (0):
epc1=0x40220282
epc2=0x00000000
epc3=0x402314d0
epcvaddr=0x00000238
depc=0x00000000
rtn_add=0x40100e1d
ú
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)



My simple application

Code: Select all

void ICACHE_FLASH_ATTR scan_done(void *arg, STATUS status)
{
   uint8 ssid[33];
   char temp[128];
   
   return;   // just to make sure no error here causing fault
}

void ICACHE_FLASH_ATTR user_scan(void)
{
    // wifi scan has to after system init done

   if(wifi_get_opmode() == SOFTAP_MODE)
   {
      os_printf("ap mode can't scan !!!\r\n");
      return;
   }
   
   os_printf("Calling Scan\n");
   
   
   wifi_station_scan(NULL, scan_done);

}


void ICACHE_FLASH_ATTR scan_task(void *pvParameters)
{
   printf("Hello, welcome to scan-task!\r\n");

   user_scan();

   while(1)
   {
      os_printf("Delay another 5\n");
      vTaskDelay(5000 / portTick_RATE_MS);
   }
}

//Unless you explicitly define the functions as RAMFUNC, they will be placed in the SPI FLASH and the debugge>
//won't be able to set software breakpoints there.
void ICACHE_FLASH_ATTR user_init(void) 
{
#ifdef ESP8266_GDBSTUB
   //gdbstub_init();
#endif

   UART_ConfigTypeDef uart_config;
   uart_config.baud_rate = BIT_RATE_115200;
   uart_config.data_bits = UART_WordLength_8b;
   uart_config.parity = USART_Parity_None;
   uart_config.stop_bits = USART_StopBits_1;
   uart_config.flow_ctrl = USART_HardwareFlowControl_None;
   uart_config.UART_RxFlowThresh = 120;
   uart_config.UART_InverseMask = UART_None_Inverse;
   UART_ParamConfig(UART1, &uart_config);
   UART_SetPrintPort(UART1);
   
   os_printf("User_Init Joe\n");

// Ensure we are in station mode
   wifi_set_opmode_current(STATION_MODE);
   
   //Set softAP + station mode
//   wifi_set_opmode(STATIONAP_MODE);

   
   xTaskCreate(scan_task, "scantsk", 256, NULL, 2, NULL);
}

Last edited by jhinkle on Wed Dec 07, 2016 10:30 pm, edited 1 time in total.

ESP_Xutao
Posts: 134
Joined: Tue Sep 27, 2016 5:42 pm

Re: RTOS 1.5 + wifi_station_scan --- BUG???

Postby ESP_Xutao » Wed Dec 07, 2016 12:27 pm

Hi
About Fatal exception,you can consult our document,link:http://espressif.com/sites/default/files/documentation/esp8266_reset_causes_and_common_fatal_exception_causes_en.pdf.According this fatal,the reason is illegal visit address.you can user os_malloc.For:os_malloc(ssid)and os_malloc(temp).you can use way have a try.

jhinkle
Posts: 32
Joined: Tue Apr 19, 2016 12:09 am

Re: RTOS 1.5 + wifi_station_scan --- BUG???

Postby jhinkle » Wed Dec 07, 2016 10:20 pm

ESP_Xutao:

Thank you for the link to the reset/exception document.

My application does nothing but call wifi_station_scan(NULL, scan_done);

wifi_station_scan(NULL, scan_done) is not called within user_init but from a user task hence system initialization should be complete.

Since wifi_station_scan is a system function - I suggested that RTOS 1.5 may have a bug.

Do you see an issue with the way wifi_station_scan was called since it the only user code that is being executed.

Thank you in advance for your reply.

ESP_Xutao
Posts: 134
Joined: Tue Sep 27, 2016 5:42 pm

Re: RTOS 1.5 + wifi_station_scan --- BUG???

Postby ESP_Xutao » Thu Dec 08, 2016 4:57 pm

Hi
I want to reproduce your problem,but I'm OK.(RTOS 1.5).So it's not RTOS 1.5+wifi_station_scan-BUG.As follow is my small code.

Code: Select all

void ICACHE_FLASH_ATTR scan_done(void *arg, STATUS status)
{
   uint8 ssid[33];
   char temp[128];
   
   return;   // just to make sure no error here causing fault
}

void ICACHE_FLASH_ATTR user_scan(void)
{
    // wifi scan has to after system init done

   if(wifi_get_opmode() == SOFTAP_MODE)
   {
      os_printf("ap mode can't scan !!!\r\n");
      return;
   }
   
   os_printf("Calling Scan\n");
   
   
   wifi_station_scan(NULL, scan_done);

}

void ICACHE_FLASH_ATTR scan_task(void *pvParameters)
{
   printf("Hello, welcome to scan-task!\r\n");

   user_scan();

   while(1)
   {
      os_printf("Delay another 5\n");
      vTaskDelay(5000 / 10);
   }
}

/******************************************************************************
 * FunctionName : user_init
 * Description  : entry of user application, init user function here
 * Parameters   : none
 * Returns      : none
*******************************************************************************/
void ICACHE_FLASH_ATTR
user_init(void)
{
    printf("SDK version:%s\n", system_get_sdk_version());

    /* need to set opmode before you set config */
    wifi_set_opmode(STATION_MODE);

    //xTaskCreate(smartconfig_task, "smartconfig_task", 256, NULL, 2, NULL);

   os_printf("User_Init Hmj\n");
   wifi_set_opmode_current(STATION_MODE);
   xTaskCreate(scan_task, "scantsk", 256, NULL, 2, NULL);
}



Code: Select all

SDK version:1.5.0-dev(950076a)
User_Init Hmj
mode : sta(18:fe:34:ce:25:fe)
add if0
Hello, welcome to scan-task!
Calling Scan
Delay another 5
scandone
Delay another 5
Delay another 5
Delay another 5
Delay another 5
Delay another 5

Who is online

Users browsing this forum: No registered users and 3 guests