Sonoff-ESP8266-HomeKit icon indicating copy to clipboard operation
Sonoff-ESP8266-HomeKit copied to clipboard

Problems getting it to work

Open renssies opened this issue 6 years ago • 12 comments

I can't seem to get the firmware working on a Sonoff THV1.1 (Sonoff Basic).

The firmware compiles just fine with 40Mhz SPI speed, but the Sonoff never connects to the network. I edited user_main.c and turning on the LED just before it connects to the network and turn it off when the network has actually been connected.

However, the LED never turns on, not when powered from the mains connection and not when powered from the FTDI.

Flashing the simple blink program to it works fine. Adding the Arduino ESP Wifi library to that works as well. It successfully connects to the network.

If it has worked, what am I doing wrong? Could it be because the ESP seems to be an 8285 instead of an 8266 like the library was build for?

renssies avatar Sep 11 '17 20:09 renssies

The first boot needs about 25 seconds to initialize the SRP keys. Do you confirm you waited at least that amount of time? If you did it and it's still not working, could you provide the serial output?

However are you sure your Sonoff is this one? It seems strange that you got an ESP8285 on yours.

andreacucci avatar Sep 12 '17 10:09 andreacucci

I left it for like 5 minutes, but it never joined the network so it never started broadcasting its MDNS name. I haven't checked the serial output yet because I thought there wasn't any.

It is the correct Sonoff, the chip has 8266 written on it. However, if I look around, some people are saying the Sonoff uses an ESP8285, however, I can't find which sonoff they are talking about. The Touch and 4CH sonoff seem to be confirmed to use the EPS8285

Edit: I've found that it has serial output, but I can't seem to get the serial output. Or I'm having the wrong baud rate

renssies avatar Sep 12 '17 10:09 renssies

Sorry for the late reply, i did not notice you edited your comment. Default baudrate is 74880, did you try that?

andreacucci avatar Sep 21 '17 11:09 andreacucci

I'm not completely sure I tried a baud rate of74880, I might have accidentally used 748800. Do you know if the serial communication also works when the sonoff board is powered of the 3,3v TTL connection?

renssies avatar Sep 21 '17 12:09 renssies

Yes it does, you might have some problems with the relay not getting the right voltage to switch but the ESP will work fine.

andreacucci avatar Sep 21 '17 14:09 andreacucci

I've tried flashing the firmware again, but I can't get any serial output using PlatformIO, Arduino IDE or Screen (on Mac)

renssies avatar Oct 03 '17 21:10 renssies

I have absolutely the same problem I set wifi configuration with ssid an password but it can't connect to network I can access to console but din't see anything wrong

this is last log (after key initialise )

rf cal sector: 11
tcpip_task_hdl : 3fff0b40, prio:10,stack:512
idle_task_hdl : 3fff0be0,prio:0, stack:384
tim_task_hdl : 3fff3398, prio:2,stack:512
hkc by HomeACcessoryKid! Compiled Oct 20 2017@15:18:57 Heap: 47912
EspMsgMutex created
R[13] 112316-113992
486f6d654143636573736f72794b696400
R[13] 119872-121612
432dcf65f79bfe60bbdc9534fc79290add0fa329d8e392a36ec2887d0ef747c005ebb7332b25765d69823476d92128c21e82973b85b343270a30029f9112ad18
key loaded:  0
R[13] 142164-143896
myUsername: 22:14:E6:A3:8F:9C
R[13] 149104-150851
pairing: 1
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
mode : sta(5c:cf:7f:97:3f:26)
add if0
system time: 180
s: 0596c71ecb538523521427c3968441c5
b: 94824d3d1c8448f9ad3dcebb4ccf9ca7da4d14901645ea95d164de6c73dd56ed
srp_prepare done: system time: 24549
B: 9b28cc886c8d9182f5b33d9efba0234ef5101c853688f3d0efa08e1fb985941f6c95a26cfaaa274f03647553030fa450d22f6db31891931fd229c4b7164e5bbfa556881605c42d974e61a90b70fcf911baa2421cd96a40650220e925599c0b69c32d5b1d6dfe9fb509c80f44bf78dd3d65712e565c5b26ac8ed3ae3df357313d7f9b1307fc8c53a3dabf4bbe6a3649b5fbbd6644137488813f5154afaddfc4566ee2f3f192d48c8b9da010413cfda0ce6681a6bf95cd523884109e6ecb8a03cfa75519f1c1f14a604b2889c4deb87c4c7dcf586680695e320adcf648045d10287de5d84dab7eda5faef7d434392adf15e3fee6c0040cb372c884fdddcc7954ab81a662ef902ce414bb26ae13d988847876cba03bd39d10e7e1e93e4369ead45ae946a66143c7513510d0527b17d9ae8901af6548d0b957790ea9598dc8d90c6a91bbe44295c25b89fe786c99753c730888c04b74b40789c4fc2887d1ed5652237bb66306139c59486d067d93ddb103d021687f9b3e35eda1ab233283815bee93
ServerInitPriority:1
waiting for task

faronov avatar Oct 22 '17 18:10 faronov

not connecting to network here too

ageorgios avatar Oct 25 '17 17:10 ageorgios

Did you uncomment the function wifi_station_connect? As stated in the documentation:

If wifi_station_set_config is called in user_init, there is no need to call wifi_station_connect after that, ESP8266 will connect to router automatically; otherwise, wifi_station_connect is needed to connect.

andreacucci avatar Oct 25 '17 18:10 andreacucci

void user_init(void)
{
        //use this block only once to set your favorite access point or put your own selection routine
    wifi_set_opmode(STATION_MODE);
    struct station_config *sconfig = (struct station_config *)zalloc(sizeof(struct station_config));
    sprintf(sconfig->ssid, "myssid");       //don't forget to set this if you use it
    sprintf(sconfig->password, "mypassword"); //don't forget to set this if you use it
    wifi_station_set_config(sconfig);
    free(sconfig);
    /*wifi_station_connect(); /**/

    // try to only do the bare minimum here and do the rest in hkc_user_init
    // if not you could easily run out of stack space during pairing-setup

    hkc_init("Sonoff");
}

is this correct?

it doesnt connect

ageorgios avatar Oct 25 '17 18:10 ageorgios

Yes, that should work correctly.

andreacucci avatar Oct 25 '17 18:10 andreacucci

Nope, is not connected Also when I try to erase_flash, and write_flash again It continuously reboots. The same when I try to compile and upload Demo One thing it can be wrong, when I compile toolchain, I didn't take specific revision. Where you get toolchain? And what platform you compile HK.

faronov avatar Oct 26 '17 16:10 faronov