Introduction: Using LinkIt One With Arduino in Linux

LinkIt One is undoubtedly a great development board. But one main problem is it still doesn't support development in linux machine. Personally this is a great problem for me as all I have is a linux machine. I don't want to install windows just to use LinkIt One. So far I have been working with a borrowed windows machine from my friend. Today I thought to check what actually is stopping LinkIt One from stop developing under linux.

Luckily there are no problems with the divers for LinkIt One. In my ubuntu machine, it got connected out of the box and serial ports are listed as "ttyACM0" and "ttyACM1".

As my research progressed, I understood that culprits are two executables 'PackTag' and 'PushTool'. These are distributed as binaries for Mac and Win, so a recompilation is not a choice. As I further explored what these tools does, I understood that 'PackTag' takes the compiled ELF file and ouputs VXP file, after packing some tags (OS related, I think) and hence the name. 'PushTool' is used to upload the .vxp file to LinkIt One. So ideally, if I can take the windows executables and run them in wine, I should be able to get my LinkIt One programmed.

But so far I'm able to run PackTag tool only under wine. I don't under stand how to interface 'PushTool', as it always exits with no output. So from PackTag tool, you will get your .vxp file. Now without PushTool, how to upload the code to LinkIt One??

One of the coolest thing about LinkIt One is your compiled .vxp projects are stored in it's onboard 10MB storage. This means you can connect your LinkIt One as Mass Storage Mode to your PC, copy .vxp file onboard and you must me able to run your app.

In this instructable, I will be describing how to configure arduino to generate .vxp file and then we'll manually copy it to LinkIt One (LIO here after).

Things Required

  1. LinkIt One Development Board
  2. Working Internet Connection
  3. A Linux machine

This method is tested under Ubuntu 14.04 with arduino 1.6.5

Step 1: Installing LinkIt One Packages to Your Arduino

I have created a custom package for LinkIt One tools for linux. You can simply install it to your arduino.

  1. In arduino IDE, goto File -> Preferences
  2. Add the following URL to additional boards as shown in picture :
    https://raw.githubusercontent.com/v-i-s-h/LinkIt-One-Linux-Arduino-Support-/master/package_vish_linkItOne_linux_index.json
  3. Now go to Tools -> Board -> Boards Manager
  4. Scroll down and you will be able to see new Board added as "LinkItOneLinuxArduino" as in picture 2. Install it.

Now you have successfully installed LinkIt One packages in to you machine. If you go to path "

/home/vish/.arduino15/packages" (this in my Ubuntu 14.04), you will be able to see a folder "

LinkItOneLinuxArduino".

Step 2: Modifying Platform Tools to Work in Linux

Now comes a little manual editing. Follow the steps as below

  1. Goto "

    /home/vish/.arduino15/packages/LinkItOneLinuxArduino/tools/linkit_tools/1.1.17" through command line and execute "chmod a+x *.sh". This is required to make the downloaded tools executable.

  2. Replace 'platform.txt' in "

    /home/vish/.arduino15/packages/LinkItOneLinuxArduino/hardware/arm/1.1.17

    " with platform.txt

Step 3: Installing WiNE for Linux

The tools we just installed are actually tools built for Windows. I have modified some script to use them under WiNE in linux. Next step is installing WiNE into your linux distribution.

If you are in ubuntu, you can use synaptic manager/ software center to install WiNE package.

*** UPDATE ***

SeedStudio has published an open source implementation of PackTag few days back. Using that, you don't have to install WiNE and can skip this step. For more, please read

https://www.instructables.com/id/Programming-LinkIt-One-in-Linux-no-WiNE/

Step 4: Compiling Your Sketch

Once you install WiNE you should be able to compile your sketch for LinkIt One.

Make sure that you have selected LinkIt One as your Board in "Tools -> Board".

You can press "Verify" button to start compilation. Your compilation will look like the above picture.

Step 5: Uploading Your Sketch to LinkIt One

