STM32 and I2C EEPROM: "how to" use EEPROMs avoiding uC hanging

Поділитися
Вставка
  • Опубліковано 28 січ 2025

КОМЕНТАРІ • 5

  • @victortagayun-github-io
    @victortagayun-github-io 11 місяців тому

    did you try to usee DMA?

    • @bluewat
      @bluewat  11 місяців тому

      hmm, I haven't done specific tests on I2C data transfer, but normally on short size data set, polling mode is faster than DMA. That's because DMA needs time to setup and start.
      In my projects I use EEPROM to save single data or short arrays (for instance: text strings for multi-language projects setup), in any case data transfers below 20, 30... 50 bytes. Even if DMA would be able to give faster results (and I suppose it can't), benefit would be very low. And considering that DMA needs a more complex project (project setup, interrupt handling,...) that makes me to say that... handling EEPROMS there is no reason to involve DMA.
      But,
      do you have results that lead to different conclusions?

    • @victortagayun-github-io
      @victortagayun-github-io 11 місяців тому

      In theory, transfer time would be the same, if that is what you mean. But CPU time would be shorter. SPI, DAC, among others, are easier to set up with DMA. But, I am just starting with I2C and thought you might have experience with it.

    • @bluewat
      @bluewat  11 місяців тому

      As I said I do not have data about I2C but here there is a comparison on polling/interrupt/DMA data transfer on SPI: ua-cam.com/video/oWx1-WmTwag/v-deo.htmlsi=A36OWTMDMsqaQXxw

    • @victortagayun-github-io
      @victortagayun-github-io 11 місяців тому

      The reason why I asked if you try to use DMA is because HAL_I2C_Mem_Read seems to work while HAL_I2C_Mem_Read_DMA seems to hang. I enable DMA in CubeMX.