ATmega16 i2c (TWI) i bit TWEA

Aug 08, 2006 3 Replies

Jakie znaczenie ma bit TWEA, gdy ATmega pracuje w trybie podrzednym i wysyla dane do mastera ? W ksiazce "Mikrokontrolery AVR ATmega w praktyce" Baranowskiego (str.117) napisane jest, ze "okresla on, czy spodziewany jest odbior potwierdzenia". Nie rozumiem tego, przeciez to master decyduje o tym, czy dane maja byc nadal przesylane (jesli wystawi ACK) czy juz nie (dla NACK), wiec po co slave ma okreslac czy spodziewane jest potwierdzenie ?



Heliogabal


Heliogabal napisał(a):

Cytat z data sheet: If the TWEA bit is written to zero during a transfer, the TWI will transmit the last byte of the transfer. State $C0 or state $C8 will be entered, depending on whether the Master Receiver transmits a NACK or ACK after the final byte. The TWI is switched to the not addressed Slave mode, and will ignore the Master if it continues the transfer. Thus the Master Receiver receives all “1” as serial data. State $C8 is entered if the Master demands additional data bytes (by transmitting ACK), even though the Slave has transmitted the last byte (TWEA zero and expecting NACK from the Master).

Pozdr AK

Użytkownik "AK":

Rozumiem, ze w normalnej sytuacji powinno byc TWEA=1, ale jesli TWEA=0 to master zostanie wprowadzony w blad, tak ? Mamy tu taka sytuacje, ze master oczekuje danych, bo wystawil ACK, a tu nagle slave sie wylaczyl i w ten sposob zamiast faktycznych danych master otrzymuje same jedynki. I taki odbior trwa dopoki odczyta tyle bajtow, ile sobie zaplanowal nie wiedzac nawet, ze slave juz nie reaguje. Gdzie tu sens ?

Heliogabal

Heliogabal napisał(a):

Np. Slave emuluje pamiec EEPROM i master proboje czytac poza dozwolonym obszarem ?

Pozdr AK

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required