Post Go back to editing

I2C / TWI Master Mode Receive and Nak / Acknowledge

Hello,

    I am having a problem with an I2C device and reading from it. I start a master mode receive conversation by sending the slave's address and the receive bit set high. The device should then respond by sending a stream of bytes back until I tell it to stop. I tell it to stop by using a high acknowledge. I can continuing reading by using a low acknowledge after each byte.

    My problem is that I can only receive one byte at a time because I always acknowledge high. Looking at the 21369 hardware reference manual, the acknowledge does not look programmable. At least not in master mode. I see that it might be in Slave mode.

    If my only solution was to operate in slave mode, how would that work? Could a send out the address byte in Master mode and quickly switch to slave receive before the device starts sending data back? I see this as the only solution and will probably start looking into it more after I finish this post.

   I attached a picture from the scope to help clarify the problem.

Thanks in advance,

Glen

Parents
  • Hi Mitesh,

         There is only one device on the TWI bus. It is a MAXIM MAX1039 12 channel A/D. The SHARC is a 21369 running at 325 MHz. The external clock speed is set at 130 MHz. I've attached all code regarding TWI. I think that sending the whole project would be very confusing. Its very large. I've attached the main.asm as well.

         Regarding interrupt masking, yes it seems that I will get interrupts for TWITXINT, TWIRXINT, TWIMCOM and TWIMERR even if those bits are not set in the TWIIMASK register. It is as if the IMASK register is ignored.

    Thanks again

    attachments.zip
Reply
  • Hi Mitesh,

         There is only one device on the TWI bus. It is a MAXIM MAX1039 12 channel A/D. The SHARC is a 21369 running at 325 MHz. The external clock speed is set at 130 MHz. I've attached all code regarding TWI. I think that sending the whole project would be very confusing. Its very large. I've attached the main.asm as well.

         Regarding interrupt masking, yes it seems that I will get interrupts for TWITXINT, TWIRXINT, TWIMCOM and TWIMERR even if those bits are not set in the TWIIMASK register. It is as if the IMASK register is ignored.

    Thanks again

    attachments.zip
Children
No Data