Skip to content

Commit fca40be

Browse files
committed
Anjay-esp32-client 22.08
- Updated Anjay to version 3.1.1 - Added CHANGELOG.md file - Added information about updating submodule to README.md step - Integrated with FreeRTOS Cellular Interface - Fixed display configuration in m5stick-plus.bin binary file
1 parent 279194c commit fca40be

21 files changed

+956
-94
lines changed

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
[submodule "main/anjay"]
22
path = main/anjay
33
url = https://github.com/AVSystem/Anjay.git
4+
[submodule "main/FreeRTOS-Cellular-Library"]
5+
path = main/FreeRTOS-Cellular-Interface
6+
url = https://github.com/AVSystem/FreeRTOS-Cellular-Interface
7+
branch = esp32-client-v1.2.0

CHANGELOG.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Changelog
2+
3+
## 22.08 (August 12th, 2022)
4+
5+
### Features
6+
7+
- Updated Anjay to version 3.1.1
8+
- Added CHANGELOG.md file
9+
- Added support for BG96
10+
- Integrated with FreeRTOS Cellular Interface
11+
12+
### Bugfixes
13+
14+
- Fixed display configuration in m5stick-plus.bin binary file
15+
16+
## 22.06 (June 27th, 2022)
17+
18+
### Features
19+
20+
- Updated Anjay to version 3.0.0
21+
- Added support for certificates and TCP socket
22+
- Added non-secure connection option
23+
- Added support for Send operation
24+
25+
## 22.04.1 (April 28th, 2022)
26+
27+
### Bugfixes
28+
29+
- Fix configuration issue regarded to improper include order.
30+
31+
## 22.04 (April 13th, 2022)
32+
33+
### Features
34+
35+
- added support for FOTA
36+
- added support for changing Wi-Fi configuration while the device is
37+
running
38+
- added NVS for Anjay and Wi-Fi configuration
39+
40+
### Improvements
41+
42+
- all required configuration can be set from anjay-esp32-client component
43+
config
44+
- updated ESP-IDF and Anjay
45+
46+
## 22.01.1 (January 26th, 2022)
47+
48+
### Bugfixes
49+
50+
- Fixed configuration in avs_commons_config.h
51+
52+
## 22.01 (January 21st, 2022)
53+
54+
### Features
55+
56+
- added support for M5StickC-Plus hardware
57+
- added generic sensors objects handling code
58+
59+
### Improvements
60+
61+
- anjay handling WiFi connection loss
62+
63+
## 21.10 (October 4th, 2021)
64+
65+
### Features
66+
67+
- Initial release of Anjay-esp32-client

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ if(CONFIG_PARTITION_TABLE_CUSTOM)
2727
spiffs_create_partition_image(storage graphics FLASH_IN_PROJECT)
2828
endif()
2929
endif()
30-

Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@
2020
PROJECT_NAME := anjay-esp32-client
2121

2222
include $(IDF_PATH)/make/project.mk
23-

README.md

+19-9
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,22 @@ The following LwM2M Objects are supported:
2020
## Compiling and launching
2121
1. Install ESP-IDF and its dependencies on your computer. Please follow the instructions at https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/get-started/index.html up to and including the point where you call `. $HOME/esp/esp-idf/export.sh`
2222
* The project has been tested with ESP-IDF v4.4, but may work with other versions as well.
23-
2. Run `idf.py set-target esp32` in the project directory
24-
3. Run `idf.py menuconfig`
23+
1. Clone the repository `git clone https://github.com/AVSystem/Anjay-esp32-client.git` and navigate to project directory
24+
1. Initialize and update submodules with `git submodule update --init --recursive`
25+
1. Run `idf.py set-target esp32` in the project directory
26+
1. Run `idf.py menuconfig`
2527
* navigate to `Component config/anjay-esp32-client`:
2628
* select one of supported boards or manually configure the board in `Board options` menu
2729
* configure Anjay in `Client options` menu
2830
* configure WiFi in `Connection configuration` menu
29-
4. Run `idf.py build` to compile
30-
5. Run `idf.py flash` to flash
31+
1. Run `idf.py build` to compile
32+
1. Run `idf.py flash` to flash
3133
* NOTE: M5StickC-Plus does not support default baudrate, run `idf.py -b 750000 flash` to flash it
32-
6. The logs will be on the same `/dev/ttyUSB<n>` port that the above used for flashing, 115200 8N1
34+
1. The logs will be on the same `/dev/ttyUSB<n>` port that the above used for flashing, 115200 8N1
3335
* You can use `idf.py monitor` to see logs on serial output from a connected device, or even more conveniently `idf.py flash monitor` as one command to see logs right after the device is flashed
3436

