Quantcast
Channel: Planet Object Pascal
Viewing all articles
Browse latest Browse all 1725

Jamie's Blog: Starting with the Edison Part 1 Setup

$
0
0

I was recently lucky enough to get a SparkFun starter pack for Intel Edison, which is a set of boards that slot together for the Intel Edison. This post is about getting up and running on the Edison with the initial setup and OS update and in the second, I will go through a very basic home automation project with a Freepascal app running on the Edison. The Intel Edison is a 22nm Intel Development board that includes a dual core, dual threaded Intel Atom CPU at 500MHz and a Quark core, runnning at 100MHz. It has 1Gb RAM, 4Gb eMMC flash storage, plus dual-band WiFi and Bluetooth. What is most amazing about it is the size:

(The Edison board itself is the one of the right)
Spark Fun Intel Edison starter kit

As you can see, the Intel Edison is absolutely tiny. I bought my Edison within the SparkFun starter pack because the Edison by itself is not the easiest to get started with unless you have an extremely good knowledge of electronics and the necessary kit. There seem to be several options for getting started:

As I wanted to develop pure x86 applications on the Edison and wanted a convenient portable power source, I chose the starter pack, which contains a console block for connecting directly to the Edison console via a USB to Serial connection, a GPIO block, and a rechargeable battery block.

In order to get started, you need to slot the Edison into the console block and attach the USB cable. Most starter guides that I found seemed to focus on using the Mini breakout kit so I had to apply different steps than those in most of the tutorials.

The first thing that you’ll want to do is to hook up the console and plug in the USB cable. There is a good guide to setting up the console over on sparkfun, but you will need to install the FTDI drivers as appropriate for your Operating System and install a console such as RealTerm. You should identify the port that your Edison has been connected to as the one which appears when you plug your Edison in and then configure your console application for a baud rate of 115200. One note for RealTerm is that I needed to make sure that it was ready to display as Ansi.

Edison booting via the console

Once connected you can press enter and you should be prompted to log into your Edison as root. There is no password by default, but you can set one at this point should you wish (using the passwd command). I should note that my Edison was shipped with an older version of the Yocto Linux OS, which was slow to react over the console and felt slightly buggy when connecting to the WiFi etc so you will probably want to update the OS at this point.

At this point you can optionally run

configure_edison

and complete the wizard to setup your account and connect to WiFi to make sure that it’s all working. It should be noted that I was initially unable to connect to my Edison whilst the Console cable was connected and I needed to edit /etc/systemd/system/basic.target.wants/network-gadget-init.service and update the IP Address to something further away from my home DHCP block, such as 192.168.99.40 as suggested in an Intel forum thread here.

As most tutorials for updating the OS focussed on the Mini Dev breakout board, I had to search around for inspiration, but eventually found this gist from skvark on github, which I was able to adapt to my needs:

Please note: As with all updates to an OS, these carry a risk. Proceed at your own risk– I take no responsibility for if your board does not update correctly or is damaged irreparably in the process. There are also official guides to flashing your Edison on the Intel community site.

      If you haven’t already, connect the Edison into a local WiFi network with # configure_edison –wifi and check that you can access to the Edison via SSH or with browser.
      On the Edison # cd / to root
      # mkdir update
      # mkfs.vfat -F32 -I /dev/mmcblk0p9 – mmcblk0p9 is the partition which will contain the new FW files, command formats it to FAT32.
      # mount -t vfat /dev/mmcblk0p9 /update/ – mount the partition to the /update)
      Wget the full complete image from the Intel Site (https://communities.intel.com/docs/DOC-23242) directly onto the edison into the /home/root folder.
      # cd /home/root
      # mkdir /home/root/temp
      # unzip update_file.zip -d temp
      # rm update_file.zip
      # mv temp/ota_update.scr /update/ – Apparently ota_update.scr must be first in the folder hence this explicit step.
      # mv temp/* /update/
      # rm -rf temp
      # reboot ota

    These steps are also available as an updated gist here.

    Once I had updated my Edison, I was able to run

    configure_edison

    again and ensure that my edison was setup correctly and was then able to run a few quick tests.

    I used the obligatory Freepascal hello world program together and SCP’d in onto the Edison to check that it all runs smoothly:

    program helloedison;
    begin
      writeln('Hello world.');
    end.
    
    jamiei@jamiei-dev:~/dev/hello-edison$ fpc helloedison.fpr 
    Free Pascal Compiler version 2.4.4-3.1 [2012/01/04] for i386
    Copyright (c) 1993-2010 by Florian Klaempfl
    Target OS: Linux for i386
    Compiling helloedison.fpr
    Linking helloedison
    /usr/bin/ld: warning: link.res contains output sections; did you forget -T?
    4 lines compiled, 0.3 sec 
    
    jamiei@jamiei-dev:~/dev/hello-edison$ file helloedison
    helloedison: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
    
    jamiei@jamiei-dev:~/dev/hello-edison$ scp helloedison root@192.168.1.137:~
    root@192.168.1.137's password: 
    helloedison               100%  121KB 121.3KB/s   00:00   
                                                                                                   
    jamiei@jamiei-dev:~/dev/hello-edison$ ssh root@192.169.1.137
    
    root@jamiei_edison:~# ./helloedison 
    Hello world.
    

    That should have you ready to develop on your Intel Edison. As your Edison is x86 based, you can use whatever language you wish to run on it, including Python, Freepascal, Google Go, Node.js and JVM based languages such as Java or Clojure if you install the JVM.

    In the next part, I looked to create a small application to take advantage of the bluetooth connection on my Edison and to do some basic home automation with Freepascal.

    Further Reading


    Viewing all articles
    Browse latest Browse all 1725

    Trending Articles