[En-Nut-Discussion] TwMasterTransact is blocked

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Sep 11 10:52:27 CEST 2012


>>>>> "CAMBON," == CAMBON, Olivier <Olivier.CAMBON at astrium.eads.net> writes:

    CAMBON,> Dear all, I am a new user of the board Ethernut 2.1 ver C with
    CAMBON,> Nut/OS 4.10.1.  In my system, the ethernut board drives some
    CAMBON,> slave electronic using TWI / I2C bus.

    CAMBON,> I found in the documentation the API TwMasterRegRead and
    CAMBON,> TwMasterRegWrite but it seems that they are not implemented for
    CAMBON,> AVR.  So, a wrote my own "i2c_get" and "i2c_set" API.

    CAMBON,> The problem is that sometimes, in the function "i2c_set", the
    CAMBON,> call to "TwMasterTransact" is blocked.  I tried with or without
    CAMBON,> timeout. The result is the same. The TwMasterTransact does NOT
    CAMBON,> return.
Maybe the API is not yet available for AVR in 4.10.
You should try again with the old API with something like

      TwInit(0);
      if (TwMasterError())
        {
          /*FIXME: Toggle some pin here*/
        }    
      TwIOCtl(TWI_SETSPEED,&TWI_speed);
      if (TwMasterError())
        {
          /*FIXME: Toggle some pin here*/
        }
      rc =TwMasterTransact(a, lbuf, 1, NULL, 0, 1);

It's a pity that neither there is an example in the app directory using
either the old or the new Api. I will try to find time to write an example,
but don't hold your breath.

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------



More information about the En-Nut-Discussion mailing list