Skip to main content

Factory Firmware

Recommended Code For Factory Operations

Factory firmware is an essential part of the Electric Imp Connected Factory Process. It drives all of your devices in the factory: not only Devices Under Test (DUTs) on the assembly line but also the imp-based hardware called a factory BlinkUp™ fixture that you use to configure DUTs for Electric Imp impCloud™ access.

The same factory firmware runs on both of these types of device, so your factory firmware must contain not only separate code paths for each type but also a means to determine which code path should be taken. This can best be done by utilizing Electric Imp’s free-to-use Factory Tools library, which provides methods that indicate to your code if the device it is running on is a BlinkUp fixture or a DUT.

Example Code

The listing that follows is a complete example of factory firmware that can be used as the basis for your own factory firmware. It was written to run on the impFactory™ appliance, but can be readily adapted to your own design of imp module-based factory BlinkUp fixture, which should have a button that can be used by the operator to trigger BlinkUp when the fixture’s LED and a DUT are physically aligned, LED to photosensor, and ready for factory BlinkUp.

When the green button is pressed, BlinkUp will begin. The amber LED on the front of the impCentral will flash in time with the BlinkUp signal, which is delivered via the 3.5mm jack on the back of the impFactory, marked LED. This jack is intended to be used with an external LED. Typically this will be an infra-red LED, hence the use of the amber LED as an indictor.

The Program Start section uses the Factory Tools library to determine which of these devices the firmware is instanced on and to select the correct code path. The Factory BlinkUp Fixture section contains code called on that device; the DUT section contains the DUT code. A final section, Your Test Function, defines a shell into which you can place code of your own to test elements of your DUT hardware. This code should return true if your tests have been passed to ensure the device’s blessing proceeds.

The factory agent code provides two message handlers: each takes a message sent solely by one type of device and signals your own logging server with useful information about the factory process when either a factory BlinkUp fixture has configured a DUT, or a Production Device has been blessed — a DUT becomes a Production Device when it is blessed; it is now ready for sale and end-use.

API Methods Used

Libraries Used

Further Reading