Coder Social home page Coder Social logo

lwm2m-client-rtl8710's Introduction

lwm2m-client-rtl8710

C++ implementation of lwm2m protocol client for use with RTL8710 MCU based devices.

Compiling/Flashing

Project built on PlatformIO core. Refer to PlatformIO documentation for detailed instructions on core installation and project configuration at: http://docs.platformio.org/en/latest/

Currently the project uses a custom PlatformIO platform, developed for Linux and Windows systems.

To compile project run:

platformio run

This command will download all libraries, tools, frameworks and platforms necessary to build, flash and debug the project.


To upload project run:

platformio run -t upload

Most RTL8710 based development boards include a CMSIS-DAP interface for device flashing and debugging, so proper driver installation might be needed.

Instructions on DAP firmware installation can be found here.

Lwm2m

The application uses the lwm2m protocol, and includes examples of how to implement GPIO, PWM, ADC, I2C and SPI features using lwm2m objects.

To choose between building SPI, I2C or ADC example uncomment the appropriate '#define' - 'SPI_MASTER_OBJ', 'I2C_MASTER_OBJ' or 'ADC_OBJ'. Only one of these objects can be used at the same time.

GPIO

Refer to lwm2m object id3312

  • Write 1/0 to resource 'OnOff' to set GPIO pin PA12 to either high or low.

PWM

Object id3306

  • Resource 'OnOff' turns PWM output on or off for pin PA_0.
  • 'Dimmer' sets the duty cycle. Can be an integer value [0-100].
  • 'OnTime' lets you specify a time in micro seconds that you want PWM to be on.

ADC

Object id3202

  • Read resource 'AnalogInputCurrentValue' to measure voltage on pin PA19.

SPI

Object id26241 (look for header file in 'include' directory)

  • 'Frequency' specifies the SPI clock frequency.
  • 'Mode' specifies SPI mode.
  • 'Buffer' - data to be sent to SPI slave devices. Read this resource to get last received data from slave devices.
  • 'Length' - received data length.
  • 'Transaction' - once you have specified a data buffer, execute this resource to start SPI write command. 'Buffer' resource gets overwritten by data received from slaves.

I2C

Object id26241

  • 'Frequency' specifies the I2C clock frequency.
  • 'Slave_address' specifies I2C slave address.
  • 'Buffer' - data to be sent to I2C slave devices. After read operation this resource is overwritten with data received from slaves. If you want read only operation, then buffer must be empty.
  • 'Length' - if value is larger than 0 specifies number of bytes to be read, else specifies write only operation.
  • 'Transaction' - execute this resource to start I2C write, read or write/read operation (depends on previously defined conditions).

Configuration

Once powered on the device connects to an access point and server configured inside its flash memory. Configuration is done with HTTP requests while the device is in access point mode. To switch device into AP mode pull UART_LOG_TX pin to ground for at least three seconds, on most developments boards this can be done by holding the 'UART DOWNLOAD' button.


Once connected to device AP, you can view the current configuration by sending a GET request to "http://[GATEWAY_ADDR]:80/ap", ex.:

curl http://192.168.4.1:80/ap

To keep current configuration send a GET request to "http://[GATEWAY_ADDR]:80/keep", ex.:

curl http://192.168.4.1:80/keep

To change current configuration send POST request to "http://[GATEWAY_ADDR]:80/ap", with JSON payload, ex.:

curl http://192.168.4.1:80/ap -d '{"ssid":"ap_ssid","pass":"ap_password","client_name":"example_client","server_address":"coap://192.168.0.1:5555"}' -H 'Content-type:application/json'

Controling device

Lwm2m functionality was tested out using example lwm2m rest server located at: https://github.com/8devices/wakaama/tree/master-rest/examples/rest-server

Documentation on server usage and client control API is found at: https://github.com/8devices/wakaama/blob/master-rest/examples/rest-server/RESTAPI.md

For easier GUI based device control it is recommended to use Node-RED programming tool: https://nodered.org/

Lwm2m protocol compatible nodes for the Node-RED programming utility can be found at: https://github.com/8devices/node-red-contrib-lesley

Debugging

in development

License

  • All code in this project is provided under The MIT License (MIT)

  • Project uses sdk-ameba-v4.0b framework provided by Realtek

  • Project uses WakaamaNode library which is under The MIT License (MIT), Copyright (c) 2016 Openhab-Nodes

  • WakaamaNode library in turn depends on Wakaama which is under the Eclipse Public License - v2.0

lwm2m-client-rtl8710's People

Contributors

giedriusm avatar taubel avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

lwm2m-client-rtl8710's Issues

Link to CMSIS-DAP firmware

README states

Most RTL8710 based development boards include a CMSIS-DAP interface for device flashing and debugging, so proper driver installation might be needed.

Link to page with download and installation info should be provided.
Note: provided CMSIS-DAP firmware should have properly working virtual COM port AND fast firmware upload.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.