Autore: mhm

edison: Configure Intel Edison for Bluetooth LE (Smart) Development

http://rexstjohn.com/configure-intel-edison-for-bluetooth-le-smart-development/

Configure Intel Edison for Bluetooth LE (Smart) Development – Rex St John | 雷克斯 聖約翰
http://rexstjohn.com/wp-content/themes/omega/js/html5.js

Configure Intel Edison for Bluetooth LE (Smart) Development

Thanks to Fab-Lab.eu for compiling this awesome reference in the Intel community forum.

Note: There is a known issue with “bluetoothd” creating it’s own GATT server automatically and blocking Bleno from doing this on Edison. The solution is to kill it or disable it permanently. Otherwise, you will see the service advertised but it will disconnect before you can read any data.

Assuming you have a current Intel Edison (this guide may be subject to change if new updates are released), perform the following steps:

  • Plug both your Micro-USB cables into Edison (which has been snapped into a large Arduino break-out board)
  • Open terminal and type: “screen /dev/cu.(TAB to autocomplete your Edison port name) 115200 -L” as per the Intel guides


Now lets turn on BLE (again, quoted from Fab-Lab.eu’s guide linked above):


rfkill unblock bluetooth
hciconfig hci0 up

vi /etc/opkg/base-feeds.conf (insert only following lines)
src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32

Note: “vi” is a barebones text editor which has some confusing syntax. Copy and paste (e.g. vi’s insert mode) the above three lines into the .conf file indicated and then close vi by hitting “Shift + :” (to leave Insert mode) after making the above edit and then typing “wq” and hitting enter to write the change and then quit.

Before we proceed, make sure your Edison is online via Wi-Fi.

Now run:

opkg update
opkg install bluez5-dev

Next, we will install Bleno and Noble, useful Node.js utilities for doing fun stuff with BLE and Javascript:

npm install -g async
npm install noble
npm install bleno

The key to getting Bleno working seems to be this (see the bug linked above):

rfkill unblock bluetooth
killall bluetoothd (or, more permanently) systemctl disable bluetooth
hciconfig hci0 up 

Once this is done, you should be able to use Edison with Bluetooth LE.

:)

Annunci

edison: getting started guide

https://learn.sparkfun.com/tutorials/edison-getting-started-guide

Edison Getting Started Guide

CONTRIBUTORS: JIMB0, HELLOTECHIE

FAVORITE9

Meet the Edison

The Edison is the powerful new computing module from Intel®. It’s tiny enough to embed into wearable projects, versatile enough to manage internet-of-things applications, and powerful enough to control robotics platforms.

The Edison packs a host of features, including WiFi (802.11a/b/g/n), Bluetooth (4.0 and 2.1 EDR), UARTs, I2C, SPI, USB, and 40 GPIO. It’s driven by a 32-bit Intel® Atom™ Processor clocked at 500MHz, supported by 1GB of LPDDR3 RAM and 4GB eMMC flash memory. To top it off, it’s housed in a tiny, 35.5 x 25.0 x 3.9 mm module.

Edison iso

Top view of the Edison. The guts are covered in an RF shield. You can also see the an antenna for WiFi/Bluetooth and a u.FL connector for attaching an external antenna.

Needless to say, the Edison is a powerful, little electronics brain. It has the power to change how we all think about embedded computing. The module is equipped with a Linux OS based on Yocto, so you can compile C/C++ files, or run Python, Node.js, and other scripts.

Interfacing With the Edison

To keep the platform small, all of the I/O pins are broken out to a 70-pin Hirose DF40C connector. These fine-pitch connectors are great for keeping things small, but can be difficult to interface with. They’re board-to-board connectors, so to interface the Edison with other components you’ll need a board with a mating Hirose connector.

Currently, the mating boards available include a whole host of SparkFun Edison Blocks, the Arduino Expansion Board, and the Mini Breakout.

The Edison Blocks which (among many other boards) include the Base Block, Console Block, Console Basic Block, and Battery Block are a great way to customize your Edison project, while maintaining the minuscule form factor. Learn more about the Blocks and how they interconnect by reading our General Guide to SparkFun Blocks for Intel Edison

The Arduino board is a great place to start, if this is your first foray into the Edison or embedded computing.

Edison Arduino Expansion Board

The Mini Breakout, like the SparkFun Blocks, is useful if you want to embed the Edison into a project. It includes an FTDI for interacting with the console, and it also breaks out the Edison’s USB-OTG port and a number of I/O pins.

Edison breakout

Once you have the Edison plugged into a power and console source, you can interact with the on-board Linux kernel and start developing!

Covered In This Tutorial

This tutorial is focused on getting you ready to develop on the Edison. We’ll walk you through everything from handling and powering the Edison to getting a console loaded up and connecting it to WiFi. We’ll also cover how to program the Edison through the comfy confines of Arduino.

The tutorial is split into the following sections:

  • Download Drivers and Arduino – A plethora of links to get your computer ready for Edison development.
  • Plugging In – What to expect and what to look for the first time you plug the Edison into your computer.
  • Programming the Edison in Arduino – An introduction to developing on the Edison through Arduino.
  • Setting Up the Console – How to use the Edison’s console port to interact with the Linux kernel.
  • Updating the Firmware – As soon as you can, we recommend updating the Edison to use the latest version of its Yocto Linux distribution.
  • Connecting to WiFi – The updated firmware image includes a tool that makes setting up WiFi on the Edison easy-breezy.
  • SSH-ing Into the Edison – Take advantage of the Edison’s WiFi capabilities by SSH-ing into it, and developing remotely.

What You’ll Need

  • Intel® Edison – Kind of goes without saying.
  • Base Board – Something to supply power and provide a console interface. One of the following should do:
    • SparkFun Base Block – This block is equipped with two USB connectors, which provide access to the Edison’s OTG port and UART console. This block allows everything from upgrading the firmware, and programming via Arduino, to interacting with the Linux terminal.
    • Edison Mini Breakout – This is a simple breakout for the Edison. It provides power over USB, as well as a console. A second USB connector provides you with access to the Edison’s USB OTG interface. The Edison is included with this kit!
    • Arduino Expansion Board – A bigger Edison base board, with headers broken out to the familiar Arduino footprint. If you plan to use the Edison with the Arduino IDE, this is the board you’ll want to use. It also includes an Edison!
    • SparkFun Console Block – This block is similar to the Base block, but removes the OTG USB port. This block only provides console access, you won’t be able to use it for firmware upgrade or Arduino programming.

Beyond that, you may also need to gather:

  • Micro-B USB Cable(s) – Every board above can be powered and controlled over USB, and they all use at least one micro-B USB connector. For every board except the Console, you’ll actually need two micro-B cables, in order to get the most out of your Edison.
  • Power Supply – This will depend on which base board you’re using. If you’re using an Arduino Expansion Board a 7-15V wall adapter may be required in addition to the USB cable. Our 9V Wall Adapter should do the trick.
  • A computer with two available USB slots, or a hub. To upgrade the Edison’s firmware, you’ll need access to both its OTG and debug ports.

Edison development set up

That should be enough to get started developing on the Edison!

Suggested Reading

  • Serial Terminal Basics – We’ll be working with the serial terminal a lot in this tutorial. If you don’t already have a reliable terminal emulator program installed on your computer, check out this tutorial to find one you like!
  • Galileo Hookup Guide – The Galileo board works as a nice introduction to the Edison. They both run a very similar, Yocto-based Linux kernel. If you’re unfamiliar with the Galileo, or Intel processors in general, this might be a useful tutorial to check out.

Download Drivers and Arduino

Before you start plugging things in and blinking LEDs, make sure your development computer has everything it needs to work with the Edison.

The Edison is designed to work with any operating system: Windows, Mac or Linux. There are separate drivers and software for each, though, so make sure you grab the software that matches your OS.

Download Arduino

Because the Edison runs Linux and has GCC, Python, Node.js, etc., you can use a wide assortment of tools to develop on it. But, if you’re just getting started with embedded development, Arduino may be the easiest place to begin.

Using Arduino to develop on the Edison requires a custom version of the IDE. You can grab the latest version of the Arduino for Edison software by clicking the button below.

DOWNLOAD ARDUINO FOR EDISON

There are a variety of downloads on that page, make sure you get the “Arduino Software 1.5.3 – Intel 1.0.4” (latest as of December 2014), and make sure you grab the version that matches your OS.

On a Mac, after downloading and unzipping the application, we recommend renaming the “Arduino” app to something like “Arduino Edison”. You may also want to move the app to your Applications folder.

Rename the Edison Arduino application

Likewise, Windows users with multiple Arduino installs should rename any shortcuts or folders to differentiate the Arduino for Edison application from the normal Arduino. This version of Arduino will not work with other, non-Intel Arduino boards.

Download and Install the FTDI Drivers (Windows and Mac)

Most Edison base boards, including the Arduino Breakout, Mini Breakout, and our Base/Console Blocks are equipped with an FTDI chip that converts USB to serial, which allows for easy access to the Edison’s UART console. To use the FTDI, download the latest VCP drivers from their downloads page.

DOWNLOAD THE FTDI DRIVERS

If you need help installing the drivers, check out our How to Install FTDI Drivers tutorial.

Download and Install the Edison Drivers (Windows Only)

If your using a Windows machine to interact with your Edison, you’ll need to install drivers plural: an FTDI driver for the console and an Edison-specific driver for the Edison’s on-chip USB. The latter can be downloaded on the same Edison – Software Downloads page you were on earlier, towards the bottom of the page. Look for the “Windows Driver setup 1.0.0” link.

DOWNLOAD THE WINDOWS EDISON DRIVER

After you download this executable, run it and follow along with the install wizard to set your computer up with the drivers.

Windows driver install process

It may take a couple minutes to complete the driver installation. You should be notified that the drivers installed successfully once the process has completed.

Plugging In

Now that the drivers are installed, it’s safe to plug the Edison into your base board, and on into your computer.

Plugging the Edison Into the Base Board

Let’s start by plugging the Edison into your base board, whatever that may be. Keep in mind that the Edison’s Hirose connectors are very delicate. When plugging your Edison into a base board, take care to push straight down, applying even pressure to the connector and the left corner of the Edison.

Plugging in Edison

If you need to remove the Edison, be equally gentile and apply even pressure.

Connecting and Powering via USB

Once the Edison is cleanly seated into your base board, wire up the USB port(s) to your computer. If your base board has two USB ports, it’s recommended that you connect both up to your computer – one port provides power and direct USB access, while the other connects to the Edison’s console.

If you’re using Intel’s Arduino Expansion Board or the Mini Breakout, make sure you have at least connected USB to the Edison’s USB OTG port. That is the only port that can power the Edison.

USB OTG Ports

If you’re using a SparkFun Base Block, you can use either USB port to power the Edison. For the next step (programming an Arduino sketch), we recommend using the Edison’s OTG USB port. The two connectors are labeled on-board, so it should be easy to pick out which is which.

After plugging the Edison’s OTG port into your computer, there are a couple indicators that it’s ready to use. First, look for a power indicator LED on the base board to illuminate. Beyond that, after about 30 seconds, the Edison will show up as three different devices on your computer:

  1. USB Mass Storage device with around 800MB of storage space.
  2. Intel Edison Virtual Com Port, which you may be used to from the Arduino world. The port it enumerates on will be what we’ll upload our code to.
  3. Intel Edison USB RNDIS Device, a network adapter which allows your Edison to connect to the Internet through USB, using your computer as a gateway.

The removable storage device called “Edison” is the best indicator that it’s working.

Edison shows up as a removable drive

This is a great sign! It means the Edison has booted up, enumerated over USB, and is ready to be programmed.

Windows users plugging their Edison in for the first time may have to wait an extra minute or so while drivers are set up. Once that’s complete, you should be notified with a handy window like this, which also passes along important information about the Edison’s COM port assignment.

Edison driver set up on Windows

Don’t forget the COM port, or, if you didn’t get the notification, check for the Edison’s COM port assignment in your device manager.

