Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SYSTEM_THREAD(ENABLED) breaks TCPServer (develop branch) #1344

Closed
tlangmo opened this issue Jun 16, 2017 · 1 comment

Comments

@tlangmo
Copy link
Contributor

commented Jun 16, 2017

Bug Report

When using the system thread with SYSTEM_THREAD(ENABLED) the TCPServer does not receive connections.

I suspect it s.th. related to the recently incorporated WICED branch.

Expected Behavior

TCPServer should return connected TCPClient objects on TCPServer::available() whenever a TCP connection is opened.

Observed Behavior

With SYSTEM_THREAD(ENABLED) no TCPClients objects are created. Wireshark shows that not even SYN packets are acknowledged. Without system thread it works fine.

I also noticed that sometime the WIFI connection does not get established in the first place when with SYSTEM_THREAD(ENABLED). It flashed green rapidly, so I guess it does not obtain the DHCP address...

Steps to Reproduce

Compile with the following env variables. II tried also MODULAR=n, but the issue remains
Once the software runs, use telnet <IP> to open a tcp connection on port 23

export PATH=$PATH:~/arm_install/gcc-arm-none-eabi-5_3-2016q1/bin
export PARTICLE_DEVELOP=1
export DEBUG_BUILD=n
export PLATFORM=photon
export USE_SWD_JTAG=n
export MODULAR=y
export APPDIR=~/dev/photon-simple

Test App - This app opens a TCPServer on port 23

#include "application.h"
#include "stdarg.h"

PRODUCT_ID(PLATFORM_ID);
PRODUCT_VERSION(3);


#if Wiring_WiFi
STARTUP(System.enable(SYSTEM_FLAG_WIFITESTER_OVER_SERIAL1));
#endif

USBSerial1LogHandler logHandler(LOG_LEVEL_INFO);

// When enabled the TCPServer does not work anymore
SYSTEM_THREAD(ENABLED);

SYSTEM_MODE(SEMI_AUTOMATIC);
TCPServer telnet(23);
/* This function is called once at start up ----------------------------------*/
void setup()
{
    WiFi.on();
    WiFi.setCredentials("SSID", "PASSPHRASE");
    WiFi.connect();
    waitUntil(WiFi.ready);
    while (WiFi.localIP() == IPAddress()) {
    	delay(10);
    }
    Log.info(WiFi.localIP().toString());
    telnet.begin();
}

/* This function loops forever --------------------------------------------*/
void loop()
{
	TCPClient client = telnet.available();
	if (client.connected()) {
			client.write("photon\n");
			Log.info("photon");
	}
}

@tlangmo tlangmo referenced this issue Jun 16, 2017
5 of 6 tasks complete

@technobly technobly added this to the 0.7.0 milestone Jun 16, 2017

@technobly

This comment has been minimized.

Copy link
Member

commented Jun 16, 2017

Thanks @tlangmo we are aware of a bug in 0.7.0-rc.1 with SYSTEM_THREAD(ENABLED) that we will fix in 0.7.0-rc.2.

@avtolstoy avtolstoy referenced this issue Jun 20, 2017
6 of 6 tasks complete

@technobly technobly closed this Mar 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.