Feb 24

Building Yocto Linux for Edison

The Intel Edison is a tiny embedded micro that has 4GB Flash and 1GB Ram. It runs Linux, and is ideal for embedding as an application platform into all kinds of devices, but especially for IoT and wearables. I am currently working on some new products for a major client of mine based around Edison, and I’m loving the power and flexibility it brings. However the current BSP provided by Intel is broken. Here’s how to fix it.

Continue reading

Feb 03

Calculator in Apple’s OS X El Capitan cannot perform basic maths!

I have discovered that the Calculator app that ships with OS X El Capitan cannot do some pretty basic programmer’s maths. Being able to add and subtract in Base 10 (decimal) and Base 16 (Hexadecimal) is a pretty basic requirement of any programmer’s calculator. Developers use these number systems all day long, and the Calculator App in Mavericks does claim to be able to. Except it can’t do the most basic subtraction.

Lets start with a pretty basic example in decimal. Open the calculator app and make sure it’s in “basic” mode. (CMD+1). The try this sum:
0 – 5 = ? the answer is -5, and the calculator gets this one right!

Screen Shot 2016-02-03 at 10.29.36

Now, with the answer still showing press CMD+3 to take it to programmer’s mode. You should see the display change to 0xFFFFFFFFFFFB – which is correct – that’s how you show -5 in 64-Bit Hexadecimal. Good so far! (click any image for a full view)

Screen Shot 2016-02-03 at 10.32.49

OK, so now hit the AC button to clear everything and we’ll try again, this time starting in Programmer’s mode.

Enter the same sum again 0 – 5 = and what answer do you get? You will get 0x7FFFFFFFFFFF – which is totally wrong. It’s not even one of those “oh I see what it did” type of wrongs, it’s just plain old wrong.

Screen Shot 2016-02-03 at 10.36.02

And just for fun, the same thing in Windows 10’s new calculator app..
Oh look, it gets it right!

Screenshot 2016-02-03 10.38.59

For the above tests, the most recent publicly available released version of OS X El Capitan 10.11.3 was used.

Apr 28

How to solve Apple’s Pro Video Formats 2.0.1 constant update loop.

A software update which was made available by Apple earlier this month causes some users machines to get stuck in a constant update loop. As soon as you install the update it re-appears as available for update. If this affects you, then there is a simple solution. Continue reading

Oct 23

FTDI USB driver intentionally and deliberately damages hardware?

FTDI make USB interface chips which are the industry standard around the world. Do the latest FTDI software drivers for windows deliberately and knowingly damage hardware?

Continue reading

Sep 11

mDNS / Bonjour tool for OS X Now Available in App Store.

My new mDNS Tool for Mac OS X is now available in the Mac App Store.
View it on the App Store or search the Mac App Store for “mDNS Tool”.

Screen Shot 2014-09-11 at 09.23.57

The tool allows you to browse and find all the mDNS / Bonjour services and devices on your network. Bonjour is Apple’s name for their implementation of mDNS, which is used to advertise and locate devices and services on the network.

  • List all mDNS / Bonjour devices on your network.
  • Find the address of devices and services.
  • See all the device details, not normally shown in network browsers.
  • Find IPv4 and IPv6 Addresses for devices.
  • Copy details to the clipboard.
  • Simple to use.
  • No drivers or libraries required.

 

 

Aug 27

Windows ™ versus Linux on intel Galileo

Here is a really quick and dirty, non scientific comparison of a Galileo GEN1 board running Windows ™ against the same board running linux.
SPI Flash version is 1.0.2.

Login to windows is via telnet.
Login to linux is via ssh.

 Time taken from power-on to login:

Linux  48 Seconds
Windows 68 Seconds

Time taken to power off:

Linux    3.25 Seconds 
Windows  12.54 Seconds

Next I wrote a simple ‘blink’ executable thats sets up Pin 13 for GPIO and then turns it on/off in a tight loop. Source code for both is below. Both are built in ‘release’ mode.

To write the app for Windows on Galileo you need an external PC running Windows 7 or later, and Visual Studio 2013 or later, with the Microsoft IoT dev kit extensions installed.

To write the app for Linux, you need any PC or Terminal capable of attaching via telnet or RS232.

Size of simple ‘blink’ executable

Linux  10080 Bytes
Windows 19456 Bytes

