I2C SPI USB CAN eSPI Cable Testing View All Quick Start Guides User Manuals Software Downloads Knowledge Base Videos Case Studies App Notes White Papers Sales Support How to Order
Products Blog Sales Support Contact Search
Using the Promira Serial Platform or Aardvark I2C/SPI Host Adapter as a Slave Device

When developing and testing master devices, the ability to emulate a slave can be critical, especially when the actual peripheral hardware is unavailable or still in development. Total Phase’s Promira Serial Platform and Aardvark I2C/SPI Host Adapter both offer the ability to operate in slave mode, enabling engineers to emulate peripherals and verify master behavior.

Emulating a slave provides several benefits:

  • Verify communication: Confirm that the master sends the correct addresses, commands, and data, and handles acknowledgments properly.
  • Test firmware logic: Provide controlled responses so the master interprets data correctly and reacts as expected.
  • Edge case testing: Easily simulate out-of-range or unexpected data to ensure robust master behavior.
  • Repeatable tests: Perform consistent sequences for regression testing, validation, and firmware verification.

This flexibility is valuable in Research & Development labs, production test environments, and troubleshooting scenarios.

Supported Features in Slave Mode

Feature Promira Serial Platform Aardvark I2C/SPI Host Adapter
I2C/SPI Slave Support Yes Yes
Max I2C Slave Speed 3.4 MHz* 800 KHz
Max SPI Slave Speed 20 MHz* 4 MHz
Max Single Slave Response 256 Bytes 64 Bytes
API Support for Slave Mode Promira Software API I2C/SPI Active Aardvark Software API
I/O Voltage 0.9 V - 3.3 V, 5V 3.3 V

* Promira Serial Platform speeds depend on the licensed application.

Setting Up Slave Mode

Configuring Promira Serial Platform in Slave Mode

Hardware

You’ll need:

  •    Promira Serial Platform
  •    SPI or I2C Active Level Application license
  •   10-pin to 34-pin Header Cable, 34-pin Split Cable, 34-pin Grabber Cable, or 34-pin to 34-pin Header Cable.

Pinout Reference:
Refer to this section of the Promira Serial Platform User Manual for complete pinout information. 

Software

I2C Slave Mode (GUI method)

1.     Launch the Control Center Serial Software.

2.     Connect the Promira Serial Platform to your computer and select it from the available devices list.

3.     Navigate to Adapter > I2C + SPI.

4.     Optionally, enable I2C Pulls-Ups and/or Target Power.

5.     Select the Slave tab under I2C Control to display slave mode controls.

6.     Enter the slave address (standard 7-bit addressing)

7.    Configure Optional Parameters: Set the maximum transmit (Tx) and receive (Rx) bytes, and define a slave response message (up to 256 bytes) if needed, according to your application’s requirements.

8.     Click “Set Resp.” to store the defined slave response.

9.     Click Enable to activate I2C slave mode. The Promira platform will now respond to master transactions as configured.

 

SPI Slave Mode (GUI method)

1.     Launch the Control Center Serial Software.

2.     Connect the Promira Serial Platform to your computer and select it from the available devices list.

3.     Navigate to Adapter > I2C + SPI.

4.     Optionally, enable Target Power.

5.     Select the Slave tab under SPI Control to display slave mode controls.

6.     Configure the bus settings to match the master device:

  • Polarity: choose Rising/Falling or Falling/Rising.
  • Phase: choose Sample/Setup or Setup/Sample.
  • Bit Order: MSB or LSB.

7.     Configure Optional Parameters: In the MISO Message field, enter the data you want the Promira platform to send when addressed by the master (up to 256 bytes), according to your application’s requirements.

8.     Click Set MISO to store the defined response.

9.     Click Enable to activate SPI slave mode. The Promira platform will now respond to master transactions as configured.

 

API Method

Promira I2C Slave Setup

1.     Open the Promira platform and channel

  • Use pm_open() to open the platform.
  • Use pm_load(pm, APP NAME) to load the I2C Active Application.
  • Use ps_app_connect(ip) to connect to the application.
  • Use ps_channel_open(conn) to open a channel.
  • Once you have a valid channel, proceed with I2C slave setup.

2.     Configure the I2C environment

  • Use ps_app_configure(PromiraChannelHandle channel, PS_APP_CONFIG_I2C) to enable I2C.
  • Use ps_i2c_pullup(PromiraChannelHandle channel, u08 pullup_mask) to enable bus pull ups.
  • Use ps_phy_target_power(PromiraChannelHandle channel, u08 power_mask) to power the target (optional).

