I'm using I2C in a project on STM32, and i was wondering what's the difference between HAL_I2C_Master_Transmit and HAL_I2C_mem_write, and the difference between HAL_I2C_Master_Receive and HAL_I2C_mem_read.


1 Answer 1


The MEM functios can directly read and write devices that have register address based access. They write the register addresss before reading or writing the register data. Most chips are like this. The non-MEM functions just do simple reads and writes.

  • 4
    \$\begingroup\$ Adding on to your description: The non-MEM functions send start bit, slave I2C address, data, and stop bit. The MEM functions send start bit, slave I2C address, slave internal mem address, repeat start bit, data, and stop bit. \$\endgroup\$
    – kkrambo
    Feb 7, 2020 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.