Data is not being received on UART 0 RX after WiFi connects. It works before WiFi connection. It also works all the time if wrong WiFi credentials are put into the config. I saw the issue on version 1.1.15 and is still there in version 1.1.17.
Trying to receive data on UART 0 RX and transmit via MQTT.
Tried to use https://github.com/mongoose-os-apps/aws-uart as a sample to test the issue and it still did not work.
Only works when I remove the WiFi credentials from mos.yml or put in wrong credentials. When the correct credentials are there, data is received on UART 0 RX only till WiFi gets connected and then stops receiving data.
Not attaching logs since its just the app without any changes. Let me know if you need it.
Please DO read the rules about asking questions. The way you asked, it is nearly impossible to give a constructive answer.
I cloned the https://github.com/mongoose-os-apps/aws-uart app and built it locally. Since the wifi credentials were there in mos.yml in the app I left it there.
Line 124 of init.js prints out the data received on RX of UART 0
print("Received UART data:", data);
All I am doing is sending data and seeing if it prints it out. It stops printing what is sent after the WiFi is connected. It continues to work if I remove the WiFi credentials.
I have also tested the same with my application code and see the same behavior.
@bravokeyl it is your app - do you have any input on the above?
Note - the way you have your mos.yml is wrong, please don't include certs and other user-level config params there.
See example here https://github.com/mongoose-os-apps/losant-mqtt - they have no credentials in the mos.yml.
Basically, delete the config section from your mos.yml .
@ngdev I will be updating the aws-uart app with more docs as how to build & flash asap, please check it out then. Meanwhile what you can do is to plcae UART.setDispatcher in MQTT.setEventHandler after connection acknowledgement, then remove the UART connections, flash the app. Setup wifi and AWS IoT once you have done that. You can re-connect the UART pins.
@ngdev please checkout the new code now.
I have tested it again and it does not work. Same behavior as I initially described.
I used https://github.com/mongoose-os-apps/example-uart-js as the base app in which the UART 0 works correctly using ESP8266.
These are the changes I made
* Added wifi library to mos.yml
* Added conf file with wifi settings in fs folder
* Changed UART from 1 to 0 in init.js
I have attached the code, firmware and the logs. This is the behavior I see
* The UART stops receiving data after wifi connects. In uart_wifi.log you can see "Received UART data: 12345\x0a" till the wifi connects. After which nothing happens even though I kept sending "12345"
* The UART works normally when no wifi connection. In uart_no_wifi.log you can see what happens when I changed the conf to have the wrong wifi password.
If you change the wifi credentials in conf1.json and build the code, you should be able to reproduce the issue.
TDLR - UART 0 RX on ESP8266 stops working after wifi connection is established.
@ngdev Can you try the aws-uart app also please?
@Sterling works as expected adding ["rpc.uart.uart_no", -1] to config_schema
@bravokeyl aws-uart app also works now
So what exactly does this mean? Should I add ["rpc.uart.uart_no", -1] to config_schema in every app that I want to use the UART?
aws-uart app works without adding ["rpc.uart.uart_no", -1] to config_schema. Is it because of the libs that are included?
@ngdev I think there was a comment in some of this forum's topics. Something about UART0 being the default UART RPC so by adding -1 in config_schema you disable UART RPC. Developers should know better about this issue
@Sergey so to use the local UART the RPC UART must be disabled? I could not find any reference to this in the forum/docs.
@Sergey still waiting for this