3537
## Connecting to the LwM2M Server
36-
To connect to [Coiote IoT Device Management](https://www.avsystem.com/products/coiote-iot-device-management-platform/) LwM2M Server, please register at [https://www.avsystem.com/try-anjay/](https://www.avsystem.com/try-anjay/). The default Server URI (Kconfig option `ANJAY_CLIENT_SERVER_URI`) is set to try-anjay server, but you must manually set other client configuration options.
38+
To connect to [Coiote IoT Device Management](https://www.avsystem.com/products/coiote-iot-device-management-platform/) LwM2M Server, please register at [https://eu.iot.avsystem.cloud/](https://eu.iot.avsystem.cloud/). The default Server URI (Kconfig option `ANJAY_CLIENT_SERVER_URI`) is set to EU Cloud Coiote DM instance, but you must manually set other client configuration options.
3739

3840
NOTE: You may use any LwM2M Server compliant with LwM2M 1.0 TS. The server URI
3941
can be changed in the example configuration options.
@@ -44,7 +46,7 @@ To do that, `esptool.py` is required, which can be installed running `pip instal
4446

4547
### Creating a merged binary for M5StickC-Plus
4648
```
47-
esptool.py --chip esp32 merge_bin --flash_mode dio --flash_size 4MB --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/anjay-esp32-client.bin 0x210000 build/storage.bin --output m5stickc-plus.bin
49+
esptool.py --chip esp32 merge_bin --flash_mode dio --flash_size 4MB --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/anjay-esp32-client.bin 0x310000 build/storage.bin --output m5stickc-plus.bin
4850
```
4951
### NVS config file
5052
To generate NVS partition, create a `nvs_config.csv` file with following content:
@@ -76,21 +78,29 @@ esptool.py -b 750000 --chip esp32 write_flash 0x9000 nvs_config.bin
7678
```
7779
Device will be reset and run with provided configuration.
7880
### TCP socket
79-
To switch to TCP socket instead of UDP run `idf.py menuconfig`, navigate to `Component config/anjay-esp32-client/Client options/Choose socket` and select TCP (remember that you must also provide a proper URI in the `nvs_config.csv` file, e.g. `coaps+tcp://try-anjay.avsystem.com:5684`). NOTE: Coiote DM currently only supports the Certificate mode when using TCP and TLS.
81+
To switch to TCP socket instead of UDP run `idf.py menuconfig`, navigate to `Component config/anjay-esp32-client/Client options/Choose socket` and select TCP (remember that you must also provide a proper URI in the `nvs_config.csv` file, e.g. `coaps+tcp://eu.iot.avsystem.cloud:5684`).
8082
### ESP32 with certificates
8183
1. Prepare your certificates. All certificates should have a `.der` extension and should be added to the directory where this `README.md` file is located. The names of the certificates should be as follows:
8284
* client public certificate - `client_cert.der`
8385
* client private certificate - `client_key.der`
8486
* server public certificate - `server_cert.der`
85-
2. Run `idf.py menuconfig`, navigate to `Component config/anjay-esp32-client/Client options/Choose security mode` and select `Certificates`.
87+
1. Run `idf.py menuconfig`, navigate to `Component config/anjay-esp32-client/Client options/Choose security mode` and select `Certificates`.
8688
### FOTA
8789
After compilation, you can perform FOTA with Coiote DM. Required binary file location:
8890
```
8991
$PROJECT_DIR/build/anjay-esp32-client/build/anjay-esp32-client.bin
9092
```
93+
### ESP32 with BG96 and FreeRTOS cellular library
94+
1. Prepare your BG96 module, connect it to the selected ESP32 UART interface.
95+
1. Run `idf.py menuconfig`
96+
* navigate to `Component config/anjay-esp32-client`:
97+
* select `External BG96 module` in `Choose an interface` menu
98+
* configure BG96 in `BG96 module configuration` menu
99+
* configure PDN in `Connection configuration` menu
91100
## Links
92101
* [Anjay source repository](https://github.com/AVSystem/Anjay)
93102
* [Anjay documentation](https://avsystem.github.io/Anjay-doc/index.html)
94103
* [Doxygen-generated API documentation](https://avsystem.github.io/Anjay-doc/api/index.html)
95104
* [AVSystem IoT Devzone](https://iotdevzone.avsystem.com/)
96105
* [AVSystem Discord server](https://discord.avsystem.com)
106+
* [FreeRTOS cellular library](https://www.freertos.org/cellular/index.html)

main/CMakeLists.txt

+51-15
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,40 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
set(sources
16+
"main.c"
17+
"connect.c"
18+
"utils.c"
19+
"objects/device.c"
20+
"objects/light_control.c"
21+
"objects/push_button.c"
22+
"objects/mpu6886.c"
23+
"objects/sensors.c"
24+
"st7789.c"
25+
"fontx.c"
26+
"lcd.c"
27+
"axp192.c"
28+
"i2c_wrapper.c"
29+
"firmware_update.c")
30+
1531
if (CONFIG_ANJAY_SECURITY_MODE_CERTIFICATES)
1632
set(Embedded_cert "../server_cert.der" "../client_cert.der" "../client_key.der")
1733
else()
1834
set(Embedded_cert "")
1935
endif()
2036

21-
idf_component_register(SRCS "main.c"
22-
"connect.c"
23-
"utils.c"
24-
"objects/device.c"
25-
"objects/light_control.c"
26-
"objects/push_button.c"
27-
"objects/mpu6886.c"
28-
"objects/sensors.c"
29-
"objects/wlan.c"
30-
"st7789.c"
31-
"fontx.c"
32-
"lcd.c"
33-
"axp192.c"
34-
"i2c_wrapper.c"
35-
"firmware_update.c"
37+
if (CONFIG_ANJAY_CLIENT_INTERFACE_BG96_MODULE)
38+
list(APPEND sources
39+
"cellular_anjay_impl/net_impl.c"
40+
"cellular_anjay_impl/cellular_event_loop.c")
41+
endif()
42+
43+
if (CONFIG_ANJAY_CLIENT_INTERFACE_ONBOARD_WIFI)
44+
list(APPEND sources
45+
"objects/wlan.c")
46+
endif()
47+
48+
idf_component_register(SRCS ${sources}
3649
INCLUDE_DIRS "."
3750
EMBED_FILES ${Embedded_cert})
3851

@@ -61,6 +74,25 @@ target_link_libraries(anjay PRIVATE idf::mbedtls)
6174
# We disable assertions within anjay to work around that.
6275
target_compile_definitions(anjay PRIVATE NDEBUG)
6376

77+
if (CONFIG_ANJAY_CLIENT_INTERFACE_BG96_MODULE)
78+
file(GLOB_RECURSE FREERTOS_CELLULAR_LIBRARY_SOURCES
79+
"FreeRTOS-Cellular-Interface/source/*.c"
80+
"FreeRTOS-Cellular-Interface/modules/bg96/*.c"
81+
"FreeRTOS-Cellular-Interface/modules/cellular_platform.c")
82+
83+
add_library(freertos_cellular_library MODULE ${FREERTOS_CELLULAR_LIBRARY_SOURCES})
84+
target_include_directories(freertos_cellular_library PRIVATE
85+
"FreeRTOS-Cellular-Interface/source/include/private"
86+
"FreeRTOS-Cellular-Interface/modules/bg96")
87+
target_include_directories(freertos_cellular_library PUBLIC
88+
"FreeRTOS-Cellular-Interface/source/include"
89+
"FreeRTOS-Cellular-Interface/source/include/common"
90+
"FreeRTOS-Cellular-Interface/source/logging"
91+
"FreeRTOS-Cellular-Interface/source/cellular_network_transport"
92+
"FreeRTOS-Cellular-Interface/source/interface"
93+
"FreeRTOS-Cellular-Interface/modules")
94+
target_link_libraries(freertos_cellular_library PRIVATE anjay)
95+
endif()
6496

6597
add_custom_target( configure_git_version
6698
COMMAND ${CMAKE_COMMAND}
@@ -71,4 +103,8 @@ add_custom_target( configure_git_version
71103
)
72104

73105
add_dependencies(${COMPONENT_LIB} configure_git_version)
106+
74107
target_link_libraries(${COMPONENT_LIB} PRIVATE anjay)
108+
if (CONFIG_ANJAY_CLIENT_INTERFACE_BG96_MODULE)
109+
target_link_libraries(${COMPONENT_LIB} PRIVATE freertos_cellular_library)
110+
endif()

main/FreeRTOS-Cellular-Interface

main/Kconfig

+90-23
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,50 @@ menu "anjay-esp32-client"
137137
endmenu
138138
endmenu
139139

140+
choice ANJAY_CLIENT_INTERFACE
141+
prompt "Choose an interface"
142+
default ANJAY_CLIENT_INTERFACE_ONBOARD_WIFI
143+
144+
config ANJAY_CLIENT_INTERFACE_ONBOARD_WIFI
145+
bool "Onboard WiFi"
146+
147+
config ANJAY_CLIENT_INTERFACE_BG96_MODULE
148+
bool "External BG96 module"
149+
endchoice
150+
151+
config ANJAY_CLIENT_CELLULAR_EVENT_LOOP
152+
bool
153+
default y if ANJAY_CLIENT_INTERFACE_BG96_MODULE
154+
default n
155+
156+
if ANJAY_CLIENT_INTERFACE_BG96_MODULE
157+
menu "BG96 module configuration"
158+
159+
config ANJAY_BG96_UART_PORT_NUMBER
160+
int "UART port number"
161+
default 0
162+
163+
config ANJAY_BG96_TX_PIN
164+
int "UART Tx pin"
165+
default 0
166+
167+
config ANJAY_BG96_RX_PIN
168+
int "UART Rx pin"
169+
default 0
170+
endmenu
171+
endif
172+
140173
menu "Client options"
141174
config ANJAY_CLIENT_ENDPOINT_NAME
142175
string "Endpoint name"
143176
default "anjay-esp32-client"
144177

145178
config ANJAY_CLIENT_SERVER_URI
146179
string "Server URI"
147-
default "coaps://try-anjay.avsystem.com:5684"
180+
default "coaps://eu.iot.avsystem.cloud:5684"
148181

149182
choice ANJAY_CLIENT_SOCKET
150-
prompt "Choose socket"
183+
prompt "Choose socket"
151184
default ANJAY_CLIENT_SOCKET_UDP
152185

153186
config ANJAY_CLIENT_SOCKET_UDP
@@ -185,35 +218,69 @@ menu "anjay-esp32-client"
185218
endmenu
186219

187220
menu "Connection configuration"
188-
config ANJAY_WIFI_SSID
189-
string "WiFi SSID"
190-
default "myssid"
221+
if ANJAY_CLIENT_INTERFACE_ONBOARD_WIFI
222+
config ANJAY_WIFI_SSID
223+
string "WiFi SSID"
224+
default "myssid"
225+
226+
config ANJAY_WIFI_PASSWORD
227+
string "WiFi Password"
228+
default "mypassword"
229+
230+
config ANJAY_WIFI_CONNECT_IPV6
231+
bool "Obtain IPv6 address"
232+
default y
233+
234+
if ANJAY_WIFI_CONNECT_IPV6
235+
choice ANJAY_WIFI_CONNECT_IPV6_PREF
236+
prompt "Preferred IPv6 Type"
237+
default ANJAY_WIFI_CONNECT_IPV6_PREF_LOCAL_LINK
238+
239+
config ANJAY_WIFI_CONNECT_IPV6_PREF_LOCAL_LINK
240+
bool "Local Link Address"
241+
242+
config ANJAY_WIFI_CONNECT_IPV6_PREF_GLOBAL
243+
bool "Global Address"
191244

192-
config ANJAY_WIFI_PASSWORD
193-
string "WiFi Password"
194-
default "mypassword"
245+
config ANJAY_WIFI_CONNECT_IPV6_PREF_SITE_LOCAL
246+
bool "Site Local Address"
195247

196-
config ANJAY_WIFI_CONNECT_IPV6
197-
bool "Obtain IPv6 address"
198-
default y
248+
config ANJAY_WIFI_CONNECT_IPV6_PREF_UNIQUE_LOCAL
249+
bool "Unique Local Link Address"
250+
endchoice
251+
endif
252+
endif
253+
254+
if ANJAY_CLIENT_INTERFACE_BG96_MODULE
255+
config ANJAY_CELLULAR_APN
256+
string "APN name"
257+
default "Cellular APN"
199258

200-
if ANJAY_WIFI_CONNECT_IPV6
201-
choice ANJAY_WIFI_CONNECT_IPV6_PREF
202-
prompt "Preferred IPv6 Type"
203-
default ANJAY_WIFI_CONNECT_IPV6_PREF_LOCAL_LINK
259+
choice ANJAY_CELLULAR_PDN_AUTH_TYPE
260+
prompt "PDN authentication type"
261+
default ANJAY_CELLULAR_PDN_AUTH_TYPE_NONE
204262

205-
config ANJAY_WIFI_CONNECT_IPV6_PREF_LOCAL_LINK
206-
bool "Local Link Address"
263+
config ANJAY_CELLULAR_PDN_AUTH_TYPE_NONE
264+
bool "No authentication"
207265

208-
config ANJAY_WIFI_CONNECT_IPV6_PREF_GLOBAL
209-
bool "Global Address"
266+
config ANJAY_CELLULAR_PDN_AUTH_TYPE_PAP
267+
bool "PAP"
210268

211-
config ANJAY_WIFI_CONNECT_IPV6_PREF_SITE_LOCAL
212-
bool "Site Local Address"
269+
config ANJAY_CELLULAR_PDN_AUTH_TYPE_CHAP
270+
bool "CHAP"
213271

214-
config ANJAY_WIFI_CONNECT_IPV6_PREF_UNIQUE_LOCAL
215-
bool "Unique Local Link Address"
272+
config ANJAY_CELLULAR_PDN_AUTH_TYPE_PAP_OR_CHAP
273+
bool "PAP or CHAP"
216274
endchoice
275+
276+
config ANJAY_CELLULAR_PDN_USERNAME
277+
string "PDN username" if !ANJAY_CELLULAR_PDN_AUTH_TYPE_NONE
278+
default ""
279+
280+
config ANJAY_CELLULAR_PDN_PASSWORD
281+
string "PDN password" if !ANJAY_CELLULAR_PDN_AUTH_TYPE_NONE
282+
default ""
283+
217284
endif
218285
endmenu
219286
endmenu

main/anjay

Submodule anjay updated 123 files

0 commit comments

Comments
 (0)