Skip to content

I2C communication needs interrupt protection #2

Description

@BastelBaus

Thanks for this helpfull code!

My bus got stuck when using the lib, probably this topic. I had to protect the read/write operations from interrupts, then it worked, example:

void MPU6050_Writebytes(uint8_t reg_addr, uint8_t len, uint8_t* data)
{
	__disable_irq();
	HAL_I2C_Mem_Write(&hi2c1, MPU6050_ADDR, reg_addr, I2C_MEMADD_SIZE_8BIT, data, len, 1);
	 __enable_irq();
}

BR, BastelBaus

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions