Manufacturing and Functional Test Library#

API and Callbacks for the Manufacturing Library Component.

This is a manufacturing and functional test library for testing and verifying the RF component of products at manufacture time.

Developers can optionally include this library in their application code. The goal is that in most cases, developers won't need to load multiple images into their hardware at manufacturing time.

This library can optionally be compiled into the developer's production code and run at manufacturing time. Any interface to the library is handled by the application.

This library cannot assist in hardware start up.

Many functions in this file return an ::sl_status_t value.

API#

typedef void(*
MfglibRxCallback)(uint8_t *packet, uint8_t linkQuality, int8_t rssi)

callback function pointer type for mfglibStart

sl_status_t
mfglibStart(MfglibRxCallback mfglibRxCallback)

Activate use of mfglib test routines and enable the radio receiver to report packets it receives to the caller-specified ::mfglibRxCallback() routine.

sl_status_t
mfglibEnd(void)

Deactivate use of Manufacturing and Functional Test Library test routines.

sl_status_t

Start transmitting the tone feature of the radio.

sl_status_t

Stop transmitting a tone started by mfglibStartTone().

sl_status_t

Start transmitting a random stream of characters to enable the measurement of radio modulation.

sl_status_t

Stop transmitting a random stream of characters started by mfglibStartStream().

sl_status_t
mfglibSendPacket(uint8_t *packet, uint16_t repeat)

Send a single packet, (repeat + 1) times.

sl_status_t
mfglibSetChannel(uint8_t chan)

Select the radio channel. The channel range is from 11 to 26.

uint8_t

Return the current radio channel, as previously set via mfglibSetChannel().

sl_status_t
mfglibSetPower(uint16_t txPowerMode, int8_t power)

First select the transmit power mode, then include a method for selecting the radio transmit power.

int8_t

Return the current radio power setting as previously set via mfglibSetPower().

sl_status_t
mfglibSetOptions(uint8_t options)

Set manufacturing library options.

uint8_t

Return the current manufacturing library options, as previously set via mfglibSetOptions().

void
mfglibSetSynOffset(int8_t synOffset)

Set the synth offset in steps.

int8_t

Get the current synth offset in steps.

#define
mfglibApiStart (packet, linkQuality, rssi)

callback function pointer type for mfglibStart

API Documentation#

MfglibRxCallback#

typedef void(* MfglibRxCallback) (uint8_t *packet, uint8_t linkQuality, int8_t rssi) )(uint8_t *packet, uint8_t linkQuality, int8_t rssi)

callback function pointer type for mfglibStart

Parameters
N/Apacket

pointer to packet data

N/AlinkQuality

the calculated link quality measure

N/Arssi

the measured signal strength


Definition at line 61 of file stack/include/mfglib.h

mfglibStart#

sl_status_t mfglibStart (MfglibRxCallback mfglibRxCallback)

Activate use of mfglib test routines and enable the radio receiver to report packets it receives to the caller-specified ::mfglibRxCallback() routine.

Parameters
N/AmfglibRxCallback

A function pointer to callback routine that is invoked whenever a valid packet is received. sl_zigbee_tick() must be called routinely for this callback to function correctly.

It is legal to pass in a NULL. These packets will not be passed up with a CRC failure. The first byte of the packet in the callback is the length. All other functions will return an error until mfglibStart() has been called.

@appusage Use this function to enter test mode.

Note: This function should only be called shortly after initialization and prior to forming or joining a network.

Returns

  • One of the following:

    • ::SL_STATUS_OK if the mfg test mode has been enabled.

    • ::SL_STATUS_FAIL if the mfg test mode is not available.


Definition at line 85 of file stack/include/mfglib.h

mfglibEnd#

sl_status_t mfglibEnd (void )

Deactivate use of Manufacturing and Functional Test Library test routines.

Parameters
N/A

This restores the hardware to the state it was in prior to mfglibStart() and stops receiving packets started by mfglibStart() at the same time.

@appusage Use this function to exit the mfg test mode.