Programming the Edison in Arduino

With a built-in C-compiler, Python, Node.js, and more, the Edison is capable of amazing things. As you’ll discover in later Edison tutorials, we really recommend exploring the Edison’s full capabilities by writing your applications in C, C++, Python, or anything that takes full advantage of the Edisons capabilities.

That said, using Arduino to program the Edison is a great way to start developing on the mini-computer in a safe and familiar environment. In this section, we’ll examine how to program the Edison in Arduino, cover some common troubleshooting, and point out some useful examples to help get you started.

Note 1: This section requires a base block with a USB OTG port – that means you won’t be able to use the Arduino IDE with the Console Block. If that’s all you have, skip ahead to the Setting Up the Console section.

Note 2: if you’re using the Arduino Expansion Board, make sure the switch labeled “SW1” (between the micro-B USB port and the larger host USB port) is slid in the direction of the nearby micro-B port. That will switch that port into device mode.

Uploading Blink

By now you should have the Edison powered and plugged into your computer (connecting the Edison’s OTG USB port to your computer), drivers set up, and Arduino for Edison software installed. If not, refer back to the previous sections of this tutorial.

Open up the Edison-specific Arduino software. This software is nearly indistinguishable from other Arduino builds. To make sure you’re using the right version, go up to the Tools > Board menu and select Intel® Edison.

Selecting the board

You may also notice the entires for the Intel® Galileo, and a distinct lack of any other Arduino board in the list – this software only works with Intel’s boards.

Next, select your serial port by going to Tools > Serial Port and select the COM port number that matches your new Edison.

Selecting the serial port

On Windows the serial port will come in the form of “COM#”. On Macs there will be two entries in the list for your Edison, make sure you select the one that looks something like “/dev/cu.xxxxxx” (cu not tty).

Finally open Blink by going to File > Examples > 01.Basics > Blink. And click the Upload icon.

After the compile, the code should quickly upload over to the Edison. Look for a “Transfer Complete” notification in the console window below.

Transfer complete

Don’t fret if you get an upload error! We’ve gotten a lot of them too. For most problems, there’s usually no-better a fix than the old restart. This interface can be finicky, if you get an upload error try unplugging the Edison then plugging it back in and trying again. If that doesn’t help, consider checking out Intel’s Edison forum.

Handy Examples

We’ve loaded up the blink example, but on many boards the Edison doesn’t even have an LED to blink. Here are some other handy examples that prove the Edison is working, and provide some insight into how the Edison’s Arduino interface works.

Serial

As always, the Arduino serial monitor is a handy debugging tool. Give some of the examples in the File > Examples > 04.Communication folder a try, or load up something simple like this:

COPY CODE
void setup() 
{
  Serial.begin(9600);
}

void loop() 
{
  if (Serial.available())
  {
    Serial.print("Decimal value: ");
    Serial.print(Serial.read());
    Serial.println();
  }  
}

Then open up the serial monitor and interact with your Edison!

WiFi

WiFi is one of the most important features embedded into the Edison, and it’s supported in the Arduino IDE by an updated WiFi library.

Try loading up any of the examples in the File > Examples > WiFi folder – the “WiFiWebClient” example is a good one. You’ll probably have to update the SSID and passkey before uploading.

Setting Up the Console

After you’ve checked out the Arduino side of the Edison, a great place to start learning about its more unique features is by interacting with the console. The console provides access to the Linux environment. You can use it to connect your Edison to a WiFi network, to write C++ programs with the vi editor, or run Python scripts.

Connecting to the FTDI Port

The Arduino Expansion Board, Edison Mini Breakout, and the SparkFun Console Blocks all route the console UART out through an FTDI chip, which converts serial to USB.

If you haven’t already, plug your Edison into the base board and power your base board (in most cases by hooking up the USB OTG port). Then connect the base board’s debug port to your computer via a USB cable. Each of these boards have two micro-B USB ports, make sure you plug into the correct one!

Make sure you have the FTDI drivers installed. If you need any help, check out our How to Install FTDI Drivers tutorial.

Opening Up a Serial Terminal Emulator

The next step is to open up your favorite terminal emulator software on your computer. If you don’t have a favorite, check out our Serial Terminal Basics tutorial.

Make sure the new COM port for your base board is correctly set. You’ll also need to set the baud rate to 115200bps (8-N-1).

Console settings

After you’ve opened up the serial port, try hitting enter a couple times. If all goes well, the Edison should respond with a login prompt.

The default Edison login is root. There is no password…yet. You can run passwd, if you want to set one now, but it will be wiped out when/if you update the firmware image.

Updating the Firmware Image

Most Edison’s ship with an older version of the firmware. Updating to the latest version of the firmware equips the Edison with a whole host of new utilities, including a WiFi configuration tool and a fix to that annoying 5-second sleep in the terminal.

This step requires access to both the Edison’s OTG USB port and the console. That means you’ll need two USB cables, connected to two ports on your computer (or a hub).

Edison with both cables connected

The OTG port will give us access to the Edison’s USB mass storage device.

You can either update firmware with the Intel Installer or the manual way.

Using the Intel Installer

Intel is continuing to improve the Edison support. Now, there is an Installer to make updating your firmware a breeze. There is an option to install the Arduino IDE too. Head over to the Edison Getting Started Guide on the Intel Developer Zone site. If you already assembled your board, jump to “Step 2: Choose your Operating System”. Pick your operating system and download the Installer.

Pick your OS with the Intel Edison Installer

Open up the Installer. You will be asked to install as administrator. Follow through the rest of the steps and you are good to go! Next step will be to set up a serial terminal and connect to WiFi.

Intel Edison Installer Completed

Manually Updating the Firmware

We’ll begin by downloading the latest and greatest version of the Edison firmware, grab it from the Edison Software Downloads page.

DOWNLOAD THE EDISON YOCTO COMPLETE IMAGE

Download the “Edison Yocto complete image” ZIP – it’s about 100 MB. Then unzip the archive, and keep the extracted contents up somewhere handy.

Out With the Old

