Qwiic Artemis Nano - SAMD21 RF Pro

I am trying to connect Artemis Nano as master with SAMD21 RF pro as slave in address 0x4. But I get always error 134217730 in blocking transfer. Is pin config correct?

const uint8_t iomaster_instance = 0;

pad_SCL = 5;

fncsel_SCL = AM_HAL_PIN_5_M0SCL;

pad_SDA = 6;

fncsel_SDA = AM_HAL_PIN_6_M0SDAWIR3;

uint32_t retVal32 = 0;

void* iomaster_handle;

am_hal_iom_config_t iomaster_config = {

.eInterfaceMode = AM_HAL_IOM_I2C_MODE,

.ui32ClockFreq = AM_HAL_IOM_100KHZ,

};

am_hal_gpio_pincfg_t iomaster_pin_config;

memset((void*)&iomaster_pin_config, 0x00, sizeof(am_hal_gpio_pincfg_t));

iomaster_pin_config.eDriveStrength = AM_HAL_GPIO_PIN_DRIVESTRENGTH_12MA;

iomaster_pin_config.eGPOutcfg = AM_HAL_GPIO_PIN_OUTCFG_OPENDRAIN;

iomaster_pin_config.uIOMnum = iomaster_instance;

iomaster_pin_config.ePullup = AM_HAL_GPIO_PIN_PULLUP_1_5K;

iomaster_pin_config.ePowerSw = 0;

iomaster_pin_config.eGPInput = 0;

iomaster_pin_config.eIntDir = 0;

iomaster_pin_config.eGPRdZero = 0;

iomaster_pin_config.uNCE = 0;

iomaster_pin_config.eCEpol = 0;

iomaster_pin_config.uRsvd22 = 0;

iomaster_pin_config.uFuncSel = fncsel_SCL;

retVal32 = am_hal_gpio_pinconfig(pad_SCL, iomaster_pin_config);

iomaster_pin_config.uFuncSel = fncsel_SDA;

retVal32 = am_hal_gpio_pinconfig(pad_SDA, iomaster_pin_config);

retVal32 = am_hal_iom_initialize(iomaster_instance, &iomaster_handle);

retVal32 = am_hal_iom_power_ctrl(iomaster_handle, AM_HAL_SYSCTRL_WAKE, false);

retVal32 = am_hal_iom_configure(iomaster_handle, &iomaster_config);

retVal32 = am_hal_iom_enable(iomaster_handle);

// Start transfer

am_hal_iom_transfer_t iomaster_transfer = {0};

iomaster_transfer.uPeerInfo.ui32I2CDevAddr = 4;

iomaster_transfer.ui32InstrLen = 0;

iomaster_transfer.ui32Instr = 0;

iomaster_transfer.bContinue = false;

iomaster_transfer.ui8RepeatCount = 0;

iomaster_transfer.ui8Priority = 1;

iomaster_transfer.ui32PauseCondition = 0;

iomaster_transfer.ui32StatusSetClr = 0;

iomaster_transfer.eDirection = AM_HAL_IOM_TX;

iomaster_transfer.pui32TxBuffer = (uint32_t*)tx_buffer;

iomaster_transfer.ui32NumBytes = 2;

iomaster_transfer.pui32RxBuffer = NULL;

uint32_t retVal32 = am_hal_iom_blocking_transfer(iomaster_handle, &iomaster_transfer);

ERROR return value == 134217730

You’re trying to connect two I2C master’s together and that’s probably what’s causing the error you’re seeing.

Both the [Pro RF - LoRa and the [Artemis Nano are microcontrollers programmed to be I2C masters and having both on the same bus is trouble.

You might be able to make your own firmware for the Pro RF that creates a slave I2C port that the Artemis can connect too though. That would allow you to communicate between the boards via I2C.](https://www.sparkfun.com/products/15443)](SparkFun Pro RF - LoRa, 915MHz (SAMD21) - WRL-15836 - SparkFun Electronics)