AnsweredAssumed Answered

HAL I2C slave busy

Question asked by chuev.vladimir on Apr 18, 2018

I'm trying to use the I2C slave in DMA mode.

 

uint8_t aRxBuffer;
HAL_I2C_Slave_Receive_DMA(&hi2c1, (uint8_t*)&aRxBuffer, 1);

But HAL_I2C_Slave_Receive_DMA returns HAL_BUSY.

 

At the same time I have no other devices on the bus.

 

SDA and SCL pulling to VIO

 

Init code:

static void MX_I2C1_Init(void) {
    hi2c1.Instance = I2C1;
    hi2c1.Init.ClockSpeed = 400000;
    hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_16_9;
    hi2c1.Init.OwnAddress1 = 0x20 << 1;
    hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
    hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
    hi2c1.Init.OwnAddress2 = 0;
    hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
    hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
    if (HAL_I2C_Init(&hi2c1) != HAL_OK) {
        _Error_Handler(__FILE__, __LINE__);
    }
}

Outcomes