Before you load the new firmware onto the Edison, make sure all of the old stuff is out of the way. Use your terminal (Mac) or CMD (Windows), and navigate to the top level of your Edison’s mass storage drive.

On Mac, type cd /Volumes/Edison. On Windows type E: – replacing “E” with the drive letter of your Edison.

Once inside the folder, type rm -rf * and rm -rf \.* to remove all of the files – hidden or not – from the drive.

In With the New

Next, open up the Edison mass storage drive in your file explorer. Then move everything from within the extracted ZIP folder into the drive. It should look a little something like this:

Contents ready to flash on drive

Notice that there are an assortment of bin’s and other files at the top level of the drive, not within a folder within the top level.

Issuing the Update Command

Finally, begin the update by opening your Edison’s console and entering this command: reboot ota.

The Edison will shut down, then, as it begins to reboot, it will notice there’s a flash update in the mass storage device and begin to install the update. The update will take a minute-or-so to install, and the Edison will reboot one last time.

When the Edison comes back up, log in as root and take comfort in knowing your Edison is running the latest and greatest version of the Edison Yocto image.

Connecting to WiFi

The latest version of the Edison firmware includes a handy utility to set up WiFi – configure_edison --setup. Type that into your Edison’s console, then follow the in-terminal directions as you can edit the Edison’s name and WiFi settings.

First give your Edison a unique name:

Naming the Edison

Then, if you so desire, assign a password to your root user:

Passwording the Edison

Finally we get to the reason we’re here. Type ‘Y’ to jump into the WiFi setup utility. The Edison will scan for nearby wireless networks, after a few seconds it will list the results.

Scanning for networks

Type a number to pick an SSID, then enter your passkey and wait for it to (try to) connect.

Connected to a network

The last line of the configure utility will prompt you to open your browser and point to the Edison’s local IP.

Device information page

You won’t glean a lot of information from this page, but it will provide some assurance that your Edison is on the WiFi network. Plus, just think of all the fun you can have with a tiny little credit card-sized computer that can serve up web pages like this!

You can use the console for other network-related stuff now, too. Try pinging your favorite web site with a command like ping sparkfun.com -c 4. Or check your network status with a command like ifconfig or ifconfig wlan0.

Now that your Edison’s on the WiFi network, you can do all sorts of cool stuff. How about SSH-ing into it, so you can remotely interact with little computer’s file structure?

SSH-ing into the Edison

If you’ve gotten this far, you may begin to realize that interacting with your Edison via the command line may get a bit tiresome. Luckily, now that you have WiFi set up, you can (figuratively literally) cut the cord and control your Edison through the network using SSH (Secure Shell). You can even download and upload files to the Edison over SFTP (SSH file transfer protocol).

In order to SSH into your Edison, you’ll probably another piece of software installed on your computer. We like WinSCP for Windows machines and Cyberduck on the Mac.

Using WinSCP (Windows)

When you open WinSCP, it’ll ask you where and how you’d like to log in. Make sure “File Protocol” is set to “SFTP”. Then, in the “Host name” text box, type the IP address of your Edison. For the “User name” and “Password” boxes, type “root” and the password you set (or leave it blank if you skipped that part).

WinSCP SSH example

(Personal frustration note: if you’re having trouble SSH-ing into your Edison, you may need to turn off your Windows Firewall. Hopefully you don’t have to ram your head against that wall for too long. Active VPN’s may also get in the way!)

Once you click “Login”, the program will attempt to remotely log in to your Edison. If it’s successful, you’ll be greeted with a file browser. These are the actual files living on your Edison! You can use this browser to upload or download files. This is a great utility if you’re developing programs to be run on the Edison, your only other option is monochrome vi in the terminal (which would be pretty hardcore).

WinSCP also includes a utility for interacting with the remote host via a terminal. Go to “Commands” > “Open Terminal” and you’ll be right back to the console.

Using Cyberduck (Mac)

It’ll be the same idea in Cyberduck. Type your Edison’s IP address into the “Server” box. Then type “root” as the “Username” and your password if you set one. Then hit “Connect.”

Cyberduck example

Like WinSCP, Cyberduck will present you with a file explorer. This will allow for an easy, graphical interace for managing your Edison’s files.

If you’d like to interact with the console remotely, open up your Mac’s terminal application. Then type ssh root@10.0.0.20, making sure to sub in your Edison’s IP address. When/if prompted for a password, type that in, then you’re back to the Edison console.

Resources and Going Further

Now that you’ve got an Edison connected to the web, what’s next? Need some inspiration? Check out these tutorials

SparkFun Blocks for Intel® Edison – Battery Block

A quick overview of the features of the Battery Block.

SparkFun Blocks for Intel® Edison – Console Block

A quick overview of the features of the Console Block.

General Guide to SparkFun Blocks for Intel® Edison

A general guide for using SparkFun Blocks for Intel® Edison in your next project!

Loading Debian (Ubilinux) on the Edison

How to load a Debian distribution (specifically Ubilinux) onto the Edison.

SparkFun Inventor’s Kit for Edison Experiment Guide

Learn how to harness the power of the Intel® Edison using JavaScript to post data to the cloud, control electronics from smartphones, and host web pages that interact with circuits.

 

UP BOARDS – Intel® Atom™ x5

UP board 2GB + 16 GB eMMC memory

DATA SHEET

SoC Intel® Atom™ x5 Z8350 Processor 64 bit – up to 1.92GHz
Graphics Intel® HD 400 Graphics ,12 EU GEN 8, up to 500MHz Support DX*11.1/12, Open GL*4.2, Open CL*1.2 OGL ES3.0, H.264, HEVC(decode), VP8
System memory 2GB DDR3L
Storage capacity 16GB eMMC
USB2.0 external connector x4
USB2.0 port (pin header) x2
USB 3.0 port x1 ( OTG)
Ethernet 1x Gb Ethernet (full speed) RJ-45
Video output HDMI
Display interface DSI / eDP
Camera Interface MIPI-CSI
Power input 5V DC-in @ 3A 5.5/2.1mm jack
RTC YES
PXE NO
WOL YES
Operating humidity 10%~80%RH non-condensing
Operating tempature 32-140°F / 0~60°C
Expansion 40 pin General Purpose bus, supported by Altera Max V. ADC 8-bit@188ksos
Compatible operating system Microsoft Windows 10 full version , Linux (ubilinux, Ubuntu, Yocto) • Android Mashmallow
Certificate CE/FCC Class A, RoHS complaint Microsoft Azure certified
Dimension 3.37″ x 2.22″ / 85.60 mm × 56.5 mm
Weight 88 gram
CEC No

