Advertisement
zmatt

TI OMAP I2C controller notes

Nov 17th, 2023
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.00 KB | None | 0 0
  1. seneral limitations:
  2. state machine locks up under various circumstances
  3. master mode limitations:
  4. requires transfer length be specified before starting transfer
  5. stop condition must be requested *before* last data byte is transferred
  6. therefore cannot perform 0-byte transfers
  7. doesn't handle NACKs well
  8. slave mode limitations:
  9. always ACKs its slave address(es), every data byte written
  10. only stalls if requested before slave address is recognized or on
  11. fifo overrun/underrun
  12. always ACKs general call, cannot stall except by fifo full
  13.  
  14.  
  15.  
  16. AL, NACK, ARDY, AERR, BF, AAS are events. AAS also auto-clears at stop or
  17. repeated start, but I get the impression this isn't reliable.
  18.  
  19. RRDY is sticky: it is forced high by a level status, needs manual clearing but
  20. this will not succeed unless the level is low. XRDY is sticky in master mode
  21. but a normal event in slave mode.
  22.  
  23. BB is level and cannot be enabled. It is nevertheless shown in irqstatus.
  24.  
  25. XUDF and ROVR are level but also have sticky versions. If they are enabled,
  26. the sticky version is visible in both irqrawstatus and irqstatus. If they are
  27. disabled, the level is visible in both irqrawstatus and irqstatus. Manual set
  28. and clear acts on the sticky event even if not enabled (but clearing will only
  29. succeed if the level is low).
  30.  
  31.  
  32.  
  33. Notation for I²C bus:
  34. < = SDA falling with SCL high
  35. > = SDA rising with SCL high
  36. . = SCL falling
  37. 0 = SCL rising with SDA low
  38. 1 = SCL rising with SDA high
  39. x = 0 or 1
  40. hence
  41. <. = start condition
  42. 1<. = repeated start condition
  43. x. = data bit
  44. 0. = data bit: 0
  45. 1. = data bit: 1
  46. 0> = stop condition
  47.  
  48. Notation for irqs/events:
  49. +FOO = level status set (sticky event set and can't be cleared)
  50. -FOO = level status unset (sticky event can now be cleared)
  51. ^FOO = event pulsed (set but can be cleared)
  52. +addr/-addr refers to a bit being set/cleared in ACTOA register
  53.  
  54.  
  55. slave transmitter:
  56. < +BB
  57. .x.x.x.x.x.x.x.
  58. 1 +addr ^AAS
  59. +XUDF (if fifo empty)
  60. .0. ^XRDY (if fifo empty)
  61. (waits until stall bit is cleared)
  62. +XUDF (waits until fifo non-empty)
  63. -XUDF data written, tx-bufstat decremented (mod 64)
  64. x.x.x.x.x.x.x.x
  65. . +XUDF
  66. 0. ^XRDY
  67. -XUDF data written, tx-bufstat decremented (mod 64)
  68. x.x.x.x.x.x.x.x
  69. . +XUDF
  70. 1. ^NACK
  71. 0> -XUDF ^ARDY tx-bufstat is reset to count
  72. -addr
  73. -BB ^BF
  74.  
  75. slave transmitter with stall bit set and stray data in tx fifo:
  76. < +BB (even in the presence of arbitrary delays).
  77. .x.x.x.x.x.x.x.
  78. 1 +addr ^AAS
  79. .0. (stalling begins)
  80. (fifo cleared)
  81. +XUDF (stall bit cleared, may be immediately set again)
  82. -XUDF (data written)
  83. (continues as before)
  84.  
  85. restart:
  86. 1< -XUDF ^ARDY tx-bufstat reset to count
  87. .x.x.x.x.x.x.x.
  88. 1 ±addr ^AAS
  89.  
  90. slave receiver:
  91. < +BB
  92. .x.x.x.x.x.x.x.
  93. 0 +addr ^AAS
  94. .0. (waits until stall bit is cleared)
  95. x.x.x.x.x.x.x.
  96. x +RRDY rx-bufstat incremented
  97. -RRDY data read, bufstats decremented
  98. .0.x.x.x.x.x.x.x.
  99. x +RRDY rx-bufstat incremented
  100. .0.x.x.x.x.x.x.x.
  101. x +RRDY rx-bufstat incremented
  102. .0.0> -addr -BB ^BF
  103. data read, bufstats decremented
  104. -RRDY data read,
  105. ^ARDY bufstats reset
  106.  
  107. filling the rx fifo:
  108. x rx-bufstat incremented to FIFO size - 1
  109. .0.x.x.x.x.x.x.x.
  110. x rx-bufstat incremented (mod FIFO size) to 0
  111. .0.x.x.x.x.x.x.x.
  112. x +ROVR
  113. .0. (stalling begins)
  114. -ROVR data read, tx-bufstat decremented
  115. data read, bufstats decremented
  116.  
  117. slave receiver + restart to transmitter:
  118. x +RRDY rx-bufstat incremented
  119. .0.
  120. 1< (no ARDY due to data in rx fifo)
  121. .x.x.x.x.x.x.x.
  122. 1 ^AAS +XUDF
  123. .0. ^XRDY (stalling)
  124. -RRDY data read, bufstats decremented
  125.  
  126.  
  127. master transmitter:
  128. set count, tx-bufstat resets
  129. +MST +WRITE +S +XRDY
  130. (waits until bus free)
  131. -S -XRDY
  132. <. +BB
  133. repeat{
  134. +XRDY write data, tx-bufstat decremented to nonzero
  135. -XRDY write data, tx-bufstat decremented to zero
  136. x.x.x.x.x.x.x.0.
  137. repeat{
  138. 0. +XUDF if tx fifo empty
  139. +P if stop desired, set before last byte written
  140. -XUDF +XRDY write data, tx-bufstat decremented to nonzero
  141. -XUDF -XRDY write data, tx-bufstat decremented to zero
  142. x.x.x.x.x.x.x.x.
  143. }
  144. if P bit not set:
  145. 0. ^ARDY tx-bufstat resets
  146. (set count, tx-bufstat resets)
  147. +MST +WRITE +S +XRDY
  148. 1<. -S -XRDY
  149. }
  150. if P bit set:
  151. 0> -P -MST ^ARDY bufstats reset
  152. -BB ^BF
  153.  
  154.  
  155.  
  156.  
  157. XUDF is never set if the tx fifo is non-empty.
  158.  
  159. in slave mode can write into the fifo at any time. threshold is ignored, the
  160. counter in buffer stat decrements mod 64 on every read or write and is reset to
  161. count when ARDY is generated.
  162.  
  163. stall bit needs to be set before address is recognized to be effective.
  164. clearing the still bit, even momentarily, after AAS will release the stall.
  165.  
  166. if data in rx fifo (+RRDY), ARDY event and bufstat reset is deferred.
  167.  
  168.  
  169.  
  170.  
  171. master transmitter with threshold = 2
  172.  
  173. +MST +S +P +XRDY (5 remaining)
  174. <. +BB -S -XRDY
  175. x.x.x.x.x.x.x.0.0
  176. . +XUDF
  177. (write) -XUDF +XRDY (4 remaining)
  178. (write) (3 remaining)
  179. (write) -XRDY +XDR (2 remaining)
  180. (write) (1 remaining)
  181. (write) -XDR (0 remaining)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement