Device-specific instructions for following:
- ConnectCore 6 and ConnectCore 6 Single Board Computer (SBC) from Digi
International
- ConnectCore 6 UL and ConnectCore 6 UL Starter board from Digi
International
- DS-VE2208X-RBD from Hikvision
- Updated CPS-MC341-ADSC2 for Ubuntu 14.04
This commit is contained in:
neeraj-khanna 2016-12-13 20:33:45 +05:30
Родитель 095e40704a
Коммит 2fd7db9ea2
5 изменённых файлов: 980 добавлений и 149 удалений

Просмотреть файл

@ -0,0 +1,213 @@
---
platform: digi embedded yocto 2.0
device: connectcore 6 and connectcore 6 single board computer
language: python
---
Run a simple PYTHON sample on ConnectCore 6 and ConnectCore 6 Single Board Computer (SBC) running Digi Embedded Yocto 2.0 (DEY2.0)
===
---
# Table of Contents
- [Introduction](#Introduction)
- [Step 1: Prerequisites](#Prerequisites)
- [Step 2: Prepare your Device](#PrepareDevice)
- [Step 3: Build and Run the Sample](#Build)
<a name="Introduction"></a>
# Introduction
**About this document**
This document describes how to build ConnectCore 6 SBC running DEY2.0 with Azure IoT SDK. This multi-step process includes:
- Configuring Azure IoT Hub
- Registering your IoT device
- Build and deploy Azure IoT SDK on device
<a name="Prerequisites"></a>
# Step 1: Prerequisites
You should have the following items ready before beginning the process:
- [ConnectCore 6 SBC and development environment][setup-sbc]
- [ConnectCore 6 SBC hardware setup][setup-hardware]
- [Prepare your development environment][setup-devbox-python]
- [Setup your IoT hub][lnk-setup-iot-hub]
- [Provision your device and get its credentials][lnk-manage-iot-hub]
- Empty microSD card 8GB at least.
<a name="PrepareDevice"></a>
# Step 2: Prepare your Device
You should have following steps to prepare the device.
## 2.1 Intall DEY2.0 into Linux Host PC
- [Here][setup-dey2.0] is instruction how to install DEY2.0 and setup Linux Host PC.
## 2.2 Create projects and build images
- [Here][create-dey2.0-image] is instruction to create projects and build images.
## 2.3 Customize root file system
- DEY allows you to configure network default configuration for your customized image.
- Dynamic IP or Static IP address can be configured. [Here][customize-network-setting] is instruction how to configure network setting.
- Also DEY allows you to add features and packages to your target image.
- Use the syntax below and add features to your **conf/local.conf** file.
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-debug tools-sdk dev-pkgs"
IMAGE_INSTALL_append = " strace cmake boost"
PACKAGECONFIG_pn_boost = " python"
- Note that the space must be included before the first word in IMAGE_INSTALL_append and PACKAGECONFIG_pn_boost section. Then build new image by following command.
bitake dey-image-qt
- New image will be created in **tmp/deploy/images/ccimx6sbc** directory.
- Specifically, following file is symbolic link file. You can find actual file to trace link path.
dey-image-qt-ccimx6sbc.rootfs.tar.bz2 -- root file system
## 2.4 Format and partition microSD card
- 8GB size is appropriate for root file system area and swap srea.
- Firstly, format microSD card in ext4 and make 3 partitions at least.
- Following is example of partition in microSD card. (Block size is approximte.)
Device Blocks Id System
/dev/mmcblk0p1 32KB b W95 FAT32
/dev/mmcblk0p2 4GB 83 Linux
/dev/mmcblk0p3 4GB 82 Linux Swap
## 2.5 Install root file system built in DEY2.0
- Copy root file system into **/dev/mmcblk0p2** "Linux" parition.
- Other 2 files are copied into **/dev/mmcblk0p1** "W32 FAT" partition.
- Insert microSD card to socket in ConnectCore 6 SBC.
- Serial cable is connected between Linux Host PC and the board.
- Turn on the board then messages are shown through console over serial cable.
- Hit any key immediately to stop autoboot. Then arrow prompt can be seen.
Hit any key to stop autoboot: 0
=>
## 2.6 Modify boot parameters to boot the OS from microSD card
- Execute following command sets to modify boot parameters.
setenv mmcdev 0
setenv mmcroot /dev/mmcblk1p2
dboot linux mmc
- Turn on the board and messages are shown through console over serial cable.
- Open and configure minicom or serial console terminal then check messages.
Digi Embedded Yocto 2.0-r3 ccimx6sbc /dev/ttymxc4
ccimx6sbc login:
- You can login by your username and passowrd if you configured.
- Before building SDK, swap must be enabled.
## 2.6 Confirm software version
Check software version. **cmake** version is 3.x or higher. **gcc** version is 4.9 or higher. And **python** is 2.7.x.
cmake --version
gcc --version
python --version
<a name="Build"></a>
# Step 3: Build and Run the sample
<a name="Load"></a>
## 3.1 Install SDK
- Remove microSD card from ConnectCore 6 SBC then insert microSD card to Linux Host PC. Mount microSD card to be able to access.
sudo mount /dev/mmcblk0p2 /media
- Download Azure IoT Device SDK for Python by following commands.
git clone --recursive https://github.com/Azure/azure-iot-sdks.git
- Archive and copy into microSD card by following commands.
tar cvf ./azure-iot.sdks.tar ./azure-iot.sdks
sudo cp ./azure-iot.sdks.tar /media/home/root/.
- Unmount microSD card and remove from Linux Host PC.
sudo umount /media
- Insert microSD card into ConnectCore 6 SBC.
- Connect USB cable to the board then it turns on.
- Login and move directory /home/root then extract `azure-iot-sdks.tar` file.
cd /home/root
tar xvf azure-iot-sdks.tar
## 3.1 Build SDK and sample
- Run following commands to build the SDK:
cd azure-iot.sdks/python/build_all/linux
./build.sh
- After a successful build, the `iothub_client.so` Python extension module is copied to the **python/device/samples** folder.
- Navigate to samples folder by executing following command:
cd azure-iot-sdks/python/device/samples/
- Edit the following file using `vi`text editor:
vi iothub_client_sample.py
- Find the following place holder for device connection string:
connectionString = "[device connection string]"
- Replace the above placeholder with device connection string you obtained in [Step 1](#Prerequisites) and save the changes.
## 3.2 Send Device Events to IoT Hub:
- Run the sample application using the following command:
**For AMQP protocol:**
python iothub_client_sample.py -p amqp
**For HTTP protocol:**
python iothub_client_sample.py -p http
**For MQTT protocol:**
python iothub_client_sample.py -p mqtt
- See [Manage IoT Hub][lnk-manage-iot-hub] to learn how to observe the messages IoT Hub receives from the application.
## 3.3 Receive messages from IoT Hub
- See [Manage IoT Hub][lnk-manage-iot-hub] to learn how to send cloud-to-device messages to the application.
[setup-sbc]: http://www.digi.com/resources/documentation/digidocs/90001945-13/default.htm#concept/yocto/c_get_started_with_yocto.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto%7CGet%2520started%7C_____0
[setup-hardware]: http://www.digi.com/resources/documentation/digidocs/90001945-13/default.htm#task/yocto/t_set_up_hardware_yocto.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto%7CGet%2520started%7C_____2
[setup-dey2.0]: http://www.digi.com/resources/documentation/digidocs/90001945-13/default.htm#task/yocto/t_install_dey.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto%7CSystem%2520development%7CFirst%2520steps%7C_____1
[create-dey2.0-image]: http://www.digi.com/resources/documentation/digidocs/90001945-13/default.htm#task/yocto/t_create_build_projects_yocto.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto%7CSystem%2520development%7CFirst%2520steps%7C_____2
[customize-network-setting]: http://www.digi.com/resources/documentation/digidocs/90001945-13/default.htm#task/yocto/t_customize_root_file_system_yocto.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto%7CSystem%2520development%7CFirst%2520steps%7C_____3
[setup-devbox-python]: https://github.com/Azure/azure-iot-sdks/blob/master/doc/get_started/python-devbox-setup.md
[lnk-setup-iot-hub]: ../../setup_iothub.md
[lnk-manage-iot-hub]: ../../manage_iot_hub.md

Просмотреть файл

@ -0,0 +1,220 @@
---
platform: digi embedded yocto 2.0
device: connectcore 6 ul starter kit
language: python
---
Run a simple PYTHON sample on ConnectCore 6 UL and ConnectCore 6 UL Starter board running Digi Embedded Yocto 2.0 (DEY2.0)
===
---
# Table of Contents
- [Introduction](#Introduction)
- [Step 1: Prerequisites](#Prerequisites)
- [Step 2: Prepare your Device](#PrepareDevice)
- [Step 3: Build and Run the Sample](#Build)
<a name="Introduction"></a>
# Introduction
**About this document**
This document describes how to build ConnectCore 6 UL and Starter board running DEY2.0 with Azure IoT SDK. This multi-step process includes:
- Configuring Azure IoT Hub
- Registering your IoT device
- Build and deploy Azure IoT SDK on device
<a name="Prerequisites"></a>
# Step 1: Prerequisites
You should have the following items ready before beginning the process:
- [ConnectCore 6 UL Starter board and development environment][setup-starter-board]
- [ConnectCore 6 UL Starter board hardware setup][setup-hardware]
- [Prepare your development environment][setup-devbox-python]
- [Setup your IoT hub][lnk-setup-iot-hub]
- [Provision your device and get its credentials][lnk-manage-iot-hub]
- Empty microSD card 8GB at least.
<a name="PrepareDevice"></a>
# Step 2: Prepare your Device
You should have following steps to prepare the device.
## 2.1 Intall DEY2.0 into Linux Host PC
- [Here][setup-dey2.0] is instruction how to install DEY2.0 and setup Linux Host PC.
## 2.2 Create projects and build images
- [Here][create-dey2.0-image] is instruction to create projects and build images.
## 2.3 Customize root file system
- DEY allows you to configure network default configuration for your customized image.
- Dynamic IP or Static IP address can be configured. [Here][customize-network-setting] is instruction how to configure network setting.
- Also DEY allows you to add features and packages to your target image.
- Use the syntax below and add features to your **conf/local.conf** file.
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-debug tools-sdk dev-pkgs"
IMAGE_INSTALL_append = " strace cmake boost"
PACKAGECONFIG_pn_boost = " python"
- Note that the space must be included before the first word in IMAGE_INSTALL_append and PACKAGECONFIG_pn_boost section. Then build new image by following command.
bitake core-image-base
- New image will be created in **tmp/deploy/images/ccimx6ulstarter** directory.
- Specifically, following 3 files are symbolic link files. You can find actual files to trace link path.
core-image-base-ccimx6ulstarter.rootfs.tar.bz2 -- root file system
zImage-ccimx6ulstarter.bin
zImage-imx6ul-ccimx6ulstarter-wb.dtb -- device tree image
## 2.4 Format and partition microSD card
- 8GB size is appropriate for root file system area and swap srea.
- Firstly, format microSD card in ext4 and make 3 partitions at least.
- Following is example of partition in microSD card. (Block size is approximte.)
Device Blocks Id System
/dev/mmcblk0p1 32KB b W95 FAT32
/dev/mmcblk0p2 4GB 83 Linux
/dev/mmcblk0p3 4GB 82 Linux Swap
## 2.5 Install root file system built in DEY2.0
- Copy root file system into **/dev/mmcblk0p2** "Linux" parition.
- Other 2 files are copied into **/dev/mmcblk0p1** "W32 FAT" partition.
- Insert microSD card to socket in ConnectCore 6 UL Starter board.
- USB cable is connected between Linux Host PC and the board.
- Turn on the board then messages are shown through console over USB.
- Hit any key immediately to stop autoboot. Then arrow prompt can be seen.
Hit any key to stop autoboot: 0
=>
## 2.6 Modify boot parameters to boot the OS from microSD card
- Execute following command sets to modify boot parameters.
setenv mmcdev 0
setenv mmcpart 1
setenv mmcroot /dev/mmcblk1p2
setenv bootargs console=${console},${baudrare} root=${mmcroot}
fatload mmc 0:1 ${fdt_addr} zImage-imx6ul-ccimx6ulstarter-wb.dtb
fatload mmc 0:1 ${loadaddr} zImage-ccimx6ulstarter.bin
bootz ${loadaddr] - ${fdt_addr}
saveenv
reset
- Turn on the board and messages are shown through console over USB.
- Open and configure minicom or serial console terminal then check messages.
Digi Embedded Yocto 2.0-r3 ccimx6ulstarter /dev/ttymxc4
ccimx6ulstarter login:
- You can login by your username and passowrd if you configured.
- Before building SDK, swap must be enabled.
## 2.6 Confirm software version
Check software version. **cmake** version is 3.x or higher. **gcc** version is 4.9 or higher. And **python** is 2.7.x.
cmake --version
gcc --version
python --version
<a name="Build"></a>
# Step 3: Build and Run the sample
<a name="Load"></a>
## 3.1 Install SDK
- Remove microSD card from ConnectCore 6 UL Starter board then insert microSD card to Linux Host PC. Mount microSD card to be able to access.
sudo mount /dev/mmcblk0p2 /media
- Download Azure IoT Device SDK for Python by following commands.
git clone --recursive https://github.com/Azure/azure-iot-sdks.git
- Archive and copy into microSD card by following commands.
tar cvf ./azure-iot.sdks.tar ./azure-iot.sdks
sudo cp ./azure-iot.sdks.tar /media/home/root/.
- Unmount microSD card and remove from Linux Host PC.
sudo umount /media
- Insert microSD card into ConnectCore 6 UL Starter board.
- Connect USB cable to the board then it turns on.
- Login and move directory /home/root then extract `azure-iot-sdks.tar` file.
cd /home/root
tar xvf azure-iot-sdks.tar
## 3.1 Build SDK and sample
- Run following commands to build the SDK:
cd azure-iot.sdks/python/build_all/linux
./build.sh
- After a successful build, the `iothub_client.so` Python extension module is copied to the **python/device/samples** folder.
- Navigate to samples folder by executing following command:
cd azure-iot-sdks/python/device/samples/
- Edit the following file using `vi`text editor:
vi iothub_client_sample.py
- Find the following place holder for device connection string:
connectionString = "[device connection string]"
- Replace the above placeholder with device connection string you obtained in [Step 1](#Prerequisites) and save the changes.
## 3.2 Send Device Events to IoT Hub:
- Run the sample application using the following command:
**For AMQP protocol:**
python iothub_client_sample.py -p amqp
**For HTTP protocol:**
python iothub_client_sample.py -p http
**For MQTT protocol:**
python iothub_client_sample.py -p mqtt
- See [Manage IoT Hub][lnk-manage-iot-hub] to learn how to observe the messages IoT Hub receives from the application.
## 3.3 Receive messages from IoT Hub
- See [Manage IoT Hub][lnk-manage-iot-hub] to learn how to send cloud-to-device messages to the application.
[setup-starter-board]: http://www.digi.com/resources/documentation/digidocs/90001514/default.htm#reference/yocto/r_requirements_yocto.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto%7CGet%2520started%7C_____1
[setup-hardware]: http://www.digi.com/resources/documentation/digidocs/90001514/default.htm#task/yocto/t_set_up_hardware_yocto.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto%7CGet%2520started%7C_____2
[setup-dey2.0]: http://www.digi.com/resources/documentation/digidocs/90001514/default.htm#task/yocto/t_install_dey.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto%7CSystem%2520development%7CFirst%2520steps%7C_____1
[create-dey2.0-image]: http://www.digi.com/resources/documentation/digidocs/90001514/default.htm#task/yocto/t_create_build_projects_yocto.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto%7CSystem%2520development%7CFirst%2520steps%7C_____2
[customize-network-setting]: http://www.digi.com/resources/documentation/digidocs/90001514/default.htm#task/yocto/t_customize_root_file_system_yocto.htm%3FTocPath%3DDigi%2520Embedded%2520Yocto%7CSystem%2520development%7CFirst%2520steps%7C_____3
[setup-devbox-python]: https://github.com/Azure/azure-iot-sdks/blob/master/doc/get_started/python-devbox-setup.md
[lnk-setup-iot-hub]: ../../setup_iothub.md
[lnk-manage-iot-hub]: ../../manage_iot_hub.md

Просмотреть файл

@ -0,0 +1,481 @@
---
platform: ubuntu 14.04lts
device: cps-mc341-adsc2
language: c
---
Run a simple C sample on CPS-MC341-ADSC2 device running Ubuntu 14.04LTS
===
---
# Table of Contents
- [Introduction](#Introduction)
- [Step 1: Prerequisites](#Prerequisites)
- [Step 2: Prepare your Device](#PrepareDevice)
- [Step 3: Build and Run the Sample](#Build)
<a name="Introduction"></a>
# Introduction
**About this document**
This document describes how to connect CPS-MC341-ADSC2 device running ubuntu14.04LTS with Azure IoT SDK. This multi-step process includes:
- Configuring Azure IoT Hub
- Registering your IoT device
- Build and deploy Azure IoT SDK on device
<a name="Prerequisites"></a>
# Step 1: Prerequisites
You should have the following items ready before beginning the process:
- Required items for development.
- CONPROSYS(CPS-MC341-ADSC2)
- SDHC card (4Gbyte or larger, non-SDXC-compliant)
- Cable for serial monitor (Recommended cable: TTL-232R-3V3 AJ by FTDI)
- LAN Cable
- PC
- Creating a booting SD card for CONPROSYS.
- Preparation for the SD card image file.
Download the SD image file specific to the CONPROSYS model from the [CONTEC website](<http://www.contec.co.jp/product/m2m/software.html>)
- Write the image file into the SD card.
Write the image file that downloaded into the SD card.
The downloaded image file is a zip file. Decompress it into img file before start writing it in the SD card.
- By connecting a serial cable from host PC to CONPROSYS through the serial port (Diameter 3.5 MINI-JACK), you can log in from the console to the product.
See the setting details below.
- Baud rate:115200 bps
- Data bit:8bit
- Parity:none
- Stop bit:1bit
- Hardware flow:none
- We recommend the following serial cable for connecting the host PC to CONPROSYS.Download appropriate driver software to match OS of PC serial monitoring.
- TTL-232R-3V3 AJ by FTDI (included when purchasing the package version)
- URL for driver can be found [here](<http://www.ftdichip.com/Drivers/VCP.htm>)
- Default log-in and password are
- Log-in:conprosys
- Password:contec
- Create a new partition in the blank area of the memory.
1) Start the CONPROSYS.
2) Open the SD card device by fdisk to add a new Linux partition.
sudo fdisk /dev/mmcblk0
i) Add a new Linux partition by n command.
Parameter is set as follows:
<Parameter>
Command (m for help): <n>
Partition type: <p>
Partition number : <3>
First sector: <default value>
Last sector: <default value>
ii) Write the partition information by w command.
Command (m for help): w
3) Reboot CONPROSYS with the command below.
sudo reboot
4) Confirm the device of /dev/mmcblkk0p3 is available. Format the new created partition.
sudo mkfs -t ext3 /dev/mmcblk0p3
5) Create the destination for the new partition and mount it.
An example: mounting directory /mnt/ext_mmc
sudo mkdir /mnt/ext_mmc
sudo mount /dev/mmcblk0p3 /mnt/ext_mmc
6) Add the setting in /etc/fstab to mount automatically upon booting for the next time succeeding
An example: mounting directory /mnt/ext_mmc
/dev/mmcblk0p3 /mnt/ext_mmc ext3 defaults 0 0
- Expand the rootfs partition (ext3) of Linux to the maximum memory size in the SD card.
1) Start the CONPROSYS.
2) Open the SD card device by fdisk to change a Linux partition.
sudo fdisk /dev/mmcblk0
i) Display the present partition information by p command.
Take a note of the information displayed.
*Especially the Start / End address of /dev/mmcblk0p2.
[A display example: a SD card with 4GByte is run by Ubuntu14.04]
Command (m for help): p
Disk /dev/mmcblk0: 7746 MB, 7746879488 bytes
255 heads, 63 sectors/track, 941 cylinders, total 15130624 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 63 144584 72261 c W95 FAT32 (LBA)
/dev/mmcblk0p2 144585 7855784 3847567+ 83 Linux
ii) Delete Linux partition (Partition number: 2) by d command.
Command (m for help): d
Partition number (1-4): 2
iii) Add the Linux partition by n command.
For this, set the parameter as described below.
<Parameter>
Command (m for help): n
Partition type: p
Partition number : 2
First sector: <default value> (the Start address of /dev/mmcblk0p2 which you took a note by p command)
Last sector: <default value > (the End address of /dev/mmcblk0p2 which you took a note by p command)
iv) Display the changed partition information by p command.
Check whether the End address and Blocks of /dev/mmcblk0p2 are changed.
[A display example: a SD card with 4GByte is run by Ubuntu14.04]
Command (m for help): p
Disk /dev/mmcblk0: 7746 MB, 7746879488 bytes
255 heads, 63 sectors/track, 941 cylinders, total 15130624 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 63 144584 72261 c W95 FAT32 (LBA)
/dev/mmcblk0p2 144585 15130623 7484987 83 Linux
v) Write the partition information by w command.
Command (m for help): w
3) Reboot CONPROSYS with the command below.
sudo reboot
4) Resize the partition that was changed by resize2fs command.
sudo resize2fs /dev/mmcblk0p2
*It may take quite a long time to complete.
(several to several dozen minutes depending on the memory size)
After resize2fs command completes, confirm whether the memory size is expanded by df command.
df
- Computer with Git client installed and access to the
[azure-iot-sdks](https://github.com/Azure/azure-iot-sdks) GitHub
public repository.
- CPS-MC341-ADSC2 device.
- Download and install [DeviceExplorer](https://github.com/Azure/azure-iot-sdks/releases/download/2015-11-13/SetupDeviceExplorer.msi).
- [Set up your IoT hub](https://github.com/Azure/azure-iot-sdks/blob/master/doc/setup_iothub.md).
#### Create a device on IoT Hub
- With your IoT hub configured and running in Azure, follow the instructions in **"Create Device"** section of [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md).
#### Write down device credentials
- Make note of the Connection String for your device by following the instructions in **"Get device connection string or configuration data"** section of [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md).
<a name="PrepareDevice"></a>
# Step 2: Prepare your Device
- Default network setting is listed below:
- LAN A (eth0): 10.1.1.101
- LAN B (eth1): 192.168.1.101 (for 2 LAN Type setting only)
- If you would like to change the network setting, edit the file on target at location **etc/network/interfaces**
Example) Set "eth0" to "dhcp".
auto eth0
iface eth0 inet dhcp
- On the board, system reboot.
- Set the time synchronization using the ntpdate command.
- Update the apt-get
sudo apt-get update
- Install the uuid-dev
sudo apt-get install uuid-dev
<a name="Build"></a>
# Step 3: Build and Run the sample
<a name="Load"></a>
## 3.1 Build SDK and sample
- Download the Microsoft Azure IoT Device SDK for C to the board by issuing the following command on the board::
git clone --recursive https://github.com/Azure/azure-iot-sdks.git
- Edit the following file using vi editor:
azure-iot-sdks/c/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c
- Find the following place holder for device connection string:
static const char* connectionString = "[device connection string]";
- Replace the above placeholder with device connection string you obtained in [Step 1](#Prerequisites) and save the changes.
- Edit the following file using vi editor:
azure-iot-sdks/tools/iot_hub_e2e_tests_params/iot_device_params.txt
IOTHUB_CONNECTION_STRING=<HostName=...>
IOTHUB_DEVICE_ID=
IOTHUB_DEVICE_KEY=
IOTHUB_EVENTHUB_CONNECTION_STRING=<Endpoint=...>
IOTHUB_EVENTHUB_CONSUMER_GROUP=$Default
IOTHUB_EVENTHUB_LISTEN_NAME=
IOTHUB_SHARED_ACCESS_SIGNATURE=<SharedAccessSignature sr=...>
IOTHUB_PARTITION_COUNT=16
IOTHUB_PROTOCOL_GATEWAY_HOSTNAME=
- Replace the above placeholder with device connection string you obtained in [Step 1](#Prerequisites) and save the changes.
- On the board, run the following command to change params:
cd ./azure-iot-sdks/tools/iot_hub_e2e_tests_params/
sudo chmod +x setiotdeviceparametersfore2etests.sh
sudo ./setiotdeviceparametersfore2etests.sh
- On the board, system reboot.
- Replace the above placeholder with device connection string you obtained in [Step 1](#Prerequisites) and save the changes.
- Set the time synchronization using the ntpdate command.
- Edit the following file using vi editor:
azure-iot-sdks/c/build_all/linux/build.sh
- Find the following place holder:
CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
- Edit as follows, and then save the changes:
CORES=1
- Edit the following file using vi editor:
azure-iot-sdks/c/azure-c-shared-utility/tests/condition_unittests/CMakeLists.txt
- Add, and then save the changes:
Set(CMAKE_CXX_FLAGS "-lrt")
- Swap memory setting
CONPROSYS memory may not be enough for building large source code. You can expand the memory by creating a swap file on the disk.
An example: Creating 1Gbyte of SWAP memory
1) Create a SWAP file.
dd if=/dev/zero of=/home/swapfile bs=1024 count=1024000
mkswap /home/swapfile
2) Set the SWAP file.
sudo swapon /home/swapfile
Once you create the SWAP file, you only need to set the file after next time.
- Build the SDK samples using the following command:
./azure-iot-sdks/c/build_all/linux/build.sh
## 3.2 Send Device Events to IoT Hub:
- Run the sample by issuing following command:
~/azure-iot-sdks/c/cmake/iotsdk_linux/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http
- On Windows, refer "Monitor device-to-cloud events" in [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md) to see the data your device is sending.
## 3.3 Receive messages from IoT Hub
- On Windows, refer "Send cloud-to-device messages" in [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md) for instructions on sending messages to device.
The following is described for past compatibility.
Please use Ubuntu 14.04LTS for new use.
===
---
Run a simple C sample on CPS-MC341-ADSC2 device running Ubuntu 10.04LTS
===
---
# Table of Contents
- [Introduction](#Introduction)
- [Step 1: Prerequisites](#Prerequisites)
- [Step 2: Prepare your Device](#PrepareDevice)
- [Step 3: Build and Run the Sample](#Build)
<a name="Introduction"></a>
# Introduction
**About this document**
This document describes how to connect CPS-MC341-ADSC2 device running ubuntu10.04LTS with Azure IoT SDK. This multi-step process includes:
- Configuring Azure IoT Hub
- Registering your IoT device
- Build and deploy Azure IoT SDK on device
<a name="Prerequisites"></a>
# Step 1: Prerequisites
You should have the following items ready before beginning the process:
- By connecting a serial cable from host PC to CONPROSYS through the serial port (Diameter 3.5 MINI-JACK), you can log in from the console to the product.
See the setting details below.
- Baud rate:115200 bps
- Data bit:8bit
- Parity:none
- Stop bit:1bit
- Hardware flow:none
- We recommend the following serial cable for connecting the host PC to CONPROSYS.Download appropriate driver software to match OS of PC serial monitoring.
- TTL-232R-3V3 AJ by FTDI (included when purchasing the package version)
- URL for driver can be found [here](<http://www.ftdichip.com/Drivers/VCP.htm>)
- Default log-in and password are
- Log-in:conprosys
- Password:contec
- Computer with Git client installed and access to the
[azure-iot-sdks](https://github.com/Azure/azure-iot-sdks) GitHub
public repository.
- CPS-MC341-ADSC2 device.
- Download and install [DeviceExplorer](https://github.com/Azure/azure-iot-sdks/releases/download/2015-11-13/SetupDeviceExplorer.msi).
- [Set up your IoT hub](https://github.com/Azure/azure-iot-sdks/blob/master/doc/setup_iothub.md).
#### Create a device on IoT Hub
- With your IoT hub configured and running in Azure, follow the instructions in **"Create Device"** section of [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md).
#### Write down device credentials
- Make note of the Connection String for your device by following the instructions in **"Get device connection string or configuration data"** section of [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md).
<a name="PrepareDevice"></a>
# Step 2: Prepare your Device
- Default network setting is listed below:
- LAN A (eth0): 10.1.1.101
- LAN B (eth1): 192.168.1.101 (for 2 LAN Type setting only)
- If you would like to change the network setting, edit the file on target at location **etc/network/interfaces**
Example) Set "eth0" to "dhcp".
auto eth0
iface eth0 inet dhcp
- On the board, system reboot.
- Set the time synchronization using the ntpdate command.
- Update the apt-get
sudo apt-get update
- Install the uuid-dev
sudo apt-get install uuid-dev
<a name="Build"></a>
# Step 3: Build and Run the sample
<a name="Load"></a>
## 3.1 Build SDK and sample
- Download the Microsoft Azure IoT Device SDK for C to the board by issuing the following command on the board::
git clone --recursive https://github.com/Azure/azure-iot-sdks.git
- Edit the following file using vi editor:
{{**For AMQP protocol:**}}
azure-iot-sdks/c/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.c
{{**For HTTPS protocol:**}}
azure-iot-sdks/c/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c
- Find the following place holder for device connection string:
static const char* connectionString = "[device connection string]";
- Replace the above placeholder with device connection string you obtained in [Step 1](#Step-1:-Prerequisites) and save the changes.
- Edit the following file using vi editor:
azure-iot-sdks/tools/iot_hub_e2e_tests_params/iot_device_params.txt
IOTHUB_CONNECTION_STRING=<HostName=...>
IOTHUB_DEVICE_ID=
IOTHUB_DEVICE_KEY=
IOTHUB_EVENTHUB_CONNECTION_STRING=<Endpoint=...>
IOTHUB_EVENTHUB_CONSUMER_GROUP=$Default
IOTHUB_EVENTHUB_LISTEN_NAME=
IOTHUB_SHARED_ACCESS_SIGNATURE=<SharedAccessSignature sr=...>
IOTHUB_PARTITION_COUNT=16
IOTHUB_PROTOCOL_GATEWAY_HOSTNAME=
- Replace the above placeholder with device connection string you obtained in [Step 1](#Step-1:-Prerequisites) and save the changes.
- On the board, run the following command to change params:
cd ./azure-iot-sdks/tools/iot_hub_e2e_tests_params/
sudo chmod +x setiotdeviceparametersfore2etests.sh
sudo ./setiotdeviceparametersfore2etests.sh
- On the board, system reboot.
- Replace the above placeholder with device connection string you obtained in [Step 1](#Step-1:-Prerequisites) and save the changes.
- Set the time synchronization using the ntpdate command.
- Edit the following file using vi editor:
azure-iot-sdks/c/build_all/linux/build.sh
- Find the following place holder:
CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
- Edit as follows, and then save the changes:
CORES=1
- Edit the following file using vi editor:
azure-iot-sdks/c/azure-c-shared-utility/tests/condition_unittests/CMakeLists.txt
- Add, and then save the changes:
Set(CMAKE_CXX_FLAGS "-lrt")
- Build the SDK samples using the following command:
sudo -E ./azure-iot-sdks/c/build_all/linux/build.sh
## 3.2 Send Device Events to IoT Hub:
- Run the sample by issuing following command:
{{**If using AMQP protocol:**}}
~/azure-iot-sdks/c/cmake/iotsdk_linux/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp
{{**If using HTTPS protocol:**}}
~/azure-iot-sdks/c/cmake/iotsdk_linux/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http
- On Windows, refer "Monitor device-to-cloud events" in [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md) to see the data your device is sending.
## 3.3 Receive messages from IoT Hub
- On Windows, refer "Send cloud-to-device messages" in [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md) for instructions on sending messages to device.

Просмотреть файл

@ -1,149 +0,0 @@
---
platform: Ubuntu 10.04LTS
device: CPS-MC341-ADSC2
language: c
---
Run a simple C sample on CPS-MC341-ADSC2 device running Ubuntu 10.04LTS
===
---
# Table of Contents
- [Introduction](#Introduction)
- [Step 1: Prerequisites](#Prerequisites)
- [Step 2: Prepare your Device](#PrepareDevice)
- [Step 3: Build and Run the Sample](#Build)
<a name="Introduction"></a>
# Introduction
**About this document**
This document describes how to connect CPS-MC341-ADSC2 device running ubuntu10.04LTS with Azure IoT SDK. This multi-step process includes:
- Configuring Azure IoT Hub
- Registering your IoT device
- Build and deploy Azure IoT SDK on device
<a name="Prerequisites"></a>
# Step 1: Prerequisites
You should have the following items ready before beginning the process:
- By connecting a serial cable from host PC to CONPROSYS through the serial port (Diameter 3.5 MINI-JACK), you can log in from the console to the product.
See the setting details below.
- Baud rate:115200 bps
- Data bit:8bit
- Parity:none
- Stop bit:1bit
- Hardware flow:none
- We recommend the following serial cable for connecting the host PC to CONPROSYS.Download appropriate driver software to match OS of PC serial monitoring.
- TTL-232R-3V3 AJ by FTDI (included when purchasing the package version)
- URL for driver can be found [here](<http://www.ftdichip.com/Drivers/VCP.htm>)
- Default log-in and password are
- Log-in:conprosys
- Password:contec
- Computer with Git client installed and access to the
[azure-iot-sdks](https://github.com/Azure/azure-iot-sdks) GitHub
public repository.
- CPS-MC341-ADSC2 device.
- Download and install [DeviceExplorer](https://github.com/Azure/azure-iot-sdks/releases/download/2015-11-13/SetupDeviceExplorer.msi).
- [Set up your IoT hub](https://github.com/Azure/azure-iot-sdks/blob/master/doc/setup_iothub.md).
#### Create a device on IoT Hub
- With your IoT hub configured and running in Azure, follow the instructions in **"Create Device"** section of [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md).
#### Write down device credentials
- Make note of the Connection String for your device by following the instructions in **"Get device connection string or configuration data"** section of [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md).
<a name="PrepareDevice"></a>
# Step 2: Prepare your Device
- Default network setting is listed below:
- LAN A (eth0): 10.1.1.101
- LAN B (eth1): 192.168.1.101 (for 2 LAN Type setting only)
- If you would like to change the network setting, edit the file on target at location **etc/network/interfaces**
Example) Set "eth0" to "dhcp".
auto eth0
iface eth0 inet dhcp
- On the board, system reboot.
- Set the time synchronization using the ntpdate command.
- Install the uuid-dev
sudo apt-get install uuid-dev
<a name="Build"></a>
# Step 3: Build and Run the sample
<a name="Load"></a>
## 3.1 Build SDK and sample
- Download the Microsoft Azure IoT Device SDK for C to the board by issuing the following command on the board::
git clone --recursive https://github.com/Azure/azure-iot-sdks.git
- Edit the following file using vi editor:
{{**For AMQP protocol:**}}
azure-iot-sdks/c/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp.c
{{**For HTTPS protocol:**}}
azure-iot-sdks/c/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http.c
- Find the following place holder for device connection string:
static const char* connectionString = "[device connection string]";
- Replace the above placeholder with device connection string you obtained in [Step 1](#Step-1:-Prerequisites) and save the changes.
- Set the time synchronization using the ntpdate command.
- Edit the following file using vi editor:
azure-iot-sdks/c/build_all/linux/build.sh
- Find the following place holder:
CORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
- Edit as follows, and then save the changes:
CORES=1
- Edit the following file using vi editor:
azure-iot-sdks/c/c-utility/tests/condition_unittests/CMakeLists.txt
- Add, and then save the changes:
Set(CMAKE_CXX_FLAGS "-lrt")
- Build the SDK samples using the following command:
sudo -E ./azure-iot-sdks/c/build_all/linux/build.sh
## 3.2 Send Device Events to IoT Hub:
- Run the sample by issuing following command:
{{**If using AMQP protocol:**}}
azure-iot-sdks/c/cmake/iotsdk_linux/iothub_client/samples/iothub_client_sample_amqp/iothub_client_sample_amqp
{{**If using HTTPS protocol:**}}
azure-iot-sdks/c/cmake/iotsdk_linux/iothub_client/samples/iothub_client_sample_http/iothub_client_sample_http
- On Windows, refer "Monitor device-to-cloud events" in [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md) to see the data your device is sending.
## 3.3 Receive messages from IoT Hub
- On Windows, refer "Send cloud-to-device messages" in [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md) for instructions on sending messages to device.

Просмотреть файл

@ -0,0 +1,66 @@
---
device: ds-ve2208x-rbd
language: csharp
---
===
---
# Table of Contents
- [Introduction](#Introduction)
- [Step 1: Prerequisites](#Prerequisites)
- [Step 2: Prepare your Device](#PrepareDevice)
- [Step 3: Build and Run the Sample](#Build)
<a name="Introduction"></a>
# Introduction
**About this document**
This document describes how to connect DS-VE2208X-RBD device running Windows 10 Enteprise with Azure IoT SDK. This multi-step process includes:
- Configuring Azure IoT Hub
- Registering your IoT device
- Build and deploy Azure IoT SDK on device
<a name="Prerequisites"></a>
# Step 1: Prerequisites
You should have the following items ready before beginning the process:
- Computer with GitHub installed and access to the azure-iot-sdks GitHub private repository
- Install any version of Visual Studio 2015.
- Install Microsoft Azure SDK.
- [Setup your IoT hub][lnk-setup-iot-hub]
- [Provision your device and get its credentials][lnk-manage-iot-hub]
- [DS-VE2208X-RBD][device-link] device.
<a name="PrepareDevice"></a>
# Step 2: Prepare your Device
- Connect the power adapter, USB Keyboard/Mouse with Avalue [DS-VE2208X-RBD][device-link].
- Press the power button on the back of the device.
- Wait until the operating system is ready.
<a name="Build"></a>
# Step 3: Build and Run the sample
- Download the Azure IoT SDK and the sample programs and save them to your local repository.
- Start a new instance of Visual Studio 2015.
- Open the iothub_csharp_client.sln solution in the csharp\device folder in your local copy of the repository.
- In Visual Studio, from Solution Explorer, navigate to the samples folder.
- In the DeviceClientMqttSample project, open the Program.cs file.
- Locate the following code in the file:
private const string DeviceConnectionString = "<replace>";
- Replace `<replace>` with the connection string for your device.
- In Solution Explorer, right-click the DeviceClientMqttSample project, click Debug, and then click Start new instanceto build and run the sample. The console displays messages as the application sends device-to-cloud messages to IoT Hub.
- Use the DeviceExplorer utility to observe the messages IoT Hub receives from the Device Client MQTT Sampleapplication.
- Refer "Monitor device-to-cloud events" in [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md) to see the data your device is sending.
- Refer "Send cloud-to-device messages" in [DeviceExplorer Usage document](https://github.com/Azure/azure-iot-sdks/blob/master/tools/DeviceExplorer/doc/how_to_use_device_explorer.md) for instructions on sending messages to device.
[setup-devbox-windows]: https://github.com/Azure/azure-iot-sdks/blob/master/c/doc/devbox_setup.md
[lnk-setup-iot-hub]: https://github.com/Azure/azure-iot-sdks/blob/master/doc/setup_iothub.md
[lnk-manage-iot-hub]: https://github.com/Azure/azure-iot-sdks/blob/master/doc/manage_iot_hub.md
[device-link]:http://www.hikvision.com/cn/prgs_1321_i12311.html#prettyPhoto