MORE INFO

UP unleashes the power of the Intel x5-Z8350 QuadCore 1.44Ghz (1.92GHz) 64 bit 2W SDP CPU.

The 40 Pin I/O connector, the USB 3.0 OTG, the Gigabit Ethernet, the HDMI and more other features make it a perfect solution for different domains and products like Robotics, Drone, Machine Vision, Smart Home, Education, Digital Signage, Intelligent Cars, Internet Of Things. The compatibility with Linux, Android, and all the Windows 10 distributions give you great flexibility, scalability and quick time to market.

Offered is one UP board,featuring with X5-Z8350 CPU with 16GB eMMC & 2GB RAM on board.

Box contents:
– UP board
– Heatsink
– RTC battery

Edison: USB Gadget Mass Storage image location

USB Gadget Mass Storage image location

Questa domanda è ora Con risposta.

acamiloGreen Belt

When i plug the edison into my PC it mounts as a mass storage device. Where is the image that it mounts located in the edison’s file-system.

David_J_Hunt

Risposta esattada David_J_Hunt il 30-set-2014 6.31

Here’s how to get at the storage in the msdos partition.

 

log into your Edison board over serial console or Wifi. If you’re ssh-ing in over gadget rndis, you’ll lose the connection because you have to unload the multifunction gadget. Here’s the commands to make it available on your edison:

 

rmmod g_multi

mkdir /update

losetup -o 8192 /dev/loop0 /dev/disk/by-partlabel/update

mount /dev/loop0 /update

 

You  can now see the contents of the msdos partition in /update. And is writable, so you can put files in there.

 

To reverse this, and make it available on your host machine:

cd /

umount /update

modprobe g_multi

then pull the usb cable and re-insert it, at which stage the disk should re-appear on your host machine.

 

The reason for this is that you can’t have two machines being the ‘master’ of the same partition at the same time, so you need to switch the owner. If it was NFS or Samba, the NFS or Samba process would always be in control. This case is different, as the g_multi driver allows the remote PC become the master, and cannot allow the Edison to also be writing to the disk at the same time.

 

Rgds,

Dave.

Valutazione utenti media: 3.75 di 5 (4 Valutazioni)

Valutazione utenti media
Valutazione media utente: 3.75 di 5
(4 Valutazioni)
  • 1. Re: USB Gadget Mass Storage image location
    AnthonyWebbGreen Belt

    +1 for better documentation of this.  I put a file on my edison and dont know where to find it now.

  • Risposta esatta2. Re: USB Gadget Mass Storage image location
    David_J_HuntBrown Belt

    Here’s how to get at the storage in the msdos partition.

     

    log into your Edison board over serial console or Wifi. If you’re ssh-ing in over gadget rndis, you’ll lose the connection because you have to unload the multifunction gadget. Here’s the commands to make it available on your edison:

     

    rmmod g_multi

    mkdir /update

    losetup -o 8192 /dev/loop0 /dev/disk/by-partlabel/update

    mount /dev/loop0 /update

     

    You  can now see the contents of the msdos partition in /update. And is writable, so you can put files in there.

     

    To reverse this, and make it available on your host machine:

    cd /

    umount /update

    modprobe g_multi

    then pull the usb cable and re-insert it, at which stage the disk should re-appear on your host machine.

     

    The reason for this is that you can’t have two machines being the ‘master’ of the same partition at the same time, so you need to switch the owner. If it was NFS or Samba, the NFS or Samba process would always be in control. This case is different, as the g_multi driver allows the remote PC become the master, and cannot allow the Edison to also be writing to the disk at the same time.

     

    Rgds,

    Dave.

  • 3. Re: USB Gadget Mass Storage image location
    mikemoyGreen Belt

    The first part worked for me.

    rmmod g_multi

    mkdir /update

    losetup -o 8192 /dev/loop0 /dev/disk/by-partlabel/update

    mount /dev/loop0 /update

     

    But when i tried the second part i get an error using umount /update, which said

    root@edison:/# umount /update

    umount: can’t umount /update: Invalid argument

  • 4. Re: USB Gadget Mass Storage image location
    mhahnBrown Belt

    alternatively mount with an offset parameter of 8192

  • 5. Re: USB Gadget Mass Storage image location
    scottepetersonGreen Belt

    This solution looks good but there is a great summary here: Getting your code onto the Intel Edison · GitHub  .  (links back here – but I was successful with much simpler method listed in this Gist).

     

    just:

    root@edison:~#mkdir flash
    root@edison:~#mount -o offset=8192 /dev/mmcblk0p9 flash

  • 6. Re: USB Gadget Mass Storage image location
    partialdataGreen Belt

    Screen Shot 2015-10-13 at 12.04.25 PM.png

    I have tried a few times on OSX and I just tried on Ubuntu 14.04 to get these commands to work to mount the mass storage on the edison … All i want to do is update node js to the latest version.

Edison Ostro Os

https://ostroproject.org/documentation/howtos/booting-and-installation.html

Booting and Installing an Ostro™ OS Image

This technical note explains the basic procedures for taking an Ostro OS image that was downloaded or built from source (using instructions in Building Ostro™ OS Images), and installing and running that image one of the Ostro™ OS Supported Platforms.

Two images are of interest for this process (depending if you’re using real hardware or a VM):

.dsk.xz
A compressed raw disk image in GPT format and contains at least one UEFI bootable partition and at least one ext4 partition (rootfs). For details on disk layout see the associated .json file in the same directory as the image file.
.dsk.ova
A pre-packaged Open Virtualization Archive (OVA file) containing a compressed, “installable” version of a virtual machine appropriate for virtualization applications such as Oracle VirtualBox*