By now you have successfully compiled your sketch. To upload, you don't have the option of direct USB upload. Instead follow this procedure.

  1. In Arduino IDE, goto Sketch -> Export compiled Binary. This will again compile your sketch and output a file 'app.vxp' to your sketch folder.
  2. Goto Sketch -> Show Sketch folder to view your folder. There must be a file 'app.vxp' in it.
  3. Now in your LinkIt One change "UART/MS" slider to "MS" position and connect to your PC. It should show as 10 MB Volume (removable drive)as in Picture 1.
  4. Copy 'app.vxp' to 'MRE' folder in your mounted LinkIt One
  5. At the root of LinkIt One drive, you can see 'autostart.txt'. Change the second line to
    App=C:\MRE\app.vxp

as shown in Picture 2. This step is required to be done only once.

Now disconnect LinkIt One from PC, slide the "UART/MS" mode back to 'UART' and power up. It should now run your new sketch.

Here's a video showing the the process.

Hapy Making,

vish

Comments

author
v-i-s-h (author)2015-11-16

Update : there is a method to use PackTag without WiNE.

A python script for PackTag is added by SeedStudio, you can hack platform.txt and tools in folder of PackTag.sh to use this directly. I will soon put an instructable for this also.

Link to PackTag.py :

https://github.com/Seeed-Studio/Lua_for_RePhone/blob/master/tools/packtag.py

author
v-i-s-h (author)v-i-s-h2015-11-16

See this instructable :

https://www.instructables.com/id/Programming-LinkIt-One-in-Linux-no-WiNE/

author
SrdjanK (author)v-i-s-h2015-12-30

Thank you very much! I'm always amazed at how much I can learn thanks to good people like you. I really appreciate it.

author
v-i-s-h (author)SrdjanK2016-01-01

:)

author
AhmadA196 (author)2016-03-29

hi Vish ,can u help me regarding the linkit ONE with Linux?

Here Problem is ,By following all Steps Given By above when i copied the compiled binary code to the linkit ONE board for sensor Grove-LED-Bar to perform Function but not happen any thing.It is performed well when i copy the Blink Prog Code(Blink) LEDs gets ON and OFF at specified delay time(tested).

How can i solve this problem ?

please suggest me.....

author
fowkc (author)2016-02-12

Hi,

I've followed your instructions as I'd really like to get my LinkIt One working under Linux.

Unfortunately when I run a sketch nothing happens. I tried the blink sketch and the LED doesn't flash. I added some Serial.print lines as well, but I can't open the serial ports ( the IDE says "Error opening serial port '/dev/ttyUSB21'. (Port busy)".

Do you know what might be the problem? I've repeated the instructions twice and I'm pretty sure I've got them right.

The board works fine under Windows so I don't think it's a hardware problem.

author
Anton Katsarovp (author)2016-01-04

My Arduino IDE hangs on step 1. When open Board manger it hangs on "Downloading platform index..." and no additional messages. Any ideas why?

author
SrdjanK (author)2015-12-30

Vish, I can't get the port working (ie. the Serial Monitor won't start) under Linux Mint, which is basically a Ubuntu system. Error messages are below. Could you please help? Thank you!

Arduino: 1.6.5 (Linux), Board: "LinkIt ONE"
Error opening serial port '/dev/ttyUSB0'. (Permission denied)
Error opening serial port '/dev/ttyUSB1'. (Permission denied)

author
v-i-s-h (author)SrdjanK2016-01-01

I think problem is with udev rules and user groups.

You have to be in dialout group to be able to access serial port.

Check here for more :

http://forum.arduino.cc/index.php/topic,38409.0.ht...

alternatively you can start srduino IDE as sudo and upload the sketch

author
aldosx (author)2015-11-29

I was also borrowing MS laptop for running linkit one!! This is great news.. Thanks mate!!

author
v-i-s-h (author)aldosx2015-11-29

:)

About This Instructable

3,656views

12favorites

License:

More by v-i-s-h:IoT enabled Solar Power Harnessing (intel IoT)LinkIt One : Adding an ePaper displayLinkIt One Control : The GATT Way
Add instructable to: