We expand our Anjay integration using Zephyr OS on nRF9160 Development Kit – the board popular among IoT devices and desired by our clients. It offers two push buttons and switches, four LEDs and a GPS module with both onboard and external antennas. Apart from that, there is also a nanoSIM card slot to let users connect to the LTE network.
First of all, integrating anjay on the next board made us restructure the project directory tree. Separating and moving prj.conf
and CMakeLists.txt
files to projects/*
subdirectories were essential to make the app compatible with two different boards. The CMakeLists.txt
file in the root directory is included in CMakeLists.txt
files mentioned before and configures the build process depending on the build target (BOARD
variable).
During development, we made use of nRF Connect SDK provided by Nordic Semiconductor. It contains Zephyr RTOS and libraries recommended for various devices, including nRF9160.
One of the problems we faced was the entropy driver. CC310
library has the entropy_get_entropy
function, which requires an input buffer to be 144 bytes long – it dictates more complex implementation of the entropy_callback
function used in the anjay_configuration_t
object.
Another challenge was clock synchronization. Using the lte_lc
library forced us to add new configuration entries (e.g. CONFIG_BSD_LIBRARY=y
). After that modification, the CONFIG_POSIX_API=y
entry generated an error so it had to be removed. Because of that, clock_settime
used in set_system_time
on the STM platform couldn't be reutilized on the nRF9160 platform. This issue led us to the date_time
library. The source of the current timestamp is the external NTP server defined in default_config.h
. This timestamp is then obtained in the avs_time_real_now
function present in compat/time_compat.c
using date_time_now
. The library updates timestamp periodically by means of internal methods – the update interval is set with the CONFIG_DATE_TIME_UPDATE_INTERVAL_SECONDS
option.
The GitHub repository has been updated with described integration. Developers can track changes listed in the CHANGELOG.md
file.
Subscribe to stay in the loop with all our latest content:
Recommended posts