Skip to main content

impOS Release 38

impOS Version Naming

Electric Imp versions impOS™ releases as follows: odd-numbered major versions are pre-releases and even-numbered major versions are production-quality releases. As such, impOS 38 builds heavily on impOS 37, which was not released publicly. For information on changes and bug-fixes implemented in the various minor releases of impOS 37, please see the relevant release notes. This document will focus on changes made following the release of impOS 38, and upon new features introduced in impOS 37 but made public for the first time with impOS 38.


The current release is 38.19 (see Release Notes and Known Issues).

New Features and Improvements: imp004m

Preliminary Bluetooth Support

The imp004m module’s on-board WiFi sub-system also incorporates Bluetooth 4.1; impOS 38 adds imp API support for this functionality. Please note that the Bluetooth 4.1 sub-system is not connected directly to the imp004m’s MCU, in order to preserve as many pins for customer use as possible, but can be connected back to it externally by connecting certain module pins to imp004m UART and other pins.

impOS 38’s preliminary Bluetooth support centers on a new bluetooth class (a property of hardware) which provides methods to initialize the Bluetooth sub-system; start and stop GAP beacon advertising; start and stop GAP beacon scanning; set up a GATT server; and manage attempts to connect to the imp004m. The methods are called in instances of the bluetooth class created using the open() class method.

Audio Input

impOS 38 adds support for an external digital filter for sigma-delta modulation (DFSDM) that has been added to an imp004m module. This allows two pins on the imp004m, S (clock) and R (data), to be used for convenient, low-cost audio input functionality as an alternative to impOS’ sampler object, which the imp004m does not support. Instead, the imp004m (only) gains a dfsdm object which provides the same methods available to other imps via the sampler object.

Audio Output

Under impOS 38, the imp004m gains support for the fixedfrequencydac object that is made available to other imps, provided the customer adds a suitable external digital filter. The imp004m does not contain a DAC, but it is able to emulate one using PWM and pass the output through pins K and D (pin D may be re-assigned to other roles after fixedfrequencydac configuration, if required, at the cost of reduced resolution/audio quality). The imp004m’s audio output is set up using a modified form of fixedfrequencydac.configure() but all other fixedfrequencydac methods work as expected.

Near-continuous PWM Output

With impOS 38, the imp004m can be configured to continue outputting a pulse width modulation signal even across Squirrel reloads and firmware updates. This so-called ‘zombie’ mode is applied by setting a new parameter added to the existing method pin.configure(). The output is effectively continuous: the inevitable drop-outs that take place during the course of a Squirrel reload or a firmware upgrade are tested as being less than 5ms.

New Features and Improvements: All imps

Universal Exception Handling

impOS 38 provides a new API method, imp.onunhandledexception(), which is used to register a function that will be called if your Squirrel throws any exception that has not been caught locally with a try… catch structure: for example, an exception thrown by a callback function.

Optional No Blocking or Disconnection on Send Error

With impOS 38, devices can be set with a new send policy: RETURN_ON_ERROR_NO_DISCONNECT. In this case, impOS will check whether all of the outgoing data (from agent.send(), server.log() or similar) will fit into the send buffer, which may already have data waiting to be sent. If the new data will not fit in the buffer, a new error code, SEND_ERROR_WOULDBLOCK, is returned. Code continues to run but the device does not disconnect (as is the case with the RETURN_ON_ERROR policy). This allows the application to take remedial action, such as waiting for the buffer to drain and then trying to send the new data, without having to deal with the disconnection, or the wait while Squirrel blocks until all the passed data has finally entered the buffer. This will benefit any customers streaming bulk data, such as photographs, from the device to the agent.’s ipv4.server slot has a new property tcpsendfree to help debug all-or-nothing send mode.

Retrieve Advanced Wireless Information is a new impOS method which allows advanced developers to retrieve profiling data from an imp’s WiFi sub-system, specifically a snapshot of WiFi counters retrieved from the imp’s WICED firmware.

Manually Manage WiFi Connection Hints

When an imp connects to a wireless router or access point for the first time, it records both the network station’s BSSID and the WiFi channel on which the network is operating (1-13 for 2.4GHz, 36-165 for 5GHz). This saves the imp from having to scan for this data at every subsequent re-connect. The imp API now provides and to set and verify these hints in code.

Cold Reset from Squirrel

imp.reset() is a new impOS method which allows Squirrel to trigger a full device reset that’s the equivalent of a cold reset (power cycle).

