cancel
Showing results for 
Search instead for 
Did you mean: 

To write I2C functions using interrupts and DMA

Rom
Associate

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

 

2 REPLIES 2
Danish1
Lead II

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".

TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".