Speed of executing GPIO Writes
The simple app after setting up the GPIO runs in a tight loop just switching the GPIO Pin to 1 and 0 continuously.

The Linux loop:

while(1)
{
    write(fd,"1",1);
    write(fd,"0",1);
}

The windows loop:

while(1){
    digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
    digitalWrite(led, HIGH);  // turn the LED on by making the voltage HIGH
}

These gave the following results:

The Linux version gave a steady 223.9 Hz square wave with a 50% duty cycle. Pulse width is about 2.24 ms.

Screen Shot 2014-08-27 at 15.00.42

The Windows version gave a jittery 42.72 Hz wave with a 35% Duty cycle. Pulse width is about 14.97 ms, but there were occasional gaps in the wave form where it paused for 10 ms or so.

Screen Shot 2014-08-27 at 14.36.39

And finally, the full source code for each of the test apps.

Linux source code:

#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>

void setGPIOPin(char* pin, char* dir, char* drive, char* val)
{
  char buf[256];
  int fd;

  // Open the GPIO Export file
  fd = open("/sys/class/gpio/export",O_WRONLY);
  if(fd == -1)
    exit(-1);

// Export chosen pin
 write(fd, pin, strlen(pin)); // Export GPIO pin
  close(fd);

  // Open exported pin DIRECTION file
  sprintf(buf,"/sys/class/gpio/gpio%s/direction",pin);
  fd = open(buf,O_WRONLY); // open GPIOxx direction file

  if(fd==-1)
  exit(-1);

  // write out the direction
  write(fd,dir,strlen(dir)); // set GPIOxx direction to out
  close(fd);

  // open the drive file
  sprintf(buf,"/sys/class/gpio/gpio%s/drive",pin);
  fd = open(buf,O_WRONLY); // open GPIO drive strength file
  if(fd==-1)
    exit(-1);

 write(fd,drive,strlen(drive)); // set GPIO drive
  close(fd);

  sprintf(buf,"/sys/class/gpio/gpio%s/value",pin);
  fd = open(buf,O_WRONLY);
  if(fd==-1)
  exit(-1);

  write(fd,val,strlen(val)); // set GPIO value
  close(fd);
}

void setMux(void)
{
  // Switch all the SPI1 pins through to the header pins. And enable level shifter.
  setGPIOPin("55","out","pullup","1"); // mux
  setGPIOPin("39","out","pullup","1"); // Pin 13
  setGPIOPin("4","out","pullup","1"); // Level shifter
}

int main(int argc, char *argv[])
{
  int fd;
  setMux();

  fd = open("/sys/class/gpio/gpio39/value",O_WRONLY);
  if(fd==-1)
  {
    printf("Failed to open GPIO On pin 13\n");
    exit(-1);
  }

  while(1)
  {
    write(fd,"1",1);
    write(fd,"0",1);
  }

  return 0;
}

Windows Source code:

#include "stdafx.h"
#include "arduino.h"

int _tmain(int argc, _TCHAR* argv[])
{
    return RunArduinoSketch();
}

int led = 13;  // This is the pin the LED is attached to.
void setup()
{
    pinMode(led, OUTPUT);      // Configure the pin for OUTPUT so you can turn on the LED.
}

// the loop routine runs over and over again forever:
void loop()
{
    digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
    digitalWrite(led, HIGH);  // turn the LED on by making the voltage HIGH
}

Aug 15

Galileo GPIO Timing & why it doesn’t work for some.

The Intel Galileo is has Arduino UNO compatibility, yet often I see queries from someone asking why their favourite Arduino Shield won’t work, or why an interface they have made which works on other Arduino boards, doesn’t work with Galileo. Often they say Galileo is no use, or Galileo doesn’t do what it claims, or Galileo is slow. So why do some Sketches and Shields not work as expected, when using GPIO on Galileo? Read on for the answers…

Continue reading

Jun 16

Reading 1-Wire iButtons using Cypress PSoC 3 and 5/5LP

Previously I posted about using a standard UART to read and write to 1-Wire devices. In this post I look at how to read and write to these devices using Cypress PSoC devices. Continue reading

Jun 13

Reading 1-Wire iButtons using a UART

This post takes a look at a simple 1-Wire protocol reader/writer using a standard UART for detecting and communicating with 1-Wire devices. Written in C for Linux, and running on Intel Galileo. It could easily be ported to most other platforms.

Continue reading