Note: It may be desirable to also reboot after use of manufacturing mode to ensure all application state is properly re-initialized.

Returns

  • One of the following:

    • ::SL_STATUS_OK if the mfg test mode has been exited.

    • ::SL_STATUS_FAIL if the mfg test mode cannot be exited.


Definition at line 101 of file stack/include/mfglib.h

mfglibStartTone#

sl_status_t mfglibStartTone (void )

Start transmitting the tone feature of the radio.

Parameters
N/A

In this mode, the radio will transmit an unmodulated tone on the currently set channel and power level. Upon successful return, the tone will be transmitting. To stop transmitting a tone, the application must call mfglibStopTone(), allowing it the flexibility to determine its own criteria for tone duration, such as time, event, and so on.

@appusage Use this function to transmit a tone.

Returns

  • One of the following:

    • ::SL_STATUS_OK if the transmit tone has started.

    • ::SL_STATUS_FAIL if the tone cannot be started.


Definition at line 117 of file stack/include/mfglib.h

mfglibStopTone#

sl_status_t mfglibStopTone (void )

Stop transmitting a tone started by mfglibStartTone().

Parameters
N/A

@appusage Use this function to stop transmitting a tone.

Returns

  • One of the following:

    • ::SL_STATUS_OK if the transmit tone has stopped.

    • ::SL_STATUS_FAIL if the tone cannot be stopped.


Definition at line 126 of file stack/include/mfglib.h

mfglibStartStream#

sl_status_t mfglibStartStream (void )

Start transmitting a random stream of characters to enable the measurement of radio modulation.

Parameters
N/A

@appusage Enable the measurement of radio modulation.

Returns

  • One of the following:

    • ::SL_STATUS_OK if the transmit stream has started.

    • ::SL_STATUS_FAIL if the stream cannot be started.


Definition at line 137 of file stack/include/mfglib.h

mfglibStopStream#

sl_status_t mfglibStopStream (void )

Stop transmitting a random stream of characters started by mfglibStartStream().

Parameters
N/A

@appusage Use this function to end the measurement of radio modulation.

Returns

  • One of the following:

    • ::SL_STATUS_OK if the transmit stream has stopped.

    • ::SL_STATUS_FAIL if the stream cannot be stopped.


Definition at line 148 of file stack/include/mfglib.h

mfglibSendPacket#

sl_status_t mfglibSendPacket (uint8_t * packet, uint16_t repeat)

Send a single packet, (repeat + 1) times.

Parameters
N/Apacket

A packet to be sent. First byte of the packet is always the length byte, the value of which does not include itself but does include the 16-bit CRC in the length calculation. The CRC gets appended automatically by the radio as it transmits the packet, so the host does not need to provide this as part of packetContents. The total length of packet contents (Length Byte+1) going out the radio should not be >128 or <6 bytes. Note that the packet array should not include the CRC, as this is appended by the radio automatically.

N/Arepeat

The number of times to repeat sending the packet after having been sent once. A value of 0 means send once and don't repeat.

@appusage Use this function to send raw data. Historically, the packet array needed to be 16-bit aligned, but recent platforms now require 32-bit alignment (address a multiple of 4), such that ((((uint16_t)packet) & 3) == 0) holds true. (This is generally done by either declaring packet as a local variable or putting it in a global declaration immediately following the declaration of an uint32_t.)

Returns

  • One of the following:

    • ::SL_STATUS_OK if the packet was sent.

    • ::SL_STATUS_FAIL if the mfg test mode is not available or TONE or STREAM test is running.


Definition at line 179 of file stack/include/mfglib.h

mfglibSetChannel#

sl_status_t mfglibSetChannel (uint8_t chan)

Select the radio channel. The channel range is from 11 to 26.

Parameters
N/Achan

Valid values depend upon the radio used.

Customers can set any valid channel they want. Calibration occurs if this is the first time after power up.

@appusage Use this function to change channels.

