armmbed / easy-connect Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED: Easily add all supported connectivity methods to your mbed OS project
DEPRECATED: Easily add all supported connectivity methods to your mbed OS project
The current COAP server addresses only cover old "Connector", i.e. connect.mbed.com.
#ifndef MESH
// This is address to mbed Device Connector
#define MBED_SERVER_ADDRESS "coap://api.connector.mbed.com:5684"
#else
// This is address to mbed Device Connector
#define MBED_SERVER_ADDRESS "coaps://[2607:f0d0:2601:52::20]:5684"
These addresses do not match the Cloud servers, so we should instead offer either a configurability item to choose to which one to connect or simply remove it completely here.
I use easy-connect with MQTT example on mbed online compiler and I received this when I tried using my ESP8266 module
"Error: Cannot open source input file "ATCmdParser.h": No such file or directory in "easy-connect/esp8266-driver/ESP8266/ESP8266.h", Line: 20, Col: 26"
Anyone knows how to fix this? Thank you
When the library is imported in online compiler the contained .lib files are seen by the build system as modified even if left untouched (probably they contains some "strange" characters).
We shouldn't return SUCCESS, if we do not get an IP address (and MAC).
const char *ip_addr = network_handler->get_ip_address();
const char *mac_addr = network_handler->get_mac_address();
if (ip_addr && mac_addr) {
pc.printf("IP address %s\r\n", ip_addr);
pc.printf("MAC address %s\r\n", mac_addr);
} else {
pc.printf("[main] No IP/MAC address\r\n");
return NULL;
}
I was looking into easy-connect sometime ago when reviewing its integration with one of our sample applications (tls-client). At some point I ran into the compiler "multiple definition for..." problem, just like in this already closed ticket. After a brief look at the code in easy-connect.h it seems the problem is that all the functions/objects are defined in the header.
In practice, this is not a huge problem as one just has to be careful to include easy-connect.h and then include other headers such as TCPSocket or NetworkInterface wherever needed. However, I just wanted to ask why is everything in the header instead of splitting it into .h and .c (or .cpp) files?
The current revision of wnc14a2a-driver used in this project causes pin conflicts even when the wnc14a2a is not used. Here's related issue:
Avnet/wnc14a2a-driver#6
Please apply the latest revision.
while trying to compile Odin W2 Module that does not use any of the drivers inside this repository I have encountered compilation error from the drivers (that are not needed).
the driver files should not compile if not requested.
workaround: delete the drivers folders
Hello,
mbed-os-example-client sha1 e32227d6ba0
$ build_all.sh
Compiling with GCC_ARM
Ethernet v4
cp: cannot stat 'configs/eth-wifi-mbedignore': No such file or directory
And later also
cp: cannot stat 'configs/mesh-mbedignore': No such file or directory
This line should be removed from the build_all.sh file
index ca7e7e8..ee5ac07 100755
--- a/build_all.sh
+++ b/build_all.sh
@@ -6,7 +6,6 @@ TOOL=GCC_ARM
echo Compiling with $TOOL
echo Ethernet v4
cp configs/eth_v4.json ./mbed_app.json
-cp configs/eth-wifi-mbedignore ./.mbedignore
BOARD=K64F
mbed compile -m $BOARD -t $TOOL
cp BUILD/$BOARD/$TOOL/mbed-os-example-client.bin $BOARD-$TOOL-eth-v4.bin
@@ -22,7 +21,6 @@ cp ./BUILD/$BOARD/$TOOL/mbed-os-example-client.bin $BOARD-$TOOL-eth-v4.bin
echo Ethernet v6
cp configs/eth_v6.json ./mbed_app.json
-cp configs/eth-wifi-mbedignore ./.mbedignore
BOARD=K64F
mbed compile -m $BOARD -t $TOOL
@@ -39,7 +37,6 @@ cp ./BUILD/$BOARD/$TOOL/mbed-os-example-client.bin $BOARD-$TOOL-eth-v6.bin
echo WIFI - ESP8266
cp configs/wifi_esp8266_v4.json ./mbed_app.json
-cp configs/eth-wifi-mbedignore ./.mbedignore
BOARD=K64F
mbed compile -m $BOARD -t $TOOL
cp BUILD/$BOARD/$TOOL/mbed-os-example-client.bin $BOARD-$TOOL-esp-wifi-v4.bin
@@ -50,11 +47,20 @@ cp ./BUILD/$BOARD/$TOOL/mbed-os-example-client.bin $BOARD-$TOOL-esp-wifi-v4.bin
echo WIFI - ODIN for UBLOX_EVK_ODIN_W2
cp configs/wifi_odin_v4.json ./mbed_app.json
-cp configs/eth-wifi-mbedignore ./.mbedignore
BOARD=UBLOX_EVK_ODIN_W2
@@ -86,7 +92,6 @@ cp ./BUILD/$BOARD/$TOOL/mbed-os-example-client.bin $BOARD-$TOOL-Thread.bin
echo WiFi-X-Nucleo
cp configs/wifi_idw01m1_v4.json mbed_app.json
-cp configs/eth-wifi-mbedignore ./.mbedignore
BOARD=NUCLEO_F401RE
mbed compile -m $BOARD -t $TOOL
cp ./BUILD/$BOARD/$TOOL/mbed-os-example-client.bin $BOARD-$TOOL-WifiXNucleo.bin
Error: Class "mbed::ATCmdParser" has no member "process_oob" in "easy-connect/esp8266-driver/ESP8266/ESP8266.cpp", Line: 278, Col: 23
Seems the actual mbedOS "WiFi" stack for UBLOX ODIN is not supported yet, should it be added?
Target:
K66F
Toolchain:
GCC_ARM
Toolchain version:
$ ${HOME}/opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437]
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
mbed-cli version:
1.2.0
mbed-os sha:
easy-connect (f2912a4)
mbed-os-example-tls (89c8bf82cbd7d5356c8de6029a27422ce7842704)
mbed-os (da9464d103057f63064e49df258c1e5ca901c07c)
Expected behavior:
The program compiles and flashes successfully.
Actual behavior:
The program does not compile successfully.
~/Repos/oob/mbed-os-example-tls/tls-client $ mbed compile -t GCC_ARM -m K66F -f
Building project tls-client (K66F, GCC_ARM)
Scan: .
Scan: mbed
Scan: env
Scan: FEATURE_COMMON_PAL
Scan: FEATURE_LWIP
Compile [100.0%]: main.cpp
[Fatal Error] easy-connect.h@16,30: ESP8266Interface.h: No such file or directory
[ERROR] In file included from ./main.cpp:36:0:
./easy-connect/easy-connect.h:16:30: fatal error: ESP8266Interface.h: No such file or directory
#include "ESP8266Interface.h"
^
compilation terminated.
[mbed] ERROR: "/usr/local/opt/python/bin/python2.7" returned error code 1.
[mbed] ERROR: Command "/usr/local/opt/python/bin/python2.7 -u /Users/jenplu01/Repos/oob/mbed-os-example-tls/tls-client/mbed-os/tools/make.py -t GCC_ARM -m K66F --source . --build ./BUILD/K66F/GCC_ARM" in "/Users/jenplu01/Repos/oob/mbed-os-example-tls/tls-client"
---
Steps to reproduce:
$ git clone https://github.com/ARMmbed/mbed-os-example-tls
$ cd mbed-os-example-tls
$ git checkout mbed-os-5.7.0-oob
$ cd tls-client
$ mbed deploy
$ cd easy-connect
$ mbed update master
$ cd ..
// Update wifi credentials in mbed_app.json and change network-interface to WIFI_ESP8266
$ mbed compile -t GCC_ARM -m K66F -f
In order to resolve and compile successfully, in the root ./tls-client
example folder I have to run mbed add esp8266-driver
then I am able to flash the program onto the board.
I have developed a new Network Interface for the WNC M14A2A that I would like to contribute to the easy-connect repository. Wondering who the contact is I could discuss this with.
Should we use WIFI TX/RX instead?
#ifdef MBED_CONF_APP_ESP8266_DEBUG
ESP8266Interface wifi(MBED_CONF_APP_WIFI_TX, MBED_CONF_APP_WIFI_RX, MBED_CONF_APP_ESP8266_DEBUG);
#else
ESP8266Interface wifi(MBED_CONF_APP_WIFI_TX, MBED_CONF_APP_WIFI_RX);
#endif
Hello,
When following the https://docs.mbed.com/docs/building-an-internet-connected-lighting-system/en/latest/4_connectivity/ I am getting the following error when trying to connect via wi-fi.
[EasyConnect] Using WiFi (ESP8266)
[EasyConnect] Connecting to WiFi..
AT> AT+RST
AT> AT+RST
[EasyConnect] Connection to Network Failed -3011!
Connect to internet failed... See serial output.
The esp-8266 is updated to Espressif firmware by following https://developer.mbed.org/teams/ESP8266/wiki/Firmware-Update
Any help would be appreciated.
Thank you.
Are there any plans to write some documentation (or to simply add a a section in README file) to explain the different codes when the connection fails?
I had a very hard time finding out what the 3010 code meant due a connection failure...
We seem to be struggling sometimes with network issues that might be MAC related.
Should we actually print out the MAC as early as possible to make it visible and then only later on print the IP-address we get (if we get it)?
Hi,
I don't know if my error is directly connected to easy-connect library but I decided to give it a shot.
I have a class called RTCx where I include easy-connect.h
and a file called main.cpp in which I include my class definition.
The problem is that I am receiving linker errors:
Link: stm32l476_ucam_mbed
./BUILD/NUCLEO_L476RG/GCC_ARM/./rtcx.o: In function `easy_connect(bool)':
rtcx.cpp:(.text._Z12easy_connectb+0x0): multiple definition of `easy_connect(bool)'
./BUILD/NUCLEO_L476RG/GCC_ARM/./main.o:main.cpp:(.text._Z12easy_connectb+0x0): first defined here
./BUILD/NUCLEO_L476RG/GCC_ARM/./rtcx.o:(.bss.wifi+0x0): multiple definition of `wifi'
./BUILD/NUCLEO_L476RG/GCC_ARM/./main.o:(.bss.wifi+0x0): first defined here
collect2: error: ld returned 1 exit status
[ERROR] ./BUILD/NUCLEO_L476RG/GCC_ARM/./rtcx.o: In function `easy_connect(bool)':
rtcx.cpp:(.text._Z12easy_connectb+0x0): multiple definition of `easy_connect(bool)'
./BUILD/NUCLEO_L476RG/GCC_ARM/./main.o:main.cpp:(.text._Z12easy_connectb+0x0): first defined here
./BUILD/NUCLEO_L476RG/GCC_ARM/./rtcx.o:(.bss.wifi+0x0): multiple definition of `wifi'
./BUILD/NUCLEO_L476RG/GCC_ARM/./main.o:(.bss.wifi+0x0): first defined here
collect2: error: ld returned 1 exit status
RTCx.h
#ifndef RTCX_H
#define RTCX_H
#include "mbed.h"
#include "ds3231.h"
#include "string"
#include "easy-connect.h"
#include "Json.h"
#include "TCPSocket.h"
#include "http_request.h"
#if defined (CLION)
#include "mbed_config.h"
#endif
class RTCx {
public:
RTCx(PinName sda, PinName scl);
time_t get_timestamp();
private:
Ds3231 _rtc;
long _timestamp;
string _api_timezone;
string _api_key;
string _api_request_path;
long _get_timestamp_from_api();
};
#endif //RTCX_H
RTCx.cpp
#include "rtcx.h"
RTCx::RTCx(PinName sda, PinName scl) : _rtc(sda, scl) {
printf("\n\r-- Initializing DS3231 --");
_api_key = MBED_CONF_APP_TIMEZONEDB_KEY;
_api_request_path = MBED_CONF_APP_TIMEZONEDB_TIME_PATH;
_api_timezone = MBED_CONF_APP_TIMEZONEDB_ZONE;
printf("\n\rReading DS3231 Status Register: ");
ds3231_cntl_stat_t status = {0x0F, 0};
if (!_rtc.get_cntl_stat_reg(&status)) {
printf("OK");
printf("\n\rStatus: 0x%02X", status.status >> 7);
} else {
printf("ERROR");
}
printf("\n\rInitialization finished!");
}
time_t RTCx::get_timestamp() {
return _rtc.get_epoch();
}
long RTCx::_get_timestamp_from_api() {
NetworkInterface *network = easy_connect(true);
if (!network) {
printf("\n\rCannot connect to the network, see serial output");
return -1;
}
return -1;
}
main.h
#ifndef MAIN_H
#define MAIN_H
#include "mbed.h"
#include "rtcx.h"
#endif //MAIN_H
main.cpp
#include "main.h"
RTCx rtc(I2C_SDA, I2C_SCL);
int main()
{
Timer timer;
timer.start();
printf("\n\rtest");
return 0;
}
Everything works if I am using only main.cpp file with easy-connect (and all logic around it) without my class.
If I am wrong and the problem is not connected to easy-connect library then feel free to close this issue.
I believe the network driver hashes are behind, at least mbed-os-example-client was pointing like this:
[mbed] Updating library "atmel-rf-driver" to rev #57f22763f4d3
[mbed] Updating library "esp8266-driver" to rev #86ed47c8bf40
while you have
mbed] Adding library "easy-connect/atmel-rf-driver" from "ssh://[email protected]/ARMmbed/atmel-rf-driver.git" at rev #62c0c49d7a94
[mbed] Adding library "easy-connect/esp8266-driver" from "ssh://[email protected]/ARMmbed/esp8266-driver.git" at rev #86ed47c8bf40
[mbed] Adding library "easy-connect/mcr20a-rf-driver" from "ssh://[email protected]/ARMmbed/mcr20a-rf-driver.git" at rev #d8810e105d7d
We should ensure these stay up-to-date with the masters, especially the atmel driver had some critical fixes.
Newer (57f2276) Atmel RF driver
12 commits up ahead in the master branch, short log below
57f2276 Kevin Bracey - Merge pull request #50 from ARMmbed/echo_fix
d314a4c Kevin Bracey - Stop using deprecated mbed API
3fe3383 Kevin Bracey - Disable power saving
aeaf4cc Kevin Bracey - Attempt to tighten CCA logic
059ca03 Kevin Bracey - Tidy register bit manipulation
2d00da1 Kevin Bracey - Avoid pointless floating-point
0ae1c32 Kevin Bracey - Don't load frame buffer until CCA start
c950aae Kevin Bracey - Move lock on transmit API
51a3857 Kevin Bracey - Avoid sending multiple TX_DONE callbacks
10b0300 Kevin Bracey - Correct transmit callback retries reports
fb6360d Kevin Bracey - Feed randomness into randLIB directly
I think it would be very useful to add a modem debug flag to allow configuration (in mbed_app.json
) of cellular debug trace, especially during error hunting or development phase.
I propose a documented entry in mbed_app.json
"modem_debug_on": {
"help": "Value: Turns modem debug traces on. Options are true | false.",
"macro_name": "MODEM_DEBUG_ON",
"value": true
},
And a section in the easy_connect
function. I personally think this should be inside the first if (log_messages) {
so that messages have to be enabled in the easy_connect
call and MODEM_DEBUG_ON
is true.
#if (MODEM_DEBUG_ON)
cellular.modem_debug_on(true);
#endif
Let me know what you think and I'll create a pull-request for it.
At the moment we are configuring network settings like this:
"config": {
"network-interface":{
"help": "Options are ETHERNET, WIFI_ESP8266, WIFI_ODIN",
"value": ""
},
"wifi-ssid": {
"help": "WiFi SSID",
"value": "\"\""
},
"wifi-password": {
"help": "WiFi Password",
"value": "\"\""
}
}
Which gets turned into MBED_CONF_APP_NETWORK_INTERFACE etc.
However, if we defined a namespace in mbed_lib.json (similar to how it is done in the sd-driver https://github.com/ARMmbed/sd-driver/blob/master/config/mbed_lib.json#L2) then defines would look like this instead: MBED_CONF_EASY_CONNECT_NETWORK_INTERFACE.
The benefit of doing it this way is that users can now use the target_overrides
feature to support multiple boards in a single mbed_app.json, for example:
"target_overrides": {
"*": {
"easy-connect.network-ssid": "",
"easy-connect.network-password": ""
},
"K64F": {
"easy-connect.network-interface": "ETHERNET"
},
"NUCLEO_F429ZI": {
"easy-connect.network-interface": "ETHERNET"
},
"UBLOX_EVK_ODIN_W2": {
"easy-connect.network-interface": "WIFI_ODIN"
}
},
Is there a reason for not doing the latter, and would there be any objections if I submit a backwards compatible PR that enables overrides?
Shouldn't header files like "ESP8266Interface.h", "OdinWiFiInterface.h" and so on be included in git repository?
Is there any functions that I can call to enable auto reconnect after the internet is lost? I haven't seen any function reconnecting.
Thank you
we shouldn't define the serial in easyconnect, instead we should take it in as a parameter via the init() call.
Compile [ 3.7%]: main.cpp
[Warning] arch.h@88,15: C++11 requires a space between string literal and macro [-Wc++11-compat]
[Error] main.cpp@28,18: conflicting declaration 'mbed::RawSerial output'
[Warning] main.cpp@162,57: 'osStatus rtos::Thread::start(T*, M) [with T = LedResource; M = void (LedResource::*)()]' is deprecated: The start function does not support cv-qualifiers. Replaced by thread.start(callback(obj, method)). [since mbed-os-5.1] [-Wdeprecated-declarations]
[ERROR] In file included from ./mbed-os/features/FEATURE_LWIP/lwip-interface/lwip/src/include/lwip/debug.h:40:0,
from ./mbed-os/features/FEATURE_LWIP/lwip-interface/lwip/src/include/lwip/opt.h:52,
from ./mbed-os/features/FEATURE_LWIP/lwip-interface/lwip/src/include/lwip/netif.h:40,
from ./mbed-os/features/FEATURE_LWIP/lwip-interface/EthernetInterface.h:22,
from ./easy-connect/easy-connect.h:27,
from ./main.cpp:26:
./mbed-os/features/FEATURE_LWIP/lwip-interface/lwip/src/include/lwip/arch.h:88:15: warning: C++11 requires a space between string literal and macro [-Wc++11-compat]
#define X8_F "02"PRIx8
^
./main.cpp:28:18: error: conflicting declaration 'mbed::RawSerial output'
RawSerial output(USBTX, USBRX);
^~~~~
In file included from ./main.cpp:26:0:
./easy-connect/easy-connect.h:6:8: note: previous declaration as 'mbed::Serial output'
Serial output(USBTX, USBRX);
As we get this...
Should one init the RF PHY 1st before connecting?
#ifdef MESH
output.printf("\n\rConnecting to Mesh...\r\n");
mesh.initialize(&rf_phy);
connect_success = mesh.connect();
network_interface = &mesh;
#endif
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.