Ostro OS Images

As explained in the Building Ostro™ OS Images tech note, there are several image configurations available depending on your need. For simplicity and the needs of this tech note, we’ll use the reference image that includes additional configuration changes that wouldn’t typically be included in a production device image. This reference image will auto-login as root at the console, something that normally would not be available in a production device image but is quite useful during development.

Note

Both the bmaptool and dd methods for creating bootable media described next, work only for EFI platforms using the .dsk image format (intel-corei7-64 and intel-quark MACHINEs). The non-EFI platforms edison and beaglebone MACHINEs use different image formats and flashing processes, as described later in this tech note.

Using bmaptool to Create Bootable Media

Once you have the .dsk.xz Ostro OS image you need to get it onto your hardware platform, typically by using removable media such as a USB thumb drive or SD card.

The recommended way to do this is with the bmaptool command from bmap-tools. A copy of this utility is available in the deploy/tools folder after a Yocto Project build for your image is finished.

The bmaptool program automatically handles copying either compressed or uncompressed dsk images to your removable media. It also also uses a generated image.bmap file containing a checksum for itself and for all mapped data regions in the image file, making it possible to verify data integrity of the downloaded image. Be sure to download this .bmap file along with the image for your device.

  1. Connect your USB thumb drive or SD card to your Linux-based development system (minimum 4 GB card required, for some images 8 GB card might be required).

  2. If you’re not sure about your media device name, use the dmesg command to view the system log and see which device the USB thumb drive or SD card was assigned (e.g. /dev/sdb):

    $ dmesg
    

    or you can use the lsblk command to show the block-level devices; a USB drive usually shows up as /sdb or /sdc (almost never as /sda) and an SD card would usually show up as /dev/mmcblk0.

    Note: You should specify the whole device you’re writing to with bmaptool: (e.g., /dev/sdb or /dev/mmcblk0) and not just a partition on that device (e.g., /dev/sdb1 or /dev/mmcblk0p1) on that device.

  3. The bmaptool command will overwrite all content on the device so be careful specifying the correct media device. The bmaptool opens the removable media exclusively and helps prevent writing on an unintended device. After verifying your removable media device name, you’ll need to umount the device before writing to it.

    In the example below, /dev/sdb is the destination USB device on our development machine:

    $ sudo umount /dev/sdb*
    $ sudo -E bmaptool copy <ostro-os-image> /dev/sdb
    

Note

The bmaptool is intelligent enough to recognize images in different formats, including compressed images (.gz, .bz2, .xz) as well as flashing directly from remote URL (for example, you could specify the image source file with anhttp:// address instead of downloading it first; bmaptool will automatically retrieve the .bmap file). The sudo -Eoption will propagate environment variables (such as http_proxy) that bmaptool might need to access the website.

Unplug the removable media from your development system and you’re ready to plug it into your target system.

Using dd to Create Bootable Media

While using bmaptool to create your bootable media is preferred because it’s faster and includes a checksum verification, you can also use the traditional dd command instead :

  1. Connect your USB thumb drive or SD card to your Linux-based development system (minimum 8 GB card required).

  2. If you’re not sure about your media device name, use the dmesg command to view the system log and see which device the USB thumb drive or SD card was assigned (e.g. /dev/sdb):

    $ dmesg
    

    or you can use the lsblk command to show the block-level devices; a USB drive usually shows up as /sdb or /sdc (almost never as /sda) and an SD card would usually show up as /dev/mmcblk0.

    Note: You should specify the whole device you’re writing to with dd: (e.g., /dev/sdb or /dev/mmcblk0) and not just a partition on that device (e.g., /dev/sdb1 or /dev/mmcblk0p1) on that device.

  3. The dd command will overwrite all content on the device so be careful specifying the correct media device. In the example below, /dev/sdb is the destination USB device on our development machine:

    $ sudo umount /dev/sdb*
    $ xzcat <ostro-os-image.dsk.xz> | sudo dd of=/dev/sdb bs=512k
    $ sync
    

Unplug the removable media from your development system and you’re ready to plug it into your target system.

Installing to internal media on generic x86 EFI platforms

This section applies to those cases where the device is x86 compatible (ex: Gigabyte NUC). The simpler way is to follow these steps:

  1. Create a Bootable Media using both an image that is compatible with the device and a supported removable media (SD card or USB stick).

  2. Boot the device with the removable media created at the previous step.

  3. Once the device is booted, identify the booted media, for example by executing:

    # mount
    

    and locating in its output which partition is mounted on /. This will be a partition belonging to the source block device. Example:

    /dev/sdb3 on / type ext4 (rw,realtime,i_version,data=ordered)
    

    Shows that the root partition is on /dev/sdb3, therefore the source block device will be /dev/sdb.

  4. Identify the block device representing the internal storage. This part is really specific to each platfrom: typically the internal storage is associated to /dev/sda for hard disks and SSD units and to /dev/mmcblk0 for eMMC devices, but it should be confirmed against the board manual or the BIOS, if it provides such type of information. Lacking that, one can run:

    # lsblk
    

    and try to interpret its output, to figure out which device represents the internal storage.

  5. Issue the dd command with the parameters identified in the last 2 points. Example with internal storage as eMMC on /dev/mmcblk0 and removable media as USB stick on /dev/sda:

    # dd if=/dev/sda of=/dev/mmcblk0 bs=5M && sync
    
  6. When the command has terminated, poweroff the device, extract the removable media and power it back on. This should be sufficient to have the unit now using the internal storage.

Note

Make sure that the device is configured to perform EFI boot and that the BIOS doesn’t require signed EFI applications. To speed up the process, select the internal sotrage as primary boot device.

Removing Ostro OS from internal media

Ostro OS uses GID for identifying the rootfs and the GID is kept consistent across all the images produced. This means that trying to boot a system with 2 Ostro OS images available at the same time will likely produce unwanted/undetermined results. Before trying again to boot from a removable media, the internal media should be wiped. To achieve this:

  1. Boot from the internal media.

  2. Identify the root block device containing the rootfs partition.

  3. Wipe a sufficient part of that block device to make it unbootable.

    In practice it means wiping the primary GPT and at least the beginning of both partitions that might be EFI-bootable. In an unmodified Ostro disk layout, this means the first 2 partitions, which are 15MB each. 20 MB would be sufficient to cover the beginning of the disk, the first partition and the beginning of the second. 30MB will wipe even the beginning of the rootfs. Example with rootfs on /dev/sda3:

    # dd if=/dev/zero of=/dev/sda bs=5M count=6 && sync
    
  4. Poweroff the device (ignore possible ext4 error messages).

  5. Insert the removable media with the new Ostro OS image and power on.

MinnowBoard Turbot – a MinnowBoard MAX Compatible

The MinnowBoard Turbot is a small form-factor board with an Intel® Atom™ E3826 dual-core processor. Once you have the Ostro OS image on a USB thumb drive (or SD card), you can use this to boot your MinnowBoard MAX compatible board as you would most any Intel UEFI-based system. The procedure will be similar for other boards so we’ll use this as an example. See http://wiki.minnowboard.org for additional information about setting up the MinnowBoard hardware.

Note

It’s important to use a current version of firmware on your board, so we recommend checking this first and updating the firmware if needed using the instructions at http://wiki.minnowboard.org/MinnowBoard_MAX_HW_Setup. Ostro OS releases are built and tested with 64-bit support, so you should make sure that the firmware is also setup for 64-bit support.

Here are the basic steps for booting the Ostro OS:

  1. Connect an HDMI monitor, USB keyboard, and network cable. Alternatively you can connect the serial FTDI cable from the MinnowBoard to a USB port on your host computer and use a terminal emulator to communicate with the MinnowBoard.)
  2. Plug in the USB thumb drive with your Ostro OS image to your MinnowBoard
  3. Power the board on
  4. Wait for the system to enter the EFI shell where you can set the system date and time with the date and time(Because the MinnowBoard MAX does not have a battery for the clock (RTC), the system date and time revert to the date and time when the firmware was created.)
  5. Enter exit to return to the boot option screen
  6. Use the arrow keys to select Boot Manager, press return, then select EFI USB Device, and press return
  7. The Ostro OS will begin booting and debug messages will appear on the terminal
  8. A warning will appear indicating this is a development image and you will be automatically logged in as root(no password)

