Posts Tagged Windows 10 IoT Core
For some reason, my SD card got corrupted. I had to re-build it.
The process to create new SD card for Windows 10 IoT Core is quite simple. All you need is the Windows IoT Dashboard application and an SD card (at least 8Gb is recommended).
- Start Windows IoT Dashboard application
- Give it a few seconds to populate Device type
- Select your device
- Insert you SD card into your computer
- Select your SD card in the Drive drop down list
- Click the “Download and install”
- The application will then download the image (this will take a few minutes). A progress bar is provided.
- Then a command line application will then write the image on the card (again this will take a few minutes). A progress bar is provided.
- When completed you get the following screen:
- Once your device is booted up, you should see it in the My device.
Re-imaging an SD is an easy strait forward process. It takes only 5-10 minutes and you get a brand new device.
You will loose any changes or information stored on your card. So you will have to re-configure it after.
I’ve had somewhat of an adventure with the Windows Update process on the Windows 10 IoT Core.
In the Windows Device Portal I was on the Windows Update page. So to make sure my device was up to date, I clicked the “Check for updates” button and … nothing happened on screen. Knowing that the process was probably running in the background, I moved on to check other pages.
When I came back to that screen later I got a You must restart your device to apply the updates kind of button. So I clicked on it and the device proceeded to reboot as expected. I got the cog wheel going and a progress bar for a number of minutes. Then I got a giant frown emoticon:
And the screen went blank. I waited for 30 minutes then turned off the device. Then turned it back on, got cog wheels for a few minutes, then frown, then blank. It had essentially screwed up the Operating System.
Flashing the SD card
I took out my SD card, placed it in my development machine. And proceeded to re-image it without issues. Placed the card back in my device and it started without issues.
In any case, it gave me the material to write a post about Flashing the SD card…
This happened to me on a brand new device with a new SD card that is part of a starter pack.
This may have been a bad fluke. But getting errors like this on a clean device is a bit worrisome.
So I finally got the Raspberry Pi hardware yesterday. I will spare you the unboxing video, I’m sure there are a number of them already.
I plugged in the Raspberry Pi to a keyboard, a mouse, and a screen. Added the Wifi USB dongle and started it up.
This blog explores the different ways we can access the device by default. This is only an introduction, we probably will return to see some of those interfaces in more depth as we need them in the future.
Raspberry Pi on screen Experience
(Sorry, I have not figured out how to take screen shots on the Raspberry Pi yet, and phone picture are horrible. I will add screen shots when/if I figure it out)
First Start Up
After churning for a couple minutes, it prompted me for language and selecting the wireless network. That done, it re-directed me to the main screen.
If you saved the default settings, on subsequent start ups, the boot process sends you directly to the main screen.
On the main screen, the device information application is displayed. The top of the screen look like a task bar with applications running on the left with a system tray to the right.
The applications running are:
- Device info
The system tray has:
- Device Settings
- On/Off button
The On/Off button offers:
Device Settings Page
The Device Settings page allows you to set:
- Basic preferences: Only sets language at this point
- Network & Wi-Fi: Select and configure Wi-Fi
Windows 10 IoT Core Dashboard
Going back to my development computer and I fired up the Windows 10 IoT Core Dashboard to see what would show up.
The startup page gets you on the Set up a new device. Setting up a new device is used to create a new SD card. I already had a pre-configured SD card (from the starting pack) so I went directly to My devices.
My devices show a list of devices connected on your network. Give it a few minutes to detect your device.
From here you can open up the device Settings or Open in Device Portal. I went for Settings.
The Device Settings page allows you to change your device name and set your administrator password. You should take the time to at least change the password. The default password for the Administrator account is: p@ssw0rd
From here we’ll go to the Windows Device Portal in browser.
Windows Device Portal
The Windows Device Portal is a web page served directly by the device. It provides a lot more functionality than the IoT dashboard or the device interactive UI. The left hand menu allows you to navigate to different sections.
The sections are:
- Perf Tracing
- Windows Update
Also a number of functions are available on the right hand header:
Here are the more high level and useful pages for now:
The home page provides information about the device, allows you to change the device name and change the administrator password.
The App Manager page provides a lot of functionality. It allows you to manage applications, uninstall application, select default startup application. It also allows you to deploy new applications.
The debugging page provides a list of the current processes, displays error logs and set error reporting parameters. It also allows you to manually start the Visual Studio Remote Debugger.
Note: The remote debugger is not installed by default on Windows IoT Core 10586. It is only deployed the first time you start a debugging session from Visual Studio. If you attempt to start the Remote Debugger before you start a debugging session, you get the following error message is:
The networking section allows you to set the networking parameters. It provides a list of available networks and displace the current IP configuration for the different networking interfaces on the device (I snipped the screen shot, it actually showed 3 network adapters).
The Windows Update page allows you to check for available operating system updates. If updates are available they will be installed on the next restart.
This seems to be most of the out of the box high level user interfaces available to interact with the Windows 10 IoT Core operating system.
Of course there are also more advanced mode of interaction available like command lines, PowerShell and programming APIs. But we will see those in other posts in the future.
Let’s explore the General Purpose Input/Output (GPIO) interface offered by the Windows 10 IoT core.
The GPIO interface is deceptively simple. It consists in a few classes and enumerations. The main classes are:
- GpioController class: Provides access to all the pins of the GPIO(s) bus.
- GpioPin class: Represents a single pin on the GPIO. It provides functions to read/write pin values and provides an event that can be triggered when a pin value changes.
The GpioController class cannot be directly instantiated. Instances are accessed through one of the static functions on the class:
- GetDefault(): Returns the default Gpio controller for the device.
- GetDefaultAsync(): Returns the default Gpio controller for the device asynchronously.
- GetControllersAsync() : Returns a list of all the Gpio controllers available for the device asynchronously.
The instance functions of the GpioController are used to manage pins:
- PinCount: Returns the number of pins available for this GpioController.
- OpenPin(): Opens a connection to the pin and returns the corresponding GpioPin. An overload of the function allows you to supply a sharing mode other than exclusive.
- TryOpenPin(): Opens a connection to the pin and returns the corresponding GpioPin. This variant will not throw an exception on error but will return a status making it easier to handle errors.
The GpioPin class gives you access to read and manipulate a single pin. Like the GpioController, you cannot instantiate this class directly. You access it using the GpioController OpenPin or TryOpenPin functions.
The GpioPin class provides members query information about the pin:
- PinNumber: Returns the pin number for this pin.
- SharingMode: Returns the sharing mode for this pin. Modes can be Exclusive or SharedReadOnly.
The GpioPin class provides members configure the pin. Drive mode is probably the most important item to configure on a pin. It tells the pin whether it is an input or an output and specifies the way the electronic is organized. There are multiple drive mode available see GpioPinDriveMode for more information about the available drive modes. I will do a post specific to this later on.
- IsDriveModeSupported(): Can the pin support this drive mode.
- GetDriveMode(): Returns the currently configured drive mode for this pin.
- SetDriveMode(): Sets the drive mode for this pin.
- ValueChanged: Event that is triggered when a change of state is detected on the pin. This member allows us to attach an event handler to handle that event.
- DebounceTimeout: Get/Sets the interval of time after the ValueChanged event is trigger during which the changes in the pin will not trigger another ValueChanged event.
The GpioPin class provides members to read and write the value of the pin:
- Read(): Returns the current value of the pin High/Low. This will work on inputs or output pins.
- Write(): Sets the value for the pin High/Low. This will only work on output pins.
There are a number of possible ways to use the GPIO. The most common scenario are:
Pin reading / writing
This process consist in setting up your pin(s), manipulating them and disposing of the pin when done.
This process consist in setting up your pin(s), registering an event handler that will be triggered when a pin change is detected and waiting for events to occur, and disposing of the pin(s) when done .
The GPIO interface provided by the Windows 10 IoT library is simple but comprehensive. This information should allow us to come up with a plan on how to write device code.
The only touchy points I can see so far is: Figuring out how to set a valid DebounceTimeout value. We’ll be in a better position to figure out those details once we start coding against an actual device.
For more information see the MSDN documentation