Bug Fixes and Additional Improvements

  • Security: following BlinkUp, refuse to join an open WiFi network if a password has been stored for that SSID.
  • Allow configuring the fixed-frequency DAC without buffers (as long as they're provided before fixedfrequencydac.start()).
  • Reduce delays when USB devices connect and disconnect rapidly on imp005.
  • Support for quad-mode read on Cypress S25FL064L SPI flash chips connected to imp005.
  • Add support for Cypress S25FL-L, Adesto AT25SF641 and ISSI IS25LP064A SPI flash parts to imp005.
  • Improve power consumption in idle (shallow sleep, WiFi off) to 30μA (imp004m) or 500μA (imp003).
  • Force WiFi power-save mode off during network join (re-enacting requested state once joined).
  • Reset WiFi power-save mode to off (default) when reloading Squirrel.
  • Fix regression with hardware.spiflash use during WiFi connection.
  • Fix regression by reducing pause before first LED status is shown.
  • Fix TLS SNI when using an HTTP proxy.
  • Fix imp005 configuration mechanism for 2.4GHz-only (or 5GHz-only) WiFi usage.
  • Fix unintentional non-restarts in server.restart().
  • Fix exceedingly rare crash in BlinkUp™ code.
  • Fix rare crash when using Squirrel weak references.

New impOS Methods

Updated impOS Methods

New impOS Properties

  • hardware.pwmpairKD (imp004m only)
  • hardware.usbAB (impC001 only; matches imp005 USB API)

Release Notes


  • imp005: Ensure escrow customers can build factory SPI images.


  • 38.18 was a release-process change only, with no impROM changes.


  • imp001-005
    • Bugfix Fix potential buffer overrun with 32-byte WiFi SSIDs (regression in 37.1).
  • imp004m
    • Bugfix Fix overclocking/undervoltage issue (found by code inspection; no actual symptoms ever seen).


  • All imps
    • Reduce Squirrel latency when disabling WiFi by only disabling DHCP if necessary.


  • This version contains no user-facing changes.


  • All imps
    • Cache several TLS sessions (not just one) to improve reconnection times when at the limits of WiFi range.
  • imp003-005
  • imp004m


  • imp004m
    • Increase speed of Bluetooth UART and capture more advertisements in busy conditions.
    • Improve Squirrel latency during Bluetooth scan operations.
    • Improve Squirrel latency when attempting to join a WiFi network that the imp can't see.
    • Adjust Bluetooth/WiFi antenna prioritization in favour of Bluetooth.
    • Bugfix Improve recovery from Bluetooth UART overruns.


  • imp004m
    • Bugfix Fix bogus error when reconfiguring hardware.spiAHSR (regression in 37.3).


  • imp003/imp004m
    • Reboot when a Squirrel error occurs and there are no stored WiFi credentials and no 32k crystal.
  • imp004m
    • Bugfix Fix a memory leak when Bluetooth is repeatedly reconfigured.

38.9 and 38.10

  • Minor modifications — no customer-visible features changed.


  • imp001-005
    • Bugfix Fix a crash when calling imp.scanwifinetworks() while attempting to connect to an absent access point.
  • imp001-004m
    • Bugfix Fix upgrades getting stuck because flash-writing errors were not cleared (regression in 37.1).


  • imp001-004m, impC001
    • Bugfix Fix a crash when the Squirrel bytecode page was filled exactly (regression in 38.5).


  • imp001-005
    • Bugfix Recover if WiFi firmware takes forever to start.
  • imp005
    • Bugfix Restart WiFi if the firmware appears stalled.


  • All imps
  • imp005
    • Bugfix Be more robust against corrupted config pages or bad SPI reads.


  • imp003/004m
    • Bugfix Fix issue with rescue pin for units blessed on impOS 36 but running impOS 38 or later.
  • imp004m
    • Bugfix Fix issue with zombie PWM for units blessed on impOS 37 but running impOS 38 or later.


  • No public-facing code changes.


  • All imps
    • Adopt upstream LwIP fix for crash during TCP segment reassembly.
  • imp004m
    • Bugfix Fix episodes of increased current draw during shallow sleep.


  • A release-process change only, with no impOS changes.


Initial release

Changes from 37.33:

  • imp004m Make Bluetooth startup more reliable.

Known Issues

  • Reconfiguring the pulse-counter with a different duration causes mis-counted pulses.
  • There is no sampler, fixed-frequency DAC or pulse-counter support on impC001.