cancel
Showing results for 
Search instead for 
Did you mean: 

HAL I2C slave busy

Chuev.Vladimir
Associate III
Posted on April 18, 2018 at 11:23

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__);

    }

}

#i2c-slave #hal_i2c
1 REPLY 1

Sorry, bumping old zombie unanswered threads off my feed

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..