Returns

  • One of the following:

    • ::SL_STATUS_OK if the channel has been set.

    • ::SL_STATUS_TRANSMIT_INVALID_CHANNEL if the channel requested is invalid.

    • ::SL_STATUS_FAIL if the mfg test mode is not available or TONE or STREAM test is running.


Definition at line 195 of file stack/include/mfglib.h

mfglibGetChannel#

uint8_t mfglibGetChannel (void )

Return the current radio channel, as previously set via mfglibSetChannel().

Parameters
N/A

@appusage Use this function to get current channel.

Returns

  • Current channel.


Definition at line 203 of file stack/include/mfglib.h

mfglibSetPower#

sl_status_t mfglibSetPower (uint16_t txPowerMode, int8_t power)

First select the transmit power mode, then include a method for selecting the radio transmit power.

Parameters
N/AtxPowerMode

Boost mode or external PA.

N/Apower

Power in units of dBm, which can be negative.

Valid power settings depend upon the specific radio in use. Ember radios have discrete power settings, and then requested power is rounded to a valid power setting. The actual power output is available to the caller via mfglibGetPower().

@appusage Use this function to adjust the transmit power.

Returns

  • One of the following:

    • ::SL_STATUS_OK if the power has been set.

    • ::SL_STATUS_TRANSMIT_INVALID_POWER if the power requested is invalid.

    • ::SL_STATUS_FAIL if the mfg test mode is not available or TONE or STREAM test is running.


Definition at line 223 of file stack/include/mfglib.h

mfglibGetPower#

int8_t mfglibGetPower (void )

Return the current radio power setting as previously set via mfglibSetPower().

Parameters
N/A

@appusage Use this function to get current power setting.

Returns

  • The current power setting.


Definition at line 231 of file stack/include/mfglib.h

mfglibSetOptions#

sl_status_t mfglibSetOptions (uint8_t options)

Set manufacturing library options.

Parameters
N/Aoptions

bitmask. 0 == non-CSMA transmits, 1 == CSMA transmits

@appusage Use this function to set manufacturing library options.

Returns

  • One of the following:

    • ::SL_STATUS_OK if the options have been set.

    • ::SL_STATUS_INVALID_PARAMETER if any options are unavailable.

    • ::SL_STATUS_FAIL if the mfg test mode is not available or TONE or STREAM test is running.


Definition at line 243 of file stack/include/mfglib.h

mfglibGetOptions#

uint8_t mfglibGetOptions (void )

Return the current manufacturing library options, as previously set via mfglibSetOptions().

Parameters
N/A

@appusage Use this function to get library options.

Returns

  • Current options based on the current test mode.


Definition at line 251 of file stack/include/mfglib.h

mfglibSetSynOffset#

void mfglibSetSynOffset (int8_t synOffset)

Set the synth offset in steps.

Parameters
N/AsynOffset

The number of steps to offset the carrier frequency (may be negative).

Set the synth offset in 9.375 kHz steps on EFR32. This function does NOT write the new synth offset to the token, it only changes it in memory. It can be changed as many times as preferred, and the setting will be lost when a reset occurs. The value will survive deep sleep, but will not survive a reset, thus it will not take effect in the bootloader. To make the value permanent (and accessible to the bootloader), the TOKEN_MFG_SYNTH_FREQ_OFFSET token must be written using the token API or Simplicity Commander.

@appusage Use this function to compensate for tolerances in the crystal oscillator or capacitors. This function does not effect a permanent change; once a preferred offset is found, it must be written to a token using the token API for it to be permanent.


Definition at line 271 of file stack/include/mfglib.h

mfglibGetSynOffset#

int8_t mfglibGetSynOffset (void )

Get the current synth offset in steps.

Parameters
N/A

Steps are 9.375 kHz on EFR32. See mfglibSetSynOffset() for details. Returns

  • The synth offset.


Definition at line 279 of file stack/include/mfglib.h

mfglibApiStart#

#define mfglibApiStart
Value:
(packet, linkQuality, rssi)

callback function pointer type for mfglibStart


Definition at line 86 of file stack/include/mfglib.h