You need to log in to create posts and topics.

Maybe bug in AVR USI (Attiny85)

PreviousPage 2 of 2

Happy to help !

santigoro has reacted to this post.
santigoro

Hi again 😉

Just a little new modification in avrusi.cpp :

void AvrUsi::callBack()  // Called at Timer0 Compare Match
{
    shiftData();
    stepCounter();    
    setOutput();
}

shitfData() must be called before stepCounter() call.

When sending data, that's not important, but when receiving data the buffer (USIBR) has to be updated after reading Pin data.

Thank you.

I will have a look, there are other places where shiftData() and stepCounter() are called.
Not sure why it is in this order, but I kind of remember that it was a reason,  at least for some cases.

I guess this is specific to the Timer Compare Match, because all actions are taken (sequentially) at the same time. Others modes of operations separate stepCounter() and I/O on different edges of the clock.

Yes, that makes sense.

PreviousPage 2 of 2