ESP8266 Developer Zone The Official ESP8266 Forum 2016-12-08T16:57:49+08:00 https://bbs.espressif.com:443/feed.php?f=65&t=3177 2016-12-08T16:57:49+08:00 2016-12-08T16:57:49+08:00 https://bbs.espressif.com:443/viewtopic.php?t=3177&p=10846#p10846 <![CDATA[Re: RTOS 1.5 + wifi_station_scan --- BUG???]]> 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:

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:

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

Statistics: Posted by ESP_Xutao — Thu Dec 08, 2016 4:57 pm


]]>
2016-12-07T22:20:32+08:00 2016-12-07T22:20:32+08:00 https://bbs.espressif.com:443/viewtopic.php?t=3177&p=10838#p10838 <![CDATA[Re: RTOS 1.5 + wifi_station_scan --- BUG???]]>
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.

Statistics: Posted by jhinkle — Wed Dec 07, 2016 10:20 pm


]]>
2016-12-07T12:27:34+08:00 2016-12-07T12:27:34+08:00 https://bbs.espressif.com:443/viewtopic.php?t=3177&p=10827#p10827 <![CDATA[Re: RTOS 1.5 + wifi_station_scan --- BUG???]]> 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.

Statistics: Posted by ESP_Xutao — Wed Dec 07, 2016 12:27 pm


]]>
2016-12-07T22:30:21+08:00 2016-12-07T02:32:25+08:00 https://bbs.espressif.com:443/viewtopic.php?t=3177&p=10822#p10822 <![CDATA[RTOS 1.5 + wifi_station_scan --- BUG???]]>
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:

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:

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);
}

Statistics: Posted by jhinkle — Wed Dec 07, 2016 2:32 am


]]>