3.     Set the initial slave response

  • Use ps_i2c_slave_set_resp(PromiraChannelHandle channel, u08 num_bytes, const u08 * data_out)
  • Max buffer: 256 bytes.

4.     Enable I2C slave mode

  • Use ps_i2c_slave_enable(PromiraChannelHandle channel, u08 addr, u16 maxTxBytes, u16 maxRxBytes)
  • addr: lower 7 bits = slave address
  • maxTxBytes: 0 = unlimited transmit.
  • maxRxBytes: 0 = unlimited receive.

5.     Poll for asynchronous transactions

  • Use ps_i2c_slave_poll(PromiraChannelHandle channel, int timeout) to check for pending master transactions.
  • If the master has written data, call ps_i2c_slave_read(PromiraChannelHandle channel, u08 * addr, u16 num_bytes, u08 * data_in u16 * num_read) to read the received bytes.
  • If the master has requested a read, the slave automatically transmits the buffer set with ps_i2c_slave_set_resp (PromiraChannelHandle channel, u08 num_bytes, const u08 * data_out).
  • Repeat until no data is available.

6.     Disable slave mode and close the device

  • Use ps_i2c_slave_disable(PromiraChannelHandle channel). Then close:
  • ps_channel_close(PromiraChannelHandle channel).
  • ps_app_disconnect(PromiraConnectionHandle conn).
  • pm_close().

Promira SPI Slave Setup

1.     Open the Promira platform and channel

  • Usepm_open() to open the platform.
  • Use pm_load(pm, APP NAME) to load the SPI Active Application.
  • Use ps_app_connect(ip) to connect to the application.
  • Use ps_channel_open(conn) to open a channel.
  • Once you have a valid channel, proceed with SPI slave setup.

2.     Configure SPI environment

  • Use ps_app_configure (PromiraChannelHandle channel, PS_APP_CONFIG_SPI) to open the platform.
  • Use ps_phy_target_power (PromiraChannelHandle channel, u08 power_mask) to set the Promira platform’s power mode.
  • Use ps_spi_configure (PromiraChannelHandle channel, PromiraSpiMode mode, PromiraSpiBitorder bitorder, u08 ss_polarity) to configure SPI mode/bit order.
  • Use ps_spi_enable_ss (PromiraChannelHandle channel, u08 ss_enable) to enable Slave Select (SS) line(s).

3.     Set the initial slave response

  • Use ps_spi_std_slave_set_resp(PromiraChannelHandle channel, u16 num_bytes, const u08 * data_out).
  • Max buffer: 256 bytes.

4.     Enable SPI slave mode

  • Use ps_spi_slave_enable(PromiraChannelHandle channel, PS_SPI_SLAVE_MODE_STD).
  • Then configure SPI slave parameters ps_spi_std_slave_configure(PromiraChannelHandle channel, PromiraSpiMode io, u08 flags).
  • Set host read size (splits large transactions automatically) ps_spi_slave_host_read_size(PromiraChannelHandle channel, u32 read_size).

5.     Poll for asynchronous transactions

  • Use ps_spi_slave_poll(PromiraChannelHandle channel, int timeout) to check for incoming data.
  • If the master has written data, call ps_spi_slave_read(PromiraChannelHandle channel, PromiraSpiSlaveReadInfo * read_info, u32 in_num_bytes, u08 * data_in) to read the received bytes.
  • If the master has requested a read, the slave automatically transmits the buffer set with ps_spi_std_slave_set_resp (PromiraChannelHandle channel, u16 num_bytes, const u08 * data_out).
  • Repeat until no data is available.

6.     Disable slave mode and close the device

  • Use ps_spi_slave_disable(PromiraChannelHandle channel). Then close:
  • ps_channel_close(PromiraChannelHandle channel).
  • ps_app_disconnect(PromiraConnectionHandle conn).
  • pm_close().

Important Notes for Promira Slave Mode:

Static Responses: The Promira platform does not interpret master requests or generate responses dynamically or on the fly. Responses must be predefined in the software/API whenever a new response is required.

Set Slave Response: It is always advisable to set the slave response before first enabling the slave. This ensures that valid data is sent to any requesting master.

Send Continuous Stream of Data: Use the Promira Software API to wrap data across transactions in SPI slave mode.

User Manual: See the Promira Serial Platform User Manual for full API function references. Example Python scripts for configuring I2C/SPI Slave Mode can also be found in the API example files.

Configuring Aardvark I2C/SPI Host Adapter in Slave Mode

Hardware

You’ll need:

  • Aardvark I2C/SPI Host Adapter
  • 10-pin ribbon cable or 10-pin split cable

Pinout Reference:
Refer to this section of the Aardvark I2C/SPI Host Adapter for complete pinout information.

Software

I2C Slave Mode (GUI method)

1.     Launch the Control Center Serial Software.

2.     Connect the Aardvark I2C/SPI Host Adapter to your computer and select it from the available devices list.

3.     Navigate to Adapter > I2C + SPI.

4.     Optionally, enable I2C Pulls-Ups and/or Target Power.

5.     Select the Slave tab under I2C Control to display slave mode controls.

6.     Enter the slave address (standard 7-bit addressing)

7.     Configure Optional Parameters: Set the maximum transmit (Tx) and receive (Rx) bytes, and define a slave response message (up to 64 bytes) if needed, according to your application’s requirements.

8.     Click “Set Resp.” to store the defined slave response.

9.     Click Enable to activate I2C slave mode. The Aardvark adapter will now respond to master transactions as configured.

SPI Slave Mode (GUI method)

1.     Launch the Control Center Serial Software.

2.     Connect the Aardvark I2C/SPI Host Adapter to your computer and select it from the available devices list.

3.     Navigate to Adapter > I2C + SPI.

4.     Optionally, enable Target Power.

5.     Select the Slave tab under SPI Control to display slave mode controls.

6.     Configure the bus settings to match the master device:

  • Polarity: choose Rising/Falling or Falling/Rising.
  • Phase: choose Sample/Setup or Setup/Sample.
  • Bit Order: MSB or LSB.

7.     Configure Optional Parameters: In the MISO Message field, enter the data you want the Aardvark adapter to send when addressed by the master (up to 64 bytes), according to your application’s requirements.

8.     Click Set MISO to store the defined slave response.

9.     Click Enable to activate SPI slave mode. The Aardvark adapter will now respond to master transactions as configured. 

API Method

Aardvark I2C Slave Setup

1.     Open the Aardvark port

  • Use aa_open() to obtain an Aardvark handle.

2.     Configure the Aardvark for I2C mode

  • Use aa_configure (Aardvark aardvark, AA_CONFIG_SPI_I2C).
  • Optionally configure pullup resistors using aa_i2c_pullup (Aardvark aardvark, aa_u08 pullup_mask).
  • Optionally configure target power if needed using aa_target_power (Aardvark aardvark, aa_u08 power_mask).

3.     Set the initial slave response

  • Use aa_i2c_slave_set_response (Aardvark aardvark, aa_u08 num_bytes, const aa_u08 * data_out).
  • Max buffer: 64 bytes.

4.     Enable I2C slave mode

  • Use aa_i2c_slave_enable (Aardvark aardvark, aa_u08 addr, aa_u16 maxTxBytes, aa_u16 maxRxBytes).
  • addr: lower 7 bits = slave address
  • maxTxBytes: 0 = unlimited transmit.
  • maxRxBytes: 0 = unlimited receive.

5.     Poll for asynchronous transactions

  • Use aa_async_poll(Aardvark aardvark, int timeout) to check for pending master transactions.
  • If the master has written data, call aa_i2c_slave_read (Aardvark aardvark, aa_u08 * addr, aa_u16 num_bytes, aa_u08 * data_out) to read the received bytes.
  • If the master has requested a read, the slave automatically transmits the buffer set with aa_i2c_slave_set_response (Aardvark aardvark, aa_u08 num_bytes, const aa_u08 * data_out).

6.     Disable slave mode and close the device

  • Use aa_i2c_slave_disable(Aardvark aardvark) and aa_close(Aardvark aardvark).

Aardvark SPI Slave Setup

1.     Open the Aardvark port

  • Use aa_open() to obtain an Aardvark handle.

2.     Configure the Aardvark for SPI mode and clock phase

  • Use aa_configure (Aardvark aardvark, AA_CONFIG_SPI_I2C).
  • Use aa_spi_configure (Aardvark aardvark, AardvarkSpiPolarity polarity, AardvarkSpiPhase phase, AardvarkSpiBitorder bitorder).
  • Optionally disable target power if not needed using aa_target_power (Aardvark aardvark, aa_u08 power_mask).

3.     Set the initial slave response

  • Use aa_spi_slave_set_response (Aardvark aardvark, aa_u08 num_bytes, const aa_u08 * data_out).
  • Max buffer: 64 bytes.
  • Must be greater than zero.

4.     Enable SPI slave mode

  • Use aa_spi_slave_enable (Aardvark aardvark).

