Working on Ameba_ATCMD_ESP example for BW16 but AT+CIPSERVER=1,1336 not working

Hi,
I recetly bought a BW16 module, and want to replace it with my current ESP8266 module. I want to integrate the AT command compatibility in BW16, for which I found ameba-arduino-d/Ameba_misc/ESP_ATCMD_on_AmebaD at dev · Ameba-AIoT/ameba-arduino-d · GitHub. So I flash Ameba_ATCMD_ESP using ArduinoIDE to BW16 module.
The BW16 module is responding correctly to all AT commands in STA mode. However, in AP mode, my command sequence is as follows:
AT
ATE0
AT+CIPSTAMAC?
AT+CWDHCP=1,1
AT+CIPSTA?
AT+CWMODE=2
AT+CWSAP=“AirVeda ID:1201250048”,“12345”,3,0
AT+CIPMUX=1
AT+CIPSERVER=1,1336

The BW16 responds to all commands except AT+CIPSERVER=1,1336, which is used to set the port.

I would like to know if there is an alternative command for setting the port in AP mode or if there’s a way to hardcode it directly in the library code. Any guidance would be appreciated!

Thanks!

Hi @sachin,

There is no AT+CIPSERVER command. Are you using TCP or UDP for the connection?

Sample code to set the port:

server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
server_addr.sin_port = htons(80);

Thank you.

Hi @kelvin_Huang,
First of all, thank you for taking the time to help me.

I am using a TCP connection and have the following questions:

  1. Which function should I modify to change this setting?
  2. Is this change applicable when WiFi is in AP mode and while executing the above AT command set?
  3. Will modifying these three lines change the port?

For context, I researched online and found that the default port is 333. I updated our app to work on port 333, but the BW16 is still unable to connect to the app. Previously, I was using the ESP8266 with the app on port 1336, but now I have switched to BW16.

What is the default port set to?

I already tried changing this line:
server_addr.sin_port = htons(80); like this
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = client_conn_list[link_id].addr;
serv_addr.sin_port = htons(1336);
inside the function atcmd_client_start(uint8_t link_id), but it didn’t work. I also added a print statement to check if the CPU was reaching this section of code, but I didn’t see the print output on the monitor.
It seems like this port setting takes effect when using the AT+CIPSTART command. However, since I want to use the module in AP mode, I am using the following command set instead:

AT
ATE0
AT+CIPSTAMAC?
AT+CWDHCP=1,1
AT+CIPSTA?
AT+CWMODE=2
AT+CWSAP=“AirVeda ID:1201250048”,“12345”,3,0
AT+CIPMUX=1
AT+CIPSERVER=1,1336

The AT are reference from ESP, and Ameba Arduino SDK only supports