Gigabyte

The GigaByte GB-BXBT-3825 is a gateway solution powered by an Intel® Atom™ E3825 dual-core processor (64-bit images are supported). Booting is similar to booting a MinnowBoard MAX from the USB thumbdrive described above.

Galileo Gen 2

The Intel Galileo Gen 2 is an Intel® Quark x1000 32-bit, single core, Intel Pentium® Processor class SOC-based board, pin-compatible with shields designed for the Arduino Uno R3.

Flashing an Intel Galileo Gen 2 requires use of a microSD card (booting off USB is not supported).

Here are the basic steps for booting the Ostro OS:

  1. Flash the microSD card with the Ostro OS image as described in the Using dd to Create Bootable Media section above
  2. Insert the microSD card in the Galileo Gen 2 board
  3. Connect the serial FTDI cable from the Intel Galileo Gen 2 to a USB port on your host computer and use a terminal emulator (settings: 115200 8N1)
  4. Power the board on (using a 5V, 3A power supply)
  5. Press [Enter] to directly boot
  6. The Ostro OS will begin booting and debug messages will appear on the terminal
  7. A warning will appear indicating this is a development image and you will be automatically logged in as root(no password)

Intel Edison

Flashing an Intel Edison requires use of a breakout board and two micro-USB cables:

  1. Install the dfu-util package. (You may also need the xfstk utility from http://xfstk.sourceforge.net for recovery cases.)

  2. Plug in a micro-USB cable to the J3 connector on the board (corner next to the FTDI chip).

  3. Flip the DIP switch towards jumper J16.

  4. Download the ostro-image-swupd image from the Ostro OS download folder for Edison (on https://download.ostroproject.org/releases/ostro-os/milestone/).

  5. Extract the image from the archive using the command:

    $ tar xf ostro-image-*-edison-*.toflash.tar.bz2
    
  6. Change directory to the toFlash folder.

  7. Run the command:

    $ sudo ./flashall.sh
    

    Note

    If the script is unable to find the image, use the -i <imagename> option to the flashall script.

  8. Plug in the second micro-USB cable to the J16 connector as instructed by the running flashall script.

  9. Wait for all the images to flash. You will see the progress on the flasher.

  10. Once flashing is done, the image will automatically boot up and auto-login as root, no password is required.

BeagleBone Black

BeagleBone Black is booted from a microSD card with MBR (Master Boot Record) and not GPT (GUID Partition Table) partitions. Most freshly unpackaged microSD cards come with MBR partitions, but previously used ones might not. (We have instructions below to properly initialize the microSD card.)

You’ll probably need an adapter to use the microSD card on your host computer. If you use a microSD-to-SD adapter, it will likely show up as /dev/mmcblk0 when plugged into your host computer. If you use a USB adapter, it will show up as /dev/sdb or /dev/sdc. (On some computers with a built-in SD-card slot, the card may also show up as /dev/sdX rather than /dev/mmcblkX.)

You can verify the device name assigned by using dmesg or the lsblk command to look for the device name for the microSD card (check for a device with the size you’re expecting).

In our setup steps below, we’re using an 8GB microSD card in an SD adapter that’s showing up as /dev/mmcblk0 (numbers and device name maybe different for your device and system).

  1. We’ll start by gathering files we’ll put on the microSD card. Aim your browser to the Ostro Project download server (if you’re not doing your own build). The releases folder contains milestone builds of the Ostro OS, while the builds folder has non-milestone builds. For this example, we’re using the BeagleBone build 405 images folder.

    Download these four files to your host computer:

    MLO
    ostro-image-swupd-beaglebone-*.rootfs.tar.bz2
    u-boot.img
    zImage-am335x-boneblack.dtb
    

    In our example below, we’re using the development (-dev) image. the process for creating a bootable SD card is the same for all the image variants. (Image variants are explained in Building Ostro™ OS Images.)

  1. Now we’re ready to prepare the microSD card. Make sure the microSD card isn’t already mounted and verify it is using MBR partitions. (Remember, your device name maybe different than what we’re using in our examples.) Run:

    $ sudo umount /dev/mmcblk0*
    $ sudo fdisk /dev/mmcblk0
    

    If you get an error saying “unable to open /dev/mmcblk0” then you should verify the device name assigned as described above. If you get an error that GPT partitions are used, see the section below on Converting from GPT to MBR Partitions and then return to retry this step.

    If all is well, you’ll see the fdisk prompt:

    Command (m for help):
    
  2. We want to create two partitions on the SD card: a small primary bootable active partition, and a second primary linux root filesystem partition for the remaining space on the device. The following fdisk commands will clean out all the existing partition information and set up two partitions:

    1. Initialize the partition table by typing o.

    2. Create the boot partition by typing n for “new”, then p for “primary”, and 1 to specify the first partition. Press enter to accept the default first sector and specify 4095 for the last sector.

    3. Set the partition type to FAT16 by typing t for “type” and e for “W95 FAT16 (LBA)”.

    4. Set the partition active (bootable) by typing a then 1 (for partition 1).

    5. Next, create the root filesystem by typing n for “new”, then p for “primary”, and 2 for the second partition. Accept the default values for the first and last sectors by pressing enter twice.

    6. Type p to “print” the partition table. It should look about like this:

      ...
      Device          Boot    Start      End   Blocks     Id  System
      /dev/mmcblk0p1    *      2048     4095     1024      e  W95 FAT16 (LBA)
      /dev/mmcblk0p2           4096 15523839   775872     83  Linux
      
    7. Finally, write these changes to the microSD card by typing w to “write” the partition table and exit.

  3. At this point your microSD card is partitioned correctly but the partitions need to be formatted with partition 1 as FAT16 and partition 2 as ext4 (the normal linux journaled filesystem):

    $ sudo mkfs.vfat -F 16 /dev/mmcblk0p1
    $ sudo mkfs.ext4  /dev/mmcblk0p2
    

    This last mkfs command may take a few minutes to complete, depending on the size of your SD card. You may optionally disable periodic filesystem checks on this partition with the command:

    $ sudo tune2fs -c0 -i0 /dev/mmcblk0p2
    
  4. Now we can install the MLO and u-boot.img (downloaded from Ostro Project download server) to the first partition of our microSD card.

    $ mkdir boot
    $ sudo mount /dev/mmcblk0p1 boot
    $ sudo cp MLO u-boot.img boot/
    $ sudo umount boot/
    
  5. And we can install the Ostro OS root filesystem to the second partition on our microSD card. This step requires tar version 1.27 or later: the xattrs flags are needed to preserve the Smack labels and IMA xattrs.

    $ mkdir rootfs
    $ sudo mount /dev/mmcblk0p2 rootfs
    $ sudo tar xvjf ostro-image-swupd-beaglebone*.rootfs.tar.bz2 --wildcards --xattrs --xattrs-include=*  -C rootfs
    
  6. Before unmounting the device, we also need to add the device tree blob file (zImage-am335x-boneblack.dtb) that you downloaded (or from your own build). Note that this step renames the file (without the zImage- prefix) to match what’s expected by the kernel.

    $ sudo cp zImage-am335x-boneblack.dtb rootfs/boot/am335x-boneblack.dtb
    $ sudo umount rootfs
    
  7. Remove the SD card from your host computer, remove the microSD card from its adapter, insert the microSD card into the BeagleBone Black (slot is on the bottom of the board) and power up the device.

Note

The normal boot sequence is to use the on-board flash first (eMMC), then the microSD card, then the USB port, and finally the serial port. You may need to use the S2 alternate boot button, by holding it down at power up, to change the boot order to use the microSD card first instead of eMMC first.

Once booted from the microSD card, you can prevent boot from eMMC by using (on the BeagleBone Black):

$ dd if=/dev/zero of=/dev/mmcblk1 bs=4M count=1

Converting from GPT to MBR Partitions

On a linux system run the gdisk utility:

Note

your microSD card device name may be different than in this example

$ sudo umount /dev/mmcblk0*
$ sudo gdisk /dev/mmcblk0

Command (? for help): x       # enter expert mode

Expert command (? for help): z
About to wipe out GPT on /dev/mmcblk0.  Proceed? (Y/N): y
GPT data structure destroyed! You may now partition the disk using fdisk or
other utilities.
Blank out MBR? (Y/N): y

At this point we have a wiped microSD card ready for creating partitions as described above: fdisk will initialize the SD card with MBR partitions when it sees the partition tables are wiped out.

Running Ostro OS in a VirtualBox* VM

You can run an Ostro OS image within a VirtualBox virtual machine by using the pre-built .ova file found in the binary release directory (on https://download.ostroproject.org), or as the result of doing your own build from source. As with the other examples above, we recommend you start with the “dev” image.

  1. If you have not already done so, download and install VirtualBox (version 5.0.2 or later) on your development system from https://www.virtualbox.org/wiki/Downloads.
  2. Open the VirtualBox program and select “File > Import appliance…”
  3. Click the folder icon in “Import virtual appliance” window, select the .ova file that you downloaded or created and select “Open”. Click next.
  4. A window opens that lists the details of the appliance that you are about to import. Click import.
  5. VirtualBox will now import the virtual machine. After the import is finished, the Ostro OS virtual machine is available in the VM list
  6. Finally, click on the “Start” arrow button and your new virtual machine will start booting the Ostro OS reference image and auto-login as root, no password is required.

If booting fails with a kernel panic, verify you’re using VirtualBox version 5.0.2 or later. You can shut the machine down by either using the shutdown now command within the running Ostro OS image, or by using the VirtualBox menu Machine/ACPI-shutdown.