5.     Poll for asynchronous transactions

  • Use aa_async_poll(Aardvark aardvark, int timeout) to check for pending SPI transactions.
  • If the master has written data, call aa_spi_slave_read (Aardvark aardvark, aa_u16 num_bytes, aa_u08 * data_in) to read the received bytes.
  • If the master has requested a read, the slave automatically transmits the buffer set with aa_spi_slave_set_response (Aardvark aardvark, aa_u08 num_bytes, const aa_u08 * data_out).

6.     Disable slave mode and close the device

  • Use aa_spi_slave_disable(Aardvark aardvark) and aa_close(Aardvark aardvark).

 

Important Notes for Aardvark I2C Slave Mode: 

Static Responses: The Aardvark adapter does not interpret master requests or generate responses dynamically or on the fly. Responses must be predefined in the software/API whenever a new response is required.

Set Slave Response: It is always advisable to set the slave response before first enabling the slave. This ensures that valid data is sent to any requesting master.

User Manual: See the Aardvark I2C/SPI Host Adapter User Manual for full API function references. Example Python scripts for configuring I2C/SPI Slave Mode can also be found in the API example files.

 

Emulating a Simple I2C Sensor with the Aardvark/Promira in Slave Mode

 

You’re developing firmware for an MCU that communicates with a temperature sensor at I2C address 0x50.

The physical sensor isn’t yet available, but you still need to verify the MCU’s I2C communication and firmware logic. By using the Aardvark adapter or Promira platform in slave mode, you can emulate the sensor so the MCU behaves as if the real device is connected.

Control Center Serial Software Setup (Promira Serial Platform Example):

1. Launch Control Center Serial Software.
2. Connect your Promira Serial Platform and select it under Available Devices

Figure 1: Connect Device in Control Center Serial Software

3. Navigate to Adapter > I2C + SPI and select the I2C Slave tab.
4. Enter the Slave Address 0x50 (slave address should match device being emulated).
5. Enter the response bytes [19] to return temperature reading (0x19 for 25°C).
6. Click Set Resp., then Enable.

Figure 2: Slave Response Enabled

Testing a Master Read (Temperature Example)

1.     From your I2C master device, send a read transaction to the slave address 0x50.

2.     The Promira platform automatically responds with the bytes you configured.

3.     On the master side, validate the following:

  • Address Check: Confirm the MCU issues a read to 0x50 and properly handles ACK/NACK conditions.
  • Data handling: Ensure the MCU correctly interprets the returned value (0x19 = 25°C).

4.   Error handling (optional): Update the slave response to send alternate data (e.g., 0x32) and confirm that the firmware reacts appropriately.

5.   The Beagle I2C/SPI Protocol Analyzer can then be used to monitor and display the I2C communication in real-time.

  

Caveats & Workarounds:

  • To simulate different responses, update the stored response between transactions.
  • When using the API, If the master polls the slave frequently, you can insert a short delay (e.g., 10–50 ms) between the master’s request and read. This may allow the host software to update the slave response via the API in time for that read. This can help for specific test cases, but the adapter does not interpret master requests. Any changes to the response must be handled manually by the host software, so careful timing and synchronization are required.

 

Other Applications of Slave Emulation

Simulating Missing Peripherals

During early development, the actual I2C or SPI peripheral might not yet be available. Using the Promira platform or Aardvark adapter in slave mode, you can emulate that device by configuring the expected address and setting a predefined data pattern. This allows firmware teams to continue development and test master behavior without waiting for final hardware, reducing project delays.

Rapid Prototyping

When testing multiple potential designs or firmware variations, the ability to quickly swap between simulated slave devices is a major advantage. Instead of rewiring or flashing different firmware onto prototype boards, you can simply reconfigure the slave address and data in software. This accelerates iterative testing and allows comparison of master behavior under different device conditions, either sequentially on a single adapter or simultaneously using multiple adapters.

Address Simulation 

Some systems require the master to communicate with multiple slave addresses, or to perform a general call to detect connected devices. With the Aardvark adapter or Promira platform, you can configure the adapter to emulate specific slave addresses or respond to a general call, to verify the master’s address resolution logic. This is particularly useful for SMBus systems, battery management systems, and multi-sensor environments where address conflicts or misreads could cause operational failures. Note that a single adapter can only emulate one slave address at a time, so testing multiple addresses requires sequential configuration or multiple adapters.

Edge Case Testing

Real peripherals may not easily generate unusual, extreme, or faulty values. Emulated slaves can provide out-of-range values or rapid changes. This helps ensure that the master device or firmware handles errors and unusual conditions as expected.

Firmware Validation

By emulating peripherals, you can verify that master firmware correctly handles communication protocols, ACK/NACK responses, and timing without risking damage to a real device. This is valuable during development, validation, and troubleshooting phases.

Related Products