Compiling with latest SDK 0.9.5, here is the code I use on both esp8266-01 and esp8266-03 platforms (code is originated from cnlohr):
#include "espconn.h"
...//other includes files are not pasted here
void user_init(void)
{
wifi_set_opmode( 2 ); //We broadcast our ESSID, wait for people to join.
pUdpServer = (struct espconn *)os_zalloc(sizeof(struct espconn));
ets_memset( pUdpServer, 0, sizeof( struct espconn ) );
espconn_create( pUdpServer );
pUdpServer->type = ESPCONN_UDP;
pUdpServer->proto.udp = (esp_udp *)os_zalloc(sizeof(esp_udp));
pUdpServer->proto.udp->local_port = 7777;
espconn_regist_recvcb(pUdpServer, udpserver_recv);
wifi_station_dhcpc_start();
if( espconn_create( pUdpServer ) )
{
while(1) { uart0_sendStr( "FAULT\r\n" ); }
}
ets_wdt_disable();
system_os_task(procTask, procTaskPrio, procTaskQueue, procTaskQueueLen); //Add a process
uart0_sendStr("\r\nCustom Server\r\n");
}
On the esp8266-01, I see the hotspot appearing and I can connect to it and access the UDP server. The IP is in the range 192.168.4.x, which seems to be the automatic default.
But on the esp8266-03, no way.
Although I am sure that the rev-03 hardware is working, because if I load nodemcu firmware on it, I can set up a quick hotspot by using some lua commands.
Then, what is wrong with this upper code on the esp-03?
Thanks.