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.

Versions

The current release is 38.13 (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.

imp.net.info()’s ipv4.server slot has a new property tcpsendfree to help debug all-or-nothing send mode.

Retrieve Advanced Wireless Information

imp.net.counters() 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 imp.net.setwifihints() and imp.net.getwifihints() 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

Release Notes

38.13

  • imp004m: increase speed of Bluetooth UART and capture more advertisements in busy conditions.
  • imp004m: improve Squirrel latency during Bluetooth scan operations.
  • imp004m: improve Squirrel latency when attempting to join a WiFi network that the imp can't see.
  • Bugfix imp004m: improve recovery from Bluetooth UART overruns.

38.12

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

38.11

  • imp003/imp004m: when a Squirrel error occurs and there are no stored WiFi credentials and no 32k crystal, reboot.
  • Bugfix imp004m: fix a Bluetooth LE sub-system memory leak.

38.9 and 38.10

  • Minor modifications — no customer-visible features changed.

38.8

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

38.7

  • Bugfix imp001-004m and impC001: fix a crash on when Squirrel bytecode page was filled exactly (regression in 38.5).

38.6

  • Bugfix imp001-005: recover if WiFi firmware takes forever to start.
  • Bugfix imp005: restart WiFi if the firmware appears stalled.

38.5

  • Bugfix Some Squirrel calls (swap2(), swap4(), casti2f(), castf2i() and swapfloat()) now can no longer reveal stack contents on failure.
  • Bugfix Invalid callbacks (for UART and server.onunexpecteddisconnect()) are now released even if a valid callback is not set.
  • Bugfix UART callbacks are now released on uart.disable().
  • Bugfix Prevent RETURN_ON_ERROR_NO_DISCONNECT from blocking unexpectedly.
  • Bugfix imp005: be more robust against corrupted config pages or bad SPI reads.

38.4

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

38.3

  • No public-facing code changes.

38.2

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

38.1

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

38.0

Initial release

Changes from 37.33:

  • imp004: 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.