Chat freely about anything...

User avatar
By stairan
#2838 Hello!
I have a problem with response, i modified the startup setting in the user_main.c, set up a tcp server there just like with the at command cipserver. i can connect to it and send data, it receives it because the light flashes, but it doesnt reply to my other device. i have another micom which should reply through the esp module.

Code: Select all#include "ets_sys.h"
#include "driver/uart.h"
#include "osapi.h"
#include "at.h"
#include "at_ipCmd.h"

#define sleepms(x) os_delay_us(x*1000);

extern uint8_t at_wifiMode;

void user_init(void)
{
  uart_init(BIT_RATE_9600, BIT_RATE_9600);
  //at_wifiMode = wifi_get_opmode();
 
  wifi_set_opmode(STATION_MODE);
 
  os_printf("\r\nready!!!\r\n");
  uart0_sendStr("\r\nready\r\n");
  at_init();
 
    uart0_sendStr("\r\nset cwmode\r\n");
  char cwmode[] = "=3\r\n";
  at_setupCmdCwmode(0, cwmode);
  sleepms(2000);
 
  sleepms(2000);
  uart0_sendStr("Setting MUX to 1:");
  at_setupCmdCipmux(15, "=1");

  at_queryCmdCipmux(15);
 
  sleepms(2000);
 
  uart0_sendStr("Starting TCP server:");
  at_setupCmdCipserver(16, "=1,7788"); 
  sleepms(2000);
 
}
Last edited by stairan on Thu Nov 20, 2014 3:28 am, edited 1 time in total.
User avatar
By stairan
#2964 I have tried to get response from the esp by using it as a tcp server, and connect to it, and now also tried so that the esp8266 connects to my other device, but still no response. i tried to send data on the test board with at command (cipsend), that works, but on the other board i cant use at commands to test it, so i would like to add to the firmware that after the esp connects to the other device it sends a short message. since i cant use at commands there, i think i have to use the "espconn_sent" command. i tried it, but i think im giving wrong parameters because nothing happens (or there is simply something wrong with my esp8266). anyone had this kind of problem before?

Code: Select allchar cipstart[] = "=4,\"TCP\",\"111.222.333.444\",9999\r\n";
  at_setupCmdCipstart(0, cipstart);
  uint16 length=4;
  espconn_sent(pLink[4].pCon, "test", length);
User avatar
By villTech
#2967 before you issue espconn_sent, you need to issue at_setupCmdCipsend(14,"=x").

and you might need to add delay before each command. mine either resets or become busy without delay.