Skip to main content
Visitor II
December 1, 2023
Question

To write I2C functions using interrupts and DMA

  • December 1, 2023
  • 2 replies
  • 1308 views

Bonjour,

Pouvez-vous me dire pourquoi cette façon d'écrire lors d'une transmission I2c par interruption ou DMA ne fonctionne pas :

EN: Hello,

Can you tell me why this way of writing during an I2c transmission by interrupt or DMA does not work?

annuler PAC194X_Transmit(s_PAC194X *pObj)
{
           HAL_I2C_Master_Transmit_IT(&pObj->I2C, (pObj->I2C_ADD<<1), pObj->BufferTX, pObj->SizeBufferTX); 
}

Voici ce que j'ai dû faire pour que cela fonctionne :
EN: Here's what I had to do to make it work:

annuler PAC194X_Transmit(s_PAC194X *pObj)
{
  si (pObj->I2C.Instance == hi2c4.Instance)
  {
      HAL_I2C_Master_Transmit_IT(&hi2c4, (pObj->I2C_ADD<<1), pObj->BufferTX, pObj->SizeBufferTX);
  }
}

en mode blocage, cela fonctionne avec la première méthode.

Merci
Rom

EN: 

in blocking mode, it works with the first method.

Thanks
Rom

 

    This topic has been closed for replies.

    2 replies

    Graduate
    December 1, 2023

    Bonjour,

    Excuzes-moi de douter de vous.

    La majeure partie de ce forum est en anglais. Je parle un peu Francais c'est tout.

    I wonder if the above was translated from English to French prior to submission. The "tell-tale" is the use of "si" in the source-code, where I might expect "if" in regular "C".

    Super User
    December 1, 2023

    The first argument to HAL_I2C_Master_Transmit_IT should be a handle, not an instance.

    Unclear what s_PAC194X->I2C is and you haven't provided much info about it.