Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

TWI slave transmit on AVR seemd not to work (R1436@WIN10)

2 posters

Go down  Message [Page 1 of 1]

TimFisch

TimFisch

So, after long time I might found another issue / missing base functionality: It seems, that the slave transmit for TWI on AVR does push the TWI data register correctly onto the SDA line.

Situation:
  • two 328mega are connected via TWI (with 10kOhm Pullups)
    • Master and its Uart / Mcu Monitor on the right.
    • Slave and its Uart / Mcu Monitor on the left.


  • Master sends data to slave (address 0x80).
    • Slave can read it and prints it on UART.
    • signal in Master TWDR, Slave TWDR and SDA is correct


  • Master sends request for data to slave (address 0x81).
    • Slave gets TWSR = 0xA8: "Own SLA+R has been received; ACK has been returned"
      (video 9:17)
    • Slave set TWDR = 0x63
      (video 9:28)
    • Slave get into state TWSR = 0xB8: "Data byte in TWDR has been transmitted; ACK has been received"
      (video 12:23)
    • data on SDA line = 0x00 , not like TWDR = 0x63 ...



Sources:
  • c code, hex and simu: here
  • Video (shows also the PCs of both AVRs, speed slowed down to see single steps)



The code stems from here and uses Peter Fleurys TWI Lib.

https://wiki.mexle.hs-heilbronn.de/

arcachofo

arcachofo

Which code is the slave executing? "Slave test program" or "Slave source code"

TimFisch

TimFisch

Both. "slave source Code" is the lib twislave.c/h and the other one the implementation of the lib in a main function.

arcachofo likes this post

https://wiki.mexle.hs-heilbronn.de/

arcachofo

arcachofo

Hopefully solved at trunk Rev 1448.

TimFisch likes this post

TimFisch

TimFisch

Thanks for the Fast response.
Could you make a test build out of it? Then I would check it 🙂

https://wiki.mexle.hs-heilbronn.de/

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum