in IOT, Linux

Samsung ARTIK 530 use Arduino IDE

Summary

Tested the IDE Arduino, Network ports to load sketches to the ARTIK board is working properly, the Serial port has some issue.

Enable Client-side Transfer

Enable the client side transfer on ARTIK 530 use curl command.
curl downloads.arduino.cc/libArduino/install_artik_prereq.sh | sh

[root@artik ~]# curl downloads.arduino.cc/libArduino/install_artik_prereq.sh | sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7725  100  7725    0     0   8587      0 --:--:-- --:--:-- --:--:--  8592
################################
#                              #
# Arduino for Artik Installer  #
#                              #
################################

The software you are going to install is alpha state.
By installing it you are accepting not to disclose 
any part of this software before it is officialy published by Arduino LLC


Configuring services

Hardware    : s5p4418
mkdir: cannot create directory ‘/root/autostart’: File exists
--2017-06-16 00:53:08--  http://downloads.arduino.cc/libArduino/adbd
Resolving downloads.arduino.cc (downloads.arduino.cc)... 158.69.86.55
Connecting to downloads.arduino.cc (downloads.arduino.cc)|158.69.86.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 157640 (154K) [application/octet-stream]
Saving to: ‘adbd.4’

adbd.4                 100%[==========================>] 153.95K   147KB/s    in 1.1s    

2017-06-16 00:53:10 (147 KB/s) - ‘adbd.4’ saved [157640/157640]

# Generated by iptables-save v1.4.21 on Fri Jun 16 00:53:10 2017
*nat
:PREROUTING ACCEPT [2027:200104]
:INPUT ACCEPT [422:50229]
:OUTPUT ACCEPT [26:2539]
:POSTROUTING ACCEPT [26:2539]
COMMIT
# Completed on Fri Jun 16 00:53:10 2017
# Generated by iptables-save v1.4.21 on Fri Jun 16 00:53:10 2017
*security
:INPUT ACCEPT [1779:349014]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [494:50338]
COMMIT
# Completed on Fri Jun 16 00:53:10 2017
# Generated by iptables-save v1.4.21 on Fri Jun 16 00:53:10 2017
*raw
:PREROUTING ACCEPT [3389:499149]
:OUTPUT ACCEPT [496:50730]
COMMIT
# Completed on Fri Jun 16 00:53:10 2017
# Generated by iptables-save v1.4.21 on Fri Jun 16 00:53:10 2017
*mangle
:PREROUTING ACCEPT [3389:499149]
:INPUT ACCEPT [1779:349014]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [498:51142]
:POSTROUTING ACCEPT [537:58443]
:connman-INPUT - [0:0]
:connman-POSTROUTING - [0:0]
-A INPUT -j connman-INPUT
-A POSTROUTING -j connman-POSTROUTING
-A connman-INPUT -j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff
-A connman-POSTROUTING -j CONNMARK --save-mark --nfmask 0xffffffff --ctmask 0xffffffff
COMMIT
# Completed on Fri Jun 16 00:53:10 2017
# Generated by iptables-save v1.4.21 on Fri Jun 16 00:53:10 2017
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [10:1980]
-A INPUT -i wlan0 -p tcp -m tcp --dport 6571 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 6571 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i wlan0 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
COMMIT
# Completed on Fri Jun 16 00:53:10 2017
mkdir: cannot create directory ‘/lib/firmware/’: File exists


Done! You can now find your board in IDE, "Network ports" menu
If no board is listed, please follow the online guide on adding additional boards
Add the following link and install "ARM Linux Boards" from board manager
http://downloads.arduino.cc/libArduino/package_arduino.cc_linux_index.json
Please use IDE version 1.6.6

[root@artik ~]# 

Arduino IDE usage

Copy and paste this URL into 'Additional Boards Manager URLs'.

http://downloads.arduino.cc/packages/package_arduino.cc_linux_index.json

Additional Boards Manager URLs

Install the latest "ARM Linux Boards" package.

ARM Linux Boards

Successful connect the network port as below,
connect the network

Compile below code test on serial debugging, to show Arduino uses the serial USB debug terminal interface for error output.

#define SERIAL_ARTIK Serial1
int pin = 38;
void setup() {
  // put your setup code here, to run once:
  // initialize digital pin 13 as an output.
  pinMode(pin, OUTPUT);
  SERIAL_ARTIK.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  SERIAL_ARTIK.println("Turn on LED");
  digitalWrite(pin, HIGH); // turn the LED on (HIGH is the voltage level)
  delay(1000); // wait for a second
  SERIAL_ARTIK.println("Turn off LED");
  digitalWrite(pin, LOW); // turn the LED off by making the voltage LOW
  delay(1000); // wait for a second
}

Two ways to execute the code, 1st one to use the 'Upload' button to upload to ARTIK 530 directly and execute.

1nd way is to use 'Export compiled Binary' button, and copy the xxx.elf to ARTIK 530 to execute.

[root@artik ~]# chmod 755 sketch_jun15a.ino.artik530.elf 
[root@artik ~]# 
[root@artik ~]# ./sketch_jun15a.ino.artik530.elf 

The result shows at the serial port print 'Turn on LED' and 'Turn off LED' continuously.

[root@artik ~]# Turn on LED
Turn off LED
Turn on LED
Turn off LED
Turn on LED
Turn off LED
Turn on LED
Turn off LED
Turn on LED
Turn off LED
Turn on LED
Turn off LED
Turn on LED
...

Issue on Connecting Arduino IDE to ARTIK over USB

Alternatively Arduino can use USB to uploading sketches to the ARTIK board, for ARTIK 530 case, needs to use USB OTG. I have below issues.

First the watcher cannot be executed successful, as below,

[root@artik ~]# /root/watcher &
[root@artik ~]# mkdir: cannot create directory ˉfunctions/acm.GS0ˇ: No such file or directory
ln: failed to create symbolic link 'configs/c.1/acm.GS0': No such file or directory
c0040000.dwc2otg
--> Press Ctrl+C to force start, Ctrl+\ to exit.
..............................

Secondly, follow below procedure still cannot use USB to uploading sketches.
I installed the driver through the location as below,

C:\Users\HuiLin_Xiong\AppData\Local\Arduino15\packages\arduino\tools\linuxuploader\1.3\drivers

I can change the driver between, “Samsung Artik ADB Interface” and “Samsung Artik Composite ADB interface”, but cannot find ‘USB Composite Device’, at the end, the
entry cannot appear under “Port/Serial Ports” called “Samsung
Artik 5”

Samsung Artick ADB Interface shows after execute ‘watcher’.
Samsung Artick ADB Interface

Change the driver,
Change the driver

Pick from a list of device drivers on my computer.
Pick from a list

Change between, “Samsung Artik ADB Interface” and “Samsung Artik Composite ADB interface”
Choose the second one

Driver installed successful
Driver installed successful

Samsung Artik Composite ADB Interface shows.
Samsung Artik Composite ADB Interface

Reference

developer.artik.io–Arduino IDE
Download SamsungArtiklibArduinoInstructions-7-25.pdf
Arduino Web site to download and install the IDE package


Write a Comment

Comment