callback function not executed.

Posts: 3
Joined: Tue Sep 13, 2016 1:45 am

callback function not executed.

Postby hp26 » Tue Sep 13, 2016 2:29 am

I have 2 esp-01 modules. One of which run the STATIONAP mode and acts as tcp server for the other esp module running on STATION mode. Data transfer is working properly but the callback functions are not being executed properly.

void ICACHE_FLASH_ATTR tcp_connect_sap_cb(void *arg){
struct espconn *conn_sap = (struct espconn *)arg; // THIS IS NOT BEING EXECUTED
espconn_regist_recvcb(conn_sap, recv_sap_cb); // THE IS WORKING
send_msg("'connect cb' SAP TCP CONNECTED\n"); // THIS IS NOT BEING EXECUTED

LOCAL void ICACHE_FLASH_ATTR tcp_init_sap(){
tcp_proto_sap.local_port = 2233;
tcp_conn_sap.type = ESPCONN_TCP;
tcp_conn_sap.state = ESPCONN_NONE;
tcp_conn_sap.proto.tcp = &tcp_proto_sap;
espconn_regist_connectcb(&tcp_conn_sap, tcp_connect_sap_cb);

sint8 sap_conn_accept = espconn_accept(&tcp_conn_sap);
if(sap_conn_accept != 0){
os_printf("SAP TCP CONN ACCEPT ERROR: %d\n",sap_conn_accept);
os_printf("SAP TCP DONE");

sint8 max_conn = espconn_tcp_set_max_con_allow(&tcp_conn_sap,5);
if(max_conn != 0){
os_printf("Set max conn error: %d\n",max_conn);


void user_init(void){
uart_init(BIT_RATE_19200, BIT_RATE_19200);

The receive callback is registered but the os_printf statements are not being executed.

Who is online

Users browsing this forum: No registered users and 6 guests