4. End devices
Unlike a gateway, an end device does not determine its own region. The region is supplied to it. On an end device, therefore, the region can be set incorrectly, set late, or set to a value the device cannot support. The rest of this section describes what the application developer is responsible for on an end device.
As with a gateway, regional support is compiled in: an end device can only be provisioned to a region its firmware includes. Build end-device firmware with REGION_LITE, which compiles in both North America and Europe; provisioning a device to a region its build omits is refused as described in §4.4. Use REGION_LITE on its own: the single-region options REGION_US915 and REGION_EU868 are alternatives to it, not additions, and defining REGION_EU868 alongside it changes the default region described in §4.3 from North America to Europe.
4.1 The region values
An end device’s region is one of the values of enum sid_device_region, defined in Data types in the Amazon Sidewalk SID API Developer Guide. A REGION_LITE build supports SID_DEVICE_REGION_NORTH_AMERICA and SID_DEVICE_REGION_EUROPE; SID_DEVICE_REGION_UNSET means no region has been set. The radio region passed at platform initialization (§4.2) uses the same numeric value for each region, so a single stored value can supply both.
4.2 Configuring the radio and reporting the region
An end device uses its region in two separate places, and the application supplies both:
- Radio region. The sub-GHz radio is configured from the region the application passes to
sid_platform_init(), in theplatform_init_parameters.regionandplatform_init_parameters.iso_countryfields ofplatform_parameters_t.iso_countryis the ISO 3166-1 alpha-2 code of the country the device operates in, for example"US", and may be NULL (sid_platform_init). This value sets the band, LoRa spreading factor, transmit power, and channel-access rules. - Reported region. The stack writes and reads the provisioned region through the
set_infoandget_infocallbacks instruct sid_device_info_callbacks, with information typeSID_DEVICE_INFO_TYPE_REGION. It uses this value to report the region during setup, to allow or block network registration, and to decide whether to start the sub-GHz links (§4.3). It does not configure the radio.
The stack does not connect the two, so the application must keep them consistent by deriving both from one stored value:
- In
set_info, store the provisioned region persistently before returning success. - In
get_info, return the stored value as anenum sid_device_region, orSID_DEVICE_REGION_UNSETif none is stored. - At every boot, pass the stored region to
sid_platform_init(), rather than a fixed compile-time value. Because platform initialization runs once per boot, a newly provisioned region reaches the radio after the next reboot. - If no region is stored, pass a region the build includes, for example North America. The device still reports
SID_DEVICE_REGION_UNSET, so the sub-GHz links stay off until the region is provisioned. - On factory reset, clear the stored region.
If the two values differ, the device reports one region while its radio operates on the parameters of another.
For the field definitions and integration steps, see sid_platform_init and Integrating the Device Region API in the Amazon Sidewalk SID API Developer Guide.
4.3 When no region is reported
What the stack does when get_info reports no region depends on whether the device is already registered:
- Not yet registered. Network registration is blocked, and
sid_start()starts only Bluetooth Low Energy; the sub-GHz links are not started, and a request to start only sub-GHz links returnsSID_ERROR_INVALID_STATE. Bluetooth Low Energy remains available so that the region can be provisioned over it during setup. This is the normal state of a new device; treat it as a start-up state, not an error. - Already registered. A device built with
REGION_LITEis treated as North America for registration and reporting. This covers a device registered before region support was available, for example one that later receives a firmware update that adds region support. Initialize its radio for North America as well, so that the two values agree.
If the application does not report a region at all (get_info does not handle SID_DEVICE_INFO_TYPE_REGION), none of the above applies: registration is not gated and no default is applied. The radio uses whatever region the application passes to sid_platform_init(). This is the behavior of firmware without region support.
Because the application clears the stored region on factory reset (§4.2), a reset device returns to the first case above.
4.4 An unsupported region
If setup provisions a region the device firmware build does not include (with REGION_LITE, any region other than North America or Europe), the stack rejects the request: the device answers with the NO_SUPPORT status (SID_EP_DEV_INFO_TAG_NO_SUPPORT_ERROR, 0x03) in its device-information response, and does not pass the region to the application (set_info is not called). The device keeps its previous region, or remains without one.
This rejection is permanent for the current firmware. Setup should stop rather than retry: the request is rejected every time until the device runs firmware that supports the region.