Closed perbu closed 4 years ago
file already closed
seems like a port-already-in-use error. But If you say the console works it does not make much sense. I'm not familiar with the macOS version either.
I would suggest first updating the mos binary to latest or rolling back to release. Use mos update latest
and mos update release
to do that. To see if both fail the same.
You can also make the wifi changes via mos config-set
. This would be a way to set it up: mos config-set wifi.sta.enable=true wifi.sta.ssid=YOUR_SSID wifi.sta.pass=YOURWIFIPASS
That should work.
@DrBomb I've tried both the release mos as well as mos-latest. Same error. I don't have my device with me atm so I can't test config-set, but I've gotten similar errors when I do "mos ls". I'll do some more testing this weekend, perhaps with a different device. I might find some wemos d1 in a drawer somewhere and it'll be an interesting data point.
I agree that this smell like some sort of locking error. The weird thing is that "mos flash" and "mos console!" works every time, so I'm guessing there is some funkyness in the way the serial communication is initialized in parts of the code. Perhaps tied to some RPC mechanism.
Hello I'm experiencing the same problem. I'm able to flash, but configuring the wifi fails almost every time. I found some threads yesterday that the WiFi feature needs greater current to be configured. There are some problematic USB cables that cannot supply that current and the operation fails. I have also one NodeMCU module that worked like a charm but it is 8266 ESP.
My suggestion is to try with different USB cables. Also since you are using a MAC book, make sure it is plugged to the main power supply.
I think the power envelope idea is moot. Flashing works and mos console works - even though the little thing is running an accesspoint. Also the following commands also fail:
mos ls - fails mos get - fails mos rm - fails mos config-get - fails
So basically "mos console and mos flash" work fine but things that I would speculate are using RPC are failing.
You need
- origin: https://github.com/mongoose-os-libs/rpc-service-config
- origin: https://github.com/mongoose-os-libs/rpc-service-fs
- origin: https://github.com/mongoose-os-libs/rpc-uart
- origin: https://github.com/mongoose-os-libs/wifi
for mos config-set
, mos ls
, mos wifi
over serial connection.
@nliviu Of course. That makes perfect sense. Thanks!
I think it might be a good idea to try to detect this and issue a warning when the user tries to do something that requires an RPC endpoint to be present on the mcu and we get these short reads.
Perhaps I can come up with a suggested patch if I can find my way around the codebase.
Cheers.
@perbu, added a warning - https://github.com/mongoose-os/mos/commit/5c1464cb0558ab4a8cb74b7cfa9d849c338fc281
@rojer That is great.
I know I'm now the only one who has struggled with this. I've found 10-20 threads in various forums which have all been without a concrete answer so this will surely be appreciated.
Merry Christmas.
@perbu @rojer Hey Guys, I hope I could use your help with this issue.
I'm following your notes and I'm unable to reproduce (solve the problem)
$ mos wifi "op6" "Bigoper@0!9"
Getting configuration...
E0511 20:05:45.990884 68498 serial.go:273] No response to handshake. Is /dev/cu.wchusbserial14240 the right port? Is rpc-uart enabled?
E0511 20:05:51.197750 68498 serial.go:273] No response to handshake. Is /dev/cu.wchusbserial14240 the right port? Is rpc-uart enabled?
E0511 20:05:56.405037 68498 serial.go:273] No response to handshake. Is /dev/cu.wchusbserial14240 the right port? Is rpc-uart enabled?
Error: write /dev/cu.wchusbserial14240: file already closed
/private/tmp/mos-20200511-56362-y6vyca/mos-18c19395db3292985b1d067c4188efd91eea62d3/go/src/github.com/mongoose-os/mos/common/mgrpc/codec/serial.go:206:
/private/tmp/mos-20200511-56362-y6vyca/mos-18c19395db3292985b1d067c4188efd91eea62d3/go/src/github.com/mongoose-os/mos/common/mgrpc/codec/serial.go:265:
/private/tmp/mos-20200511-56362-y6vyca/mos-18c19395db3292985b1d067c4188efd91eea62d3/go/src/github.com/mongoose-os/mos/common/mgrpc/codec/stream.go:331:
/private/tmp/mos-20200511-56362-y6vyca/mos-18c19395db3292985b1d067c4188efd91eea62d3/go/src/github.com/mongoose-os/mos/common/mgrpc/mgrpc.go:401:
/private/tmp/mos-20200511-56362-y6vyca/mos-18c19395db3292985b1d067c4188efd91eea62d3/go/src/github.com/mongoose-os/mos/cli/dev/dev_conn_impl.go:167:
/private/tmp/mos-20200511-56362-y6vyca/mos-18c19395db3292985b1d067c4188efd91eea62d3/go/src/github.com/mongoose-os/mos/cli/dev/dev_conn_impl.go:190:
/private/tmp/mos-20200511-56362-y6vyca/mos-18c19395db3292985b1d067c4188efd91eea62d3/go/src/github.com/mongoose-os/mos/cli/dev/dev_conn.go:117:
/private/tmp/mos-20200511-56362-y6vyca/mos-18c19395db3292985b1d067c4188efd91eea62d3/go/src/github.com/mongoose-os/mos/cli/config/config.go:86:
/private/tmp/mos-20200511-56362-y6vyca/mos-18c19395db3292985b1d067c4188efd91eea62d3/go/src/github.com/mongoose-os/mos/cli/main.go:197: wifi failed
exit status 1
mos.yml
author: mongoose-os description: A JS-enabled demo Mongoose OS firmware # arch: PLATFORM version: 1.0 manifest_version: 2017-05-18 libs_version: ${mos.version} modules_version: ${mos.version} mongoose_os_version: ${mos.version}
config_schema:
tags:
filesystem:
libs:
init.js
load('api_gpio.js'); // load is a special function in Mongoose OS load('api_timer.js');
load('api_mqtt.js'); load('api_gpio.js');
let pin = 0, topic = 'my/topic';
GPIO.set_button_handler(pin, GPIO.PULL_UP, GPIO.INT_EDGE_NEG, 200, function() { MQTT.pub('my/topic', JSON.stringify({ a: 1, b: 2 })); }, null);
MQTT.sub('my/topic/#', function(conn, topic, msg) { print('Topic:', topic, 'message:', msg); }, null);
/**
// Blink built-in LED every second GPIO.set_mode(led1, GPIO.MODE_OUTPUT); GPIO.set_mode(led4, GPIO.MODE_OUTPUT); Timer.set(100 / 1 sec / , true / repeat / , function() { print("Toggling LED"); let value4 = GPIO.toggle(led4); }, null); Timer.set(500 / 1 sec / , true / repeat / , function() { print("Toggling LED"); let value1 = GPIO.toggle(led1); }, null);
Thanks in advance,
Avi.
Setting GPIO1 > PIN TXD0 as OUTPUT was the root cause.
using a diff PIN resolved that.
Hi.
Host OS: MacOS Catalina 10.15.2 MOS: 2.16.0 (2.16.0~brew) Device: ESP32Dev (TTGO wrover32 with a CP2104)
Start out with a blank directory. Copy a minimal mos.yml:
Build an image:
Flash the image:
Then I try to set the wifi credentials:
I've tried three different cabels, tried rebooting, two different USB-C bridges.
The console works with screen:
Verbose logs:
I've tried googling and all I can think of.