YouTube2Text

EECS 373 - Fall 2026 - Lecture 5: “GPIO & MMIO” — Transcript

by Interactive Sensing and Computing Lab · 11,860 words · 1,721 segments · language en · Watch on YouTube

Full transcript

  1. 0:21All right, we can get started. Let's
  2. 0:24see. So, no real announcements. homework
  3. 0:28was posted yesterday, two days ago and
  4. 0:30is due on Monday. And then again, we
  5. 0:32have office hours after class on
  6. 0:34Mondays. And if you need you could
  7. 0:36contact me and we can find another time
  8. 0:38or there's also open open lab hours that
  9. 0:41you go to for help. Okay, so component
  10. 0:45of the day just PCBs in general just as
  11. 0:47a concept. They sound sometimes they
  12. 0:50sound overwhelming and scary, but really
  13. 0:52they are just layers of metal that have
  14. 0:55been etched into a sandwich and they're
  15. 0:57just wires. They're just routing from
  16. 0:59one place to another. The um I know
  17. 1:03OpenAI thinks they've solved it. They do
  18. 1:06all the PCBs for you. Uh I would be
  19. 1:08surprised if it really works well, but
  20. 1:10we'll learn. It's another change to the
  21. 1:12industry. Uh PCBs have special features.
  22. 1:16We'll have a lecture on PCB design in
  23. 1:17general at the end of the semester, but
  24. 1:19there's things that are here. There are
  25. 1:21pads and that's what things get soldered
  26. 1:23onto. And then there's traces. Those are
  27. 1:24the kind of light green lines that just
  28. 1:26connect things. So again, it's just
  29. 1:28wires. And then they have some holes
  30. 1:30that allow you to go from one layer to
  31. 1:31another layer.
  32. 1:34And the other thing to kind of think
  33. 1:35about with PCBs is the entire industry
  34. 1:38has tried to standardize for maximum
  35. 1:40throughput and output, right? So like
  36. 1:43resistors and capacitors and transistors
  37. 1:46and all the IC types have very standard
  38. 1:48package sizes. So you can get a resistor
  39. 1:52in a very standard size is the number it
  40. 1:55doesn't matter but it's 0603 in any
  41. 1:57variety you possibly want. So all you
  42. 2:00have to do is kind of once you kind of
  43. 2:02learn the package sizes and they're not
  44. 2:04very complicated. You've basically
  45. 2:05mastered the entire PCB industry of
  46. 2:07components. You just have to know like
  47. 2:09there's seven or eight p uh chip sizes
  48. 2:12and uh types and then you've basically
  49. 2:14figured out how to uh select them. So
  50. 2:17it's it seems daunting and and undoable
  51. 2:19when you look at a place like Digi Key
  52. 2:21or Mouser it has millions of parts but
  53. 2:24realistically it's not that much and I
  54. 2:26think one half an hour or afternoon PCB
  55. 2:30tutorial and you could be making PCBs
  56. 2:31whenever you like.
  57. 2:33Any questions about PCBs
  58. 2:36or logistics?
  59. 2:41Okay, so today we're gonna finish up on
  60. 2:43the advanced peripheral bus.
  61. 2:46Uh there's a few more slides on that and
  62. 2:47then we're going to connect it back with
  63. 2:49the GPO peripheral. That's the most of
  64. 2:51what lecture is today. So if you
  65. 2:54remember our goal in general was how do
  66. 2:56we go from the core right which is doing
  67. 3:00uh you know uh your normal processor
  68. 3:02loads and stores and uh register
  69. 3:05manipulations those sort of things and
  70. 3:06then how do we actually get data to a
  71. 3:09peripheral or outside the chip like
  72. 3:11what's that mechanism
  73. 3:13and so let's see we talked about the
  74. 3:16advanced peripheral bus which is that I
  75. 3:18should go back here the advanced
  76. 3:19peripheral bus which is the mechanism
  77. 3:22uh that we'll use to transport data back
  78. 3:25and forth. And the goal really here is
  79. 3:27just to understand generally how it
  80. 3:29works and why it works. You're not
  81. 3:31trying to figure out the most exact
  82. 3:32timing and worry about those sort of
  83. 3:34stuff. Here it's just conceptual of how
  84. 3:36to link things together and what are the
  85. 3:37constraints that have been imposed.
  86. 3:41And so we'll do a little review.
  87. 3:44So here was a timing diagram. We've got
  88. 3:46the clock. We have a a bus. And this is
  89. 3:49going to be like a 32-bit bus in our
  90. 3:51example here of the address. We're going
  91. 3:53to say if Oh, I actually have builds for
  92. 3:55this. Let's see. All right. So, we have
  93. 3:57a setup phase first and then we have the
  94. 3:59access phase. setup phase is where the
  95. 4:02bus the A bus bridge or the requesttor
  96. 4:05sets up all the signals and make sure
  97. 4:07everything is stable and then when it
  98. 4:09goes to enable then it will be the
  99. 4:11access phase and that's the time where
  100. 4:14the peripheral will either latch in data
  101. 4:16or has the opportunity to latch in data
  102. 4:18or send data back latch out data. So we
  103. 4:22have a clock. Uh the address is the uh
  104. 4:25target the register in a peripheral.
  105. 4:29It's not the peripheral itself. The
  106. 4:30address is a physical resis or um
  107. 4:34register in a peripheral.
  108. 4:37We have the uh p which decides if
  109. 4:40basically if you're doing a load or a
  110. 4:42store. But because ARM is trying to be
  111. 4:45agnostic of any particular use case,
  112. 4:47they don't call it loads and stores.
  113. 4:48They call it this uh write and read. We
  114. 4:52have uh a select signal. So this is just
  115. 4:54one bit. And the goal of this is to tell
  116. 4:56which peripheral which may have multiple
  117. 4:58registers in it should be on and
  118. 5:00responding.
  119. 5:03And then we talked about the enable
  120. 5:04which is in this particular case is the
  121. 5:06way in which the requester is saying now
  122. 5:08it's time to enter the access phase.
  123. 5:12And then we have P data write which is
  124. 5:14where we write data into the target
  125. 5:17register in a particular peripheral. And
  126. 5:19we didn't talk about it yesterday or
  127. 5:21Monday but there's also um a bus line
  128. 5:24that's called P uh R read data which is
  129. 5:27where the uh peripheral will generate uh
  130. 5:32signal you know something that's gonna
  131. 5:34be read out of the register and we sent
  132. 5:36back to the requester.
  133. 5:38And then we have the P ready line. The P
  134. 5:40ready line is where the peripheral it's
  135. 5:41the only signal that the peripheral uh
  136. 5:44well it's not there's two signals that
  137. 5:45the peripheral sends back but this is
  138. 5:46where the peripheral says hey okay I am
  139. 5:48ready to do the action that's been
  140. 5:50requested of me there could be reasons
  141. 5:52why you had to wait and so the uh
  142. 5:55peripheral will raise this line high
  143. 5:57when it is ready to do the action the
  144. 5:59action is either going to be latch in or
  145. 6:01latch out data and a lot of times in our
  146. 6:03examples is always P ready is always
  147. 6:05high because it's guaranteed that that
  148. 6:07little hardware device can uh respond
  149. 6:11within one clock cycle, but we'll see
  150. 6:13examples where that's not necessarily
  151. 6:15the case.
  152. 6:17And then in here at T3, uh data is
  153. 6:20actually latched. Now remember the T0,
  154. 6:23T1, T2, that is just the nomenclature
  155. 6:26that the the spec uses. Um it could be
  156. 6:29at any time. It doesn't really matter.
  157. 6:31Those times are not important.
  158. 6:33What questions do you have?
  159. 6:38Yeah,
  160. 6:46>> exactly.
  161. 6:53>> Like you're saying like if you're six
  162. 6:55pixels over versus this way, like I
  163. 6:57don't care. Got to get it about right
  164. 6:59because the spec doesn't care either.
  165. 7:01This pex is saying it has to do these
  166. 7:03things if you read through it, but it's
  167. 7:05leaving the timing up to the hardware
  168. 7:06designer.
  169. 7:08>> Yeah,
  170. 7:15>> it does not matter. It it's uh it could
  171. 7:17have data on that line, right? Because
  172. 7:19there's probably some register that's
  173. 7:21connected, but it's not going to be
  174. 7:23latched out.
  175. 7:27>> Any other questions? Yeah.
  176. 7:31Sorry, say it again. where the shaded
  177. 7:32areas represent.
  178. 7:37Uh so the gray areas right that is in
  179. 7:40the the spec here that's uh transition
  180. 7:43time or unknown time right so here you
  181. 7:46see P ready going high is saying well we
  182. 7:48don't know exactly when P ready is going
  183. 7:50high and that's just a symbol for a
  184. 7:51transition from one state to another
  185. 7:52state
  186. 7:58>> yeah it could be shorter
  187. 8:00uh we're just saying yeah we're just
  188. 8:02saying it's just undefined here because
  189. 8:04the peripheral is doing something we
  190. 8:06don't know what it was. It doesn't
  191. 8:07matter what the peripheral was doing. It
  192. 8:09w it was not valid until the peripheral
  193. 8:11said P ready goes high and then the data
  194. 8:13must have been valid. But before that it
  195. 8:15did not have to be valid. So it's just
  196. 8:16unknown.
  197. 8:22Okay.
  198. 8:24Um so we just introduced a new signal P
  199. 8:26ready. So we'll see a couple examples of
  200. 8:28how that works. One thing to kind of
  201. 8:31remember from the uh diagram from last
  202. 8:34from Monday is that uh each the spec
  203. 8:38says that each P ready data path or from
  204. 8:42each peripheral has its own path back to
  205. 8:45the requester. So one way to look at
  206. 8:47that is that there is one 32-bit bus for
  207. 8:50every single peripheral back to the
  208. 8:52requester. So there's no bus contention.
  209. 8:54There's no way that you're going to say,
  210. 8:56well, I have, you know, 15 peripherals
  211. 8:58and now two of them are trying to write
  212. 9:00to the same bus. That's not um it's not
  213. 9:02allowed by the spec. So, however the
  214. 9:04hardware people do it implement, it's
  215. 9:06not it doesn't matter to us for this
  216. 9:08class and for the specs point of view,
  217. 9:10each one has a bus pass all the way back
  218. 9:11to the requester, its own independent
  219. 9:13path that it can write to.
  220. 9:19Uh, okay, we talked a little bit about
  221. 9:20notation. Uh this is mostly just so you
  222. 9:23have this in the slides, but when you're
  223. 9:25doing your homework or tests, these if
  224. 9:27you use these these standard um methods
  225. 9:30here, we'll know what you're talking
  226. 9:32about. Make life easy, right? So you can
  227. 9:34specify a logical one with a VDD symbol,
  228. 9:36a ground symbol. I encourage you not to
  229. 9:38spin those around. Uh it's a lot easier
  230. 9:41instead of doing bubble logic to
  231. 9:42indicate that you're masking out a
  232. 9:44particular address. You could just write
  233. 9:46the words ma add or mask and write the
  234. 9:47address. And then you can have a D
  235. 9:49flip-flop or you can define how many
  236. 9:51bits it could be eight bits or 32 bits
  237. 9:53or whatever number you want of your D of
  238. 9:55your registers for your D flip-flops.
  239. 9:57And then there's some bus line
  240. 9:58nomenclature.
  241. 10:01All right. So let's go through an
  242. 10:02example. Say we want to read data out of
  243. 10:05a peripheral. How would you architect a
  244. 10:07peripheral to do this task? Um and then
  245. 10:10the timing diagram here is just as a
  246. 10:12reference, right? This is this thing
  247. 10:13that we basically have to meet. So as
  248. 10:16you imagine uh this is just one bit uh
  249. 10:18but we are going to take the output. Oh
  250. 10:20I switched D and Q to be be tricky so I
  251. 10:23would confuse you. Normally D's on this
  252. 10:25side and Q's on their side but here we
  253. 10:27have the output of the DFF is going to
  254. 10:29the P write uh data path and we're going
  255. 10:32in this particular case the zeroth bit.
  256. 10:34You don't want to say you're doing all
  257. 10:3532 bits that wouldn't make sense. We're
  258. 10:37doing the zeroth bit and we have clock
  259. 10:39and then uh the data the D line is
  260. 10:42coming from the pin. And then here we
  261. 10:43have this is a pull-up resistor, right?
  262. 10:46This is the idea that it's always going
  263. 10:47to be pulled up to VDD unless you press
  264. 10:49the button and then it will be shorted
  265. 10:51to ground. So that there's always a
  266. 10:53defined state. If you just had a switch
  267. 10:55there that'll always be ground, it can
  268. 10:57never be high.
  269. 10:59Uh because it's a D flip-flop, there's
  270. 11:02no weight states. We'll talk about that
  271. 11:03in a minute. You would have the case
  272. 11:05here where um
  273. 11:07uh is always ready to respond within one
  274. 11:10clock cycle. And that's all you really
  275. 11:12need technically. I mean, you could go
  276. 11:14and say, uh, here I made the assumption
  277. 11:17there's only one register in this
  278. 11:18peripheral. So, if there's only one
  279. 11:19register, it doesn't matter, right?
  280. 11:22There's no, uh, P enable, it doesn't
  281. 11:24matter. P write doesn't matter because
  282. 11:26you can't even write into it. Uh, P
  283. 11:28select doesn't matter and P address
  284. 11:30doesn't matter because this is the only
  285. 11:32thing in this particular example it's
  286. 11:33doing. So, it's not that I'm saying, oh
  287. 11:35my gosh, you have to like this is the
  288. 11:38right way. if they were really
  289. 11:39implementing it, it would be all in uh
  290. 11:40VHDL and there might be some masking
  291. 11:43anyways. But just saying for this
  292. 11:44example to make the minimum to make that
  293. 11:46diagram work, this is the minimum that
  294. 11:48you would need.
  295. 11:53All right, so we can kind of go a little
  296. 11:55bit further. What if we want to do reads
  297. 11:56and writes to a particular uh register
  298. 11:59at a particular address? So here we have
  299. 12:04Oh, well I will go back. Does anybody
  300. 12:05have any questions here?
  301. 12:11You guys are so quiet.
  302. 12:14I must be such a great teacher. Not one
  303. 12:16question. This isn't that clear.
  304. 12:22All right. All right. Let's go. Uh, so
  305. 12:25here we're going to try and do all the
  306. 12:26reads in and all the reads out. Just a
  307. 12:28register to live somewhere. There's no
  308. 12:29extra features. Uh, so here we're going
  309. 12:31to take 32 bits into a 32-bit register.
  310. 12:34So we're going to write that all into
  311. 12:35the dath.
  312. 12:37We're going to read out all the data. We
  313. 12:39have a clock. So all the the basics are
  314. 12:41there. And then because we said it's a
  315. 12:44specific address, right? Then what has
  316. 12:46to be true? You have to be uh know if
  317. 12:48you're writing into it. It has to be
  318. 12:50know if it's enabled and it has to be
  319. 12:51selected.
  320. 12:53You also
  321. 12:55have to mask for that particular
  322. 12:57address. Say there's multiple registers
  323. 12:59in here. And so say we'll mask for that
  324. 13:02and all that will go into the enable. So
  325. 13:04only when all these states are true will
  326. 13:06this allow data to be lashed in from D
  327. 13:09into the state here. Now Q can always be
  328. 13:13sending out because there's no bus
  329. 13:14contention on this as we pointed out
  330. 13:16before. So Q can always be there. You
  331. 13:18don't need to have select or anything
  332. 13:21enabling or disabling Q. Uh it's always
  333. 13:24going to be available to be read. And
  334. 13:26then this happens in one cycle.
  335. 13:30>> Yeah.
  336. 13:34Why is P ready? Ah, because this is this
  337. 13:36this a D flip-flop. There's no We'll
  338. 13:38talk about weight states in a second,
  339. 13:39but there's no delay. There's no reason
  340. 13:42for a D flip-flop not to be ready in one
  341. 13:45cycle.
  342. 13:47And so that doesn't make any sense
  343. 13:49because I didn't tell you that the
  344. 13:50alternate example.
  345. 13:55Any other questions?
  346. 13:58>> Okay. What? No, that's good. Why do we
  347. 14:02add?
  348. 14:06>> So to enable that D flip-flop to accept
  349. 14:10data in it has to be a right. Correct?
  350. 14:13Right. Has to be one and uh P select has
  351. 14:16to be selected. So this peripheral has
  352. 14:18to be selected from this from this
  353. 14:20timing diagram. Okay. So you have to be
  354. 14:23selected and you have to be right mode
  355. 14:25and it has to be enabled. we are not
  356. 14:28allowed to clock in data until the uh
  357. 14:32requester has said okay all that data is
  358. 14:34uh stable and what else we have to do we
  359. 14:36have to make sure that we're actually uh
  360. 14:38the peripheral or the requester is
  361. 14:40talking to the right register itself so
  362. 14:42we've also masked on and so all those
  363. 14:45things have to be true for it to open
  364. 14:47its gate and latch in data. Now we could
  365. 14:51argue that a real hardware designer
  366. 14:52would do something more fancy. They have
  367. 14:54to deal with all these other timing
  368. 14:55diagrams. That's fine. And we're trying
  369. 14:57to get you to think logically about how
  370. 14:58does the bus get data in and out of this
  371. 15:01thing.
  372. 15:03>> Yeah.
  373. 15:13>> Yeah. It's
  374. 15:16when I make the diagrams, I'll try to be
  375. 15:17more more clear. What the data sheet is
  376. 15:19trying to tell you here is that it does
  377. 15:21not matter. It only matters when P ready
  378. 15:24is or P enable is high is the only time
  379. 15:27when P ready is going to be even paid
  380. 15:29attention to. So the uh peripheral could
  381. 15:34just hold that low as we'll see in a
  382. 15:35second saying it's not ready to respond.
  383. 15:37But any other time it just does not
  384. 15:39matter.
  385. 15:43You have to be so loud.
  386. 15:49>> Yeah.
  387. 15:54The the reason for that was um that it's
  388. 15:57just reading out of a switch. Like
  389. 15:58there's nothing there's no action that
  390. 16:01the bus does to change the state of that
  391. 16:04previous example. All it does is every
  392. 16:06clock cycle takes the output of or the
  393. 16:08input from the the button press and puts
  394. 16:11it on Q. That's all it does. So we could
  395. 16:14have written all that stuff. It just
  396. 16:15wouldn't have made a difference in that
  397. 16:17example.
  398. 16:19No, we well we just didn't that was not
  399. 16:21what the previous one example was. It
  400. 16:23was read only. I I could have probably
  401. 16:25should have made I should have said
  402. 16:26that. But
  403. 16:29now real in real in reality you would
  404. 16:31make a thing that could read and write,
  405. 16:33right? You're never going to make just a
  406. 16:34read thing. But for that example,
  407. 16:39>> yeah.
  408. 16:44something.
  409. 16:47>> So something external like like uh say a
  410. 16:50GPO pin or something. Um well that then
  411. 16:54you'd have to have some logic. So you'd
  412. 16:56have to have some logic here. We can
  413. 16:58just kind of go back a second.
  414. 17:03So in this particular case um we have
  415. 17:06the D path can come in through there,
  416. 17:08right? And so it's not that the external
  417. 17:12thing writes in through the bus. the
  418. 17:13external thing would have to write in
  419. 17:15from some other mechanism. And so if you
  420. 17:17want to do that, say you also wanted to
  421. 17:19be able to write into this register, uh
  422. 17:21you might need to have a MX so that you
  423. 17:23could select, okay, I'm in write mode
  424. 17:25and now I'm going to write into that D
  425. 17:26flip-flop because you don't want to have
  426. 17:28a contention with that thing being
  427. 17:30driven high and the other one driving
  428. 17:31low and there be bus contention.
  429. 17:35>> Yeah,
  430. 17:41>> correct.
  431. 17:45There's being enable. Oh, it this
  432. 17:47example is that's what the bus is doing.
  433. 17:51>> Yes,
  434. 17:51>> this is this is just a statement of the
  435. 17:53bus is doing and this is the minimum I
  436. 17:55should just update this slide. This is
  437. 17:56the minimum set of things to implement
  438. 17:58that bus feature for the task of just
  439. 18:00reading a push button.
  440. 18:07>> P enables coming in here. just ignored.
  441. 18:12I I think I've It doesn't matter how you
  442. 18:17when you're doing your problems, you can
  443. 18:18put all the you can put is minimum logic
  444. 18:20to meet the goal or you can put the full
  445. 18:23logic in. It doesn't really matter.
  446. 18:24You're not going to get penalized for
  447. 18:26extra logic unless it's like crazy.
  448. 18:32Okay,
  449. 18:36you're good questions. Let's see. See
  450. 18:38where were we going?
  451. 18:42So if we kind of do by extension here to
  452. 18:45read out of Q does not matter. Q the
  453. 18:48data in Q is always available and always
  454. 18:50ready independent of all this logic over
  455. 18:52here right it doesn't matter if you've
  456. 18:55updated this or changed like if you went
  457. 18:57to the wrong address Q is still there if
  458. 19:00this was the only thing on that bus. So
  459. 19:02that's why I just didn't write it out of
  460. 19:04convenience.
  461. 19:06Okay,
  462. 19:07so we'll go forward here. We'll talk
  463. 19:09about weight states. This is when you go
  464. 19:11for the setup phase. So the requesttor
  465. 19:13has set up the address, the P right
  466. 19:16select, has set P enable, everything is
  467. 19:18ready or P right data if it's if that's
  468. 19:20what it needs. Everything is available.
  469. 19:23However, the peripheral for some reason.
  470. 19:25Oh, and then it does enable, of course.
  471. 19:28So it's go. It says now it's peripheral.
  472. 19:29It's your turn to respond. But the
  473. 19:31peripheral up here didn't matter. Now
  474. 19:33the peripheral is holding it low. Okay.
  475. 19:36Why did the peripheral hold it low? I
  476. 19:37don't know. It's not part of this
  477. 19:38problem. For some unspecified reason,
  478. 19:40the peripheral is holding that line low.
  479. 19:47Um, and so what we call that is a weight
  480. 19:50state. Because the peripheral is holding
  481. 19:51it low, now we're just waiting for the
  482. 19:53peripheral to uh complete. And it could
  483. 19:55take n periods, any n clock cycles. We
  484. 19:58don't know what it is. This example,
  485. 20:01it's two. And then the peripheral says,
  486. 20:03"Okay, I'm ready. I've completed my
  487. 20:05task. My data is ready. Whatever I have
  488. 20:06to do is ready. And now it signals back
  489. 20:08to the requester. Okay, I'm going to
  490. 20:10raise this high and saying on the next
  491. 20:12clock cycle I will be able to do my or
  492. 20:14next rising clock edge, I will be ready
  493. 20:16to do my task whether it is read data in
  494. 20:19or write data out.
  495. 20:22And so then then you officially become
  496. 20:24in the access phase and the data is
  497. 20:27latched. What questions do we have?
  498. 20:29Yeah.
  499. 20:35Yes.
  500. 20:40So, one of the challenges uh this would
  501. 20:42be different than say the high
  502. 20:44performance bus um where you could have
  503. 20:47a device that's blocking the task
  504. 20:49blocking the bus from doing other
  505. 20:51things.
  506. 20:57Okay.
  507. 21:00And then the read is the same exact
  508. 21:02thing. Uh it's just that the the
  509. 21:05direction of P write was different and
  510. 21:06the need for P read data is different.
  511. 21:09So here the data doesn't matter. That's
  512. 21:11why it's all grayed out. it it could be
  513. 21:13there or the peripheral may be changing
  514. 21:16its data as it's doing some calculations
  515. 21:18whatever it is but now it's just saying
  516. 21:20the data is not valid until it completes
  517. 21:24uh P ready goes high and then uh data
  518. 21:28can be clocked out
  519. 21:33okay so here I I did not get the prompt
  520. 21:37I wanted here but uh I can walk you
  521. 21:39through this little example here would
  522. 21:40be a more complicated example so imagine
  523. 21:43This is probably more what you would see
  524. 21:45uh on a homework assignment or
  525. 21:46something. But so here we have our our
  526. 21:49um normal signals and then we have let's
  527. 21:52see if I see it here. There is P select
  528. 21:55for the temperature. Let's just say
  529. 21:56there's a temperature sensor. There's a
  530. 21:57P select for SPI which is a
  531. 21:59communication bus. And then there's a P
  532. 22:02write data path for temperature sensor
  533. 22:04and a PT data path for the SPI bus. And
  534. 22:07then each one of those has their own P
  535. 22:08ready lines. So we made this diagram
  536. 22:11before we showed which signals are in
  537. 22:13common and which signals are unique. And
  538. 22:15so here we've just identified the unique
  539. 22:17signal and in this little example the uh
  540. 22:21requester has come in and it's asked to
  541. 22:23write to this particular data address
  542. 22:25and it's gone through it set everything
  543. 22:26up and then it came in here and it said
  544. 22:29okay I've p enabled for the p enable
  545. 22:32field and now but the temperature the
  546. 22:35thing the temperature device which is
  547. 22:36the the one that was being selected
  548. 22:38because p select goes high has kept p
  549. 22:41low and you could imagine this is a
  550. 22:43common thing with the temperature sensor
  551. 22:45um is that it needs several cycles to
  552. 22:47converge on the answer. It can't it's
  553. 22:50unlikely that the temperature sensor is
  554. 22:51going to be able to do it immediately.
  555. 22:53So then it goes through, it says, okay,
  556. 22:54I'm converging. Uh it's arbitrary that
  557. 22:57it took four cycles to do it, but then
  558. 22:59when it has the value, it puts that
  559. 23:01value on the bus, pulls up uh P ready,
  560. 23:04and then it's able to latch out. And
  561. 23:06then they're just showing here's just
  562. 23:07another example, another transaction
  563. 23:10where it's gone and send that same data
  564. 23:12over SPI where it changed the address,
  565. 23:15set everything up, set the data up, and
  566. 23:17then uh SPI ready was high and then went
  567. 23:21back down low indicating that it's uh
  568. 23:23ready to go.
  569. 23:26Any questions about this example?
  570. 23:32Brave questions. People want to learn
  571. 23:34things.
  572. 23:39Yeah,
  573. 23:44>> it's just for the purpose of this
  574. 23:45example. So, temp temp is a temperature
  575. 23:48sensor that's a peripheral. Spy is a
  576. 23:51different peripheral, which is a
  577. 23:52communication bus. And so, now I just
  578. 23:54have two peripherals. This is how you
  579. 23:56would see them. And now the the
  580. 23:58requester is communicating with each of
  581. 24:00them. They are at different addresses.
  582. 24:01That's the part I forgot to put up
  583. 24:03there. Uh and then there's different
  584. 24:05transactions that occur because of that.
  585. 24:09>> Yeah.
  586. 24:22I think what you're saying is is spy is
  587. 24:24this just spy and then okay uh spy
  588. 24:29I shouldn't have put this on there I'm
  589. 24:31trying to advance you off to lectures
  590. 24:33like six weeks from now but uh spy is a
  591. 24:36serial protocol that's only designed to
  592. 24:38go from one chip to another chip like
  593. 24:39off device and so it has a whole bunch
  594. 24:41of different constraints spy is um a a
  595. 24:45single uh has one clock line and one
  596. 24:47data line is so it's serial instead of
  597. 24:49parallel. And in the context of how this
  598. 24:52works on your devices, you don't
  599. 24:54actually send out bits to your SPI
  600. 24:56peripheral. You would send a whole word
  601. 24:57out to the peripheral and you'd say go.
  602. 24:59And then it's a peripheral's job to say,
  603. 25:00okay, well, I'm going to clock this out
  604. 25:04to this other device. So the peripheral
  605. 25:05is doing some tasks for you. And from
  606. 25:08the bus's point of view, just send it
  607. 25:10what packet to send out.
  608. 25:13Good question. Okay. Uh if you get real
  609. 25:16excited, you can there's and you enjoy a
  610. 25:18good state diagram. This is for you. You
  611. 25:21can work your way through the logic of
  612. 25:22it or you could just say I don't want to
  613. 25:24learn this. That's fine. Whatever you
  614. 25:25want. But here is the logic of the the
  615. 25:27block diagram. Uh just there are some
  616. 25:30signals we didn't go over because it
  617. 25:32would be impossible to do them all.
  618. 25:34There's like error signals associated
  619. 25:36with it when the bus transfer gets
  620. 25:37corrupted, all those other things. Some
  621. 25:39of them are listed here. This is all you
  622. 25:40need to know. And I point that out is
  623. 25:43you can go and read if if I am super
  624. 25:46confusing, you can go and read this
  625. 25:48spec. It is actually like only 38 pages
  626. 25:51at least the last version I saw. It's
  627. 25:53not long. You could go through it all if
  628. 25:55you wanted. You don't have like you only
  629. 25:57need to probably go through like four
  630. 25:58pages to understand what it's trying to
  631. 26:00do. Um unfortunately
  632. 26:03as in almost all documentation embedded
  633. 26:05systems, it assumes you have already
  634. 26:06taken this class.
  635. 26:08That's the problem. So its value of as a
  636. 26:11teaching aid is kind of low, but because
  637. 26:12it's simple enough, you can you can walk
  638. 26:14your way through it. All right. So any
  639. 26:16questions on the advanced peripheral
  640. 26:18bus.
  641. 26:24Okay.
  642. 26:26So now we'll connect it back to GPIO and
  643. 26:29we'll kind of do a walkthrough of the
  644. 26:31GPIO for your particular device.
  645. 26:34Uh so again we're over here and the
  646. 26:36whole goal is we're trying to access
  647. 26:38data in the peripheral
  648. 26:42and just to be clear oh so we have this
  649. 26:44is our chip and just to be clear all of
  650. 26:47that exists on a piece of silicon here
  651. 26:49okay and we call these things integrated
  652. 26:52circuits IC's sometimes we call them
  653. 26:54dyes this is an example of something
  654. 26:56that's unpackaged
  655. 26:58and generally I don't know if this is
  656. 27:00exactly the bus I can only imagine it is
  657. 27:03But here we've all we've been talking
  658. 27:05about so far is how do we get data from
  659. 27:06the core all this in the background is
  660. 27:09probably SRAMM maybe some flash but how
  661. 27:11do we get data from here to this to a
  662. 27:14pin on the outside so that was our
  663. 27:15entire goal how do we transfer data
  664. 27:17there that bare die is in a package and
  665. 27:21of course this has been uh acid etched
  666. 27:24off for example but this is that same
  667. 27:27chip is in there and then there's little
  668. 27:29bond wires these are gold wires that go
  669. 27:31from uh the bond pads here through the
  670. 27:35epoxy and onto this metal pin here. And
  671. 27:38so that's called a package. And again,
  672. 27:40we're just trying to get the signal off
  673. 27:41of that. And then the world that you
  674. 27:43guys see is you have your dev kit and
  675. 27:46we've soldered a chip onto your dev kit.
  676. 27:48And then there's some trace, some PCB
  677. 27:50trace that's taking that line out to a
  678. 27:53uh
  679. 27:55whatever a pad over there and or a
  680. 27:57header pin. And that's what you're
  681. 27:59measuring with your oscilloscope or your
  682. 28:00logic analyzer. Okay.
  683. 28:05And then the term chip re refers to
  684. 28:08everything here kind of, right? So chip
  685. 28:10is just an overloaded term. A chip used
  686. 28:12to be what was cut off a wafer, but then
  687. 28:14the public got it. So then the term so
  688. 28:17now anything in the package is a chip.
  689. 28:19And some people I don't think anybody
  690. 28:21calls a PCB a chip, but uh chip is not
  691. 28:24the same as a die necessarily.
  692. 28:28All right. So what's inside your GPO
  693. 28:30port? So a conceptual level, there's a
  694. 28:33register, right? This is a register. It
  695. 28:35has inputs and outputs. Uh so this is
  696. 28:38input register. It's going to take data
  697. 28:40from the outside world and store it for
  698. 28:42the uh advanced peripheral bus to read.
  699. 28:44You have a output register. So data from
  700. 28:46the bus can be read in or placed into
  701. 28:48this thing which will go out. You have
  702. 28:50some control logic here, some pushpull
  703. 28:53pads. And then you also have a control
  704. 28:56register. So this is like the minimum
  705. 28:57that you would need for a GPO uh port.
  706. 29:01So you have registers that are going to
  707. 29:02control whether it's an input or output
  708. 29:04and you have state holding devices to
  709. 29:07either hold the state of the pin that's
  710. 29:08going out or read the state of the pin
  711. 29:10coming in.
  712. 29:14You take this uh idea here and these are
  713. 29:17just individual registers and then you
  714. 29:18just concatenate these things. So each
  715. 29:21port pin has a structure like this. And
  716. 29:23now we're just going to concatenate them
  717. 29:24together to make a port.
  718. 29:29Let's see. And so uh here we just see
  719. 29:31that. So if we take every one of the the
  720. 29:34register the the input registers and we
  721. 29:36just concatenate them together. Here we
  722. 29:38have all four of them together. And then
  723. 29:40positionally it equals each one of
  724. 29:42those. So we have pin one, pin two, pin
  725. 29:43three, pin four. And we can do the same
  726. 29:45thing with the output ports and the
  727. 29:47input ports. And then let's see. Oh,
  728. 29:50fancy. Um, then we can just take all
  729. 29:52that stuff and just turn it into memory.
  730. 29:55Now, uh, from the core's point of view,
  731. 29:57that's just a peripheral memory. That's
  732. 29:59just a memory location that you happen
  733. 30:00to be able to put stores, uh, words in
  734. 30:03and out of. And so when you do the store
  735. 30:05action, right, you're going to store
  736. 30:06data in. It goes to the requester. The
  737. 30:08requester interprets that this is a
  738. 30:10store uh, with some data that goes into
  739. 30:12some location. It turns it into these
  740. 30:14bus signals. requester captures it and
  741. 30:16says, "Oh, now it's my job to update
  742. 30:19that GPO output."
  743. 30:22And so from the uh uh core point of
  744. 30:25view, it is talking to a piece of
  745. 30:26memory, but all that happens to update
  746. 30:28one of those registers there, which
  747. 30:30causes a pin to go high or low on the
  748. 30:31output.
  749. 30:36Why don't you take like 60 seconds and
  750. 30:38try to explain it to your neighbor or
  751. 30:40ask your neighbor what doesn't make
  752. 30:41sense about this? Because this is like
  753. 30:42the crux of the first half of the class
  754. 30:44understanding that whole pipeline of how
  755. 30:46you get a store gets a pin high on the
  756. 30:49output.
  757. 31:13Happy
  758. 31:16birthday.
  759. 31:40I feel
  760. 32:05Now, what do you got?
  761. 32:11You gota be real loud
  762. 32:19>> eventually,
  763. 32:21right? So store in a sense doesn't do it
  764. 32:24um directly.
  765. 32:27Processor just does this command, right?
  766. 32:28And then that command essentially gets
  767. 32:31to the requester. The requester is
  768. 32:33essentially inside the processor in this
  769. 32:35example looking at the output signals of
  770. 32:37the ALU and then it says okay now that
  771. 32:41address it's trying to write to was in
  772. 32:43range of something I'm supposed to
  773. 32:44respond to and it's a store so it's
  774. 32:46something I'm supposed to respond to and
  775. 32:48then it transports the data. How does it
  776. 32:49do that? It sets all those lines. That's
  777. 32:51like the last diagrams we looked at. It
  778. 32:52figures out how to set those lines up.
  779. 32:54It's selecting some particular
  780. 32:56peripheral out of all the peripherals on
  781. 32:58the device. It selects a peripheral and
  782. 33:01then it writes into an address.
  783. 33:03That address just happens to be
  784. 33:05represented as a GPA output and that's a
  785. 33:09that's a register. One bit of that
  786. 33:11register is some register over here
  787. 33:12which goes to a pin. Now the core had no
  788. 33:15idea what it was doing. The core is like
  789. 33:16I'm just putting data in memory. It's
  790. 33:18you as the programmer who had to figure
  791. 33:20out that if memory if a one goes into a
  792. 33:22particular register that means something
  793. 33:24happens on the outside world. So that's
  794. 33:26your responsibility as the as the
  795. 33:28programmer to interpret that. The core
  796. 33:30doesn't inherently know that.
  797. 33:34How's that feel? Is that about right?
  798. 33:37What questions you have?
  799. 33:42>> Yeah.
  800. 33:50>> Yes.
  801. 33:52>> Because and you know where that is. If
  802. 33:54you remember there's a R made a map
  803. 33:57>> that whole memory map where it started
  804. 33:59with SRAMM and then code space and then
  805. 34:01peripherals external memory external
  806. 34:04devices like they define what addresses
  807. 34:08the peripheral bus should respond to.
  808. 34:13>> Yeah.
  809. 34:18>> Okay.
  810. 34:19>> No, that's fine.
  811. 34:21Okay. This is great because if you get
  812. 34:24this slide which we've been building up
  813. 34:26to you you've understood the the newest
  814. 34:29thing we've like the only new thing
  815. 34:30you've learned so far in the course
  816. 34:31right and this is like the core crux of
  817. 34:33how microcontrollers work from an
  818. 34:35architectural point of view. So we got a
  819. 34:36core we got a processor the it's doing
  820. 34:39moves and ads and all this sort of
  821. 34:40stuff. It has two methods to interact
  822. 34:42with things outside of the processor. It
  823. 34:44has loads and stores right? So it could
  824. 34:47load stuff into SRAM. It can read stuff
  825. 34:49out of SRAM. It can do that. Now it can
  826. 34:52also talk to peripherals and the ARM has
  827. 34:55defined a peripheral space. It says
  828. 34:56here's the address of where peripherals
  829. 34:58exist and then the manufacturer of your
  830. 35:01particular device said at these
  831. 35:02particular addresses things will happen.
  832. 35:05And so uh now you have executed some
  833. 35:08instruction. The requester has been
  834. 35:10listening to the core's actions and says
  835. 35:12okay now it's time for me to take
  836. 35:14action. is going to interpret that
  837. 35:15memory location as somewhere it's
  838. 35:17responsible for and it says okay I have
  839. 35:19to write or read or whatever and it it
  840. 35:22sets up the bus transaction remember
  841. 35:23there's many peripherals on there so
  842. 35:25it's trying to get the data to the right
  843. 35:26spot um then all the peripherals are
  844. 35:29listening well potentially listening
  845. 35:32they're looking for is uh all those
  846. 35:34signals specified for me especially the
  847. 35:37P select and then it says okay well I've
  848. 35:40got a signal and I have to route it to
  849. 35:41some uh register we'll call it GPO go
  850. 35:44out. And that register is built up of
  851. 35:47little bits, right? Like each one of
  852. 35:49those bytes or bits goes in there and
  853. 35:51one of those bits happens to go to the
  854. 35:53output register of a GPO pin and then
  855. 35:56that can process all the way through
  856. 35:58here to the to the IO pin and make it go
  857. 36:00high. And you could also do it in
  858. 36:02reverse. You could do it in read where
  859. 36:04you're can set that thing up to be a
  860. 36:06read pin and then you'd go through and
  861. 36:07do a load and you could load in data all
  862. 36:10the way from the GPO pin up into the
  863. 36:12processor.
  864. 36:20I'm I'm happy to do it again. That's
  865. 36:22what's
  866. 36:27>> ah
  867. 36:28um in this magic state machine buff
  868. 36:31bubble it says I have it'll have a table
  869. 36:33full of here's all the peripherals
  870. 36:35here's address range. So it's going to
  871. 36:37say this thing acted this thing or sorry
  872. 36:40the core wants to send data to this
  873. 36:42address range that represents a
  874. 36:44peripheral of it and then it'll raise
  875. 36:46the P select line and tell that
  876. 36:48peripheral it's your time to respond.
  877. 36:50You have to pay attention to me.
  878. 36:53Does that make sense? Okay.
  879. 36:56>> Yeah.
  880. 36:57>> So in that example the AQB is being
  881. 37:00driven by both sides, right? So like the
  882. 37:02requesttor
  883. 37:03might want to select a peripheral but
  884. 37:05that might not be ready. So it waits for
  885. 37:08the first ready line for it to push out
  886. 37:11that signal back to the
  887. 37:13>> right. So it's being driven by
  888. 37:16>> but not all signals are driven by both
  889. 37:18sides.
  890. 37:19>> Not just the P ready
  891. 37:20>> P ready and and P write data.
  892. 37:23>> So there's a path for the uh requester
  893. 37:27to send data and there's a path for the
  894. 37:29completer to send data back. Now the
  895. 37:31trick is it's an asymmetrical
  896. 37:33relationship in the sense that the
  897. 37:34requester defines when you talk when it
  898. 37:36talks. It it defines everything and the
  899. 37:38only thing that the peripheral can
  900. 37:40really say or the requester or completer
  901. 37:42can say is I'm not ready. That's about
  902. 37:44all it can do. It holds the pin down and
  903. 37:47then if it has data it will send it back
  904. 37:49or if it's supposed to latch in data
  905. 37:50it'll latch it when it's ready. But it
  906. 37:53can't say I want to talk now. It doesn't
  907. 37:55have that capability.
  908. 38:00Yeah.
  909. 38:09>> Uh the we'll go into the details of
  910. 38:11control kind of to mirror what you've
  911. 38:13done in lab. Uh in this example, control
  912. 38:15is just saying is this an input or an
  913. 38:17output device basically. But there's
  914. 38:19some you have to have some control for
  915. 38:21it to be a GPIO input or output pin.
  916. 38:28Oh yeah.
  917. 38:34Can you say it real loud?
  918. 38:43>> Okay. So, how does it know? Um, so the P
  919. 38:46ready line is there to indicate that.
  920. 38:49So, let's go back.
  921. 38:59Um so here P ready is held low right up
  922. 39:03until it says I will be ready to do my
  923. 39:05action on the next clock cycle.
  924. 39:09So that's how the requester knows is
  925. 39:11this P ready or low.
  926. 39:21>> I'm sorry. Say it again.
  927. 39:24from the request.
  928. 39:28>> So, so if the peripheral needs more
  929. 39:32time, it has a method and that method is
  930. 39:34to hold P ready low. It needs more time.
  931. 39:38Um, but if it goes high, then the spec
  932. 39:43says it has to do the action on the next
  933. 39:45clock cycle. There's no like I go high,
  934. 39:47but I actually needed more clock cycles.
  935. 39:49It just says you have to do you have to
  936. 39:51latch in or latch out your data on that
  937. 39:53next rising edge. If you went if P goes
  938. 39:56high, you have to be ready. Does that
  939. 39:58answer your question?
  940. 40:03>> I'm sorry. You got to be super loud. I'm
  941. 40:05I'm getting old.
  942. 40:08>> What?
  943. 40:16>> Yeah.
  944. 40:18either
  945. 40:19has to hold low and then when it goes
  946. 40:22high it has to do it in in one clock
  947. 40:23cycle has to do on the next clock cycle.
  948. 40:25It's just a requirement.
  949. 40:28>> So there's it can't be like a
  950. 40:29multi-stage latch thing. That's not how
  951. 40:31that works. Okay. How do we feel? What
  952. 40:34other questions you have?
  953. 40:38Okay.
  954. 40:43Where did we get off to? Okay.
  955. 40:46So I mean work through the concept of
  956. 40:50this diagram.
  957. 40:52Um
  958. 40:54I think the the key is to to know is
  959. 40:56that um when you're loading and storing
  960. 40:59into one of these GPO registers, the
  961. 41:02register the hardware of the register
  962. 41:04itself is interpreting those bits in
  963. 41:06that register to do a task. And we'll go
  964. 41:10through a bunch of different tasks that
  965. 41:11can be but in this example it's either
  966. 41:13like outputting data or configuring
  967. 41:15something.
  968. 41:17All right.
  969. 41:19So a lot of embedded systems is being
  970. 41:22able to read the data sheet.
  971. 41:25Um once you know enough background that
  972. 41:27you can interpret the cryptic messages
  973. 41:28on data sheet uh you're fine. So I'll
  974. 41:31help you in a sense of walking you
  975. 41:32through the GP reports and helping you
  976. 41:34think about what are the bits of
  977. 41:35information I need to glean from the
  978. 41:37data sheet so that you can then
  979. 41:38interpret the rest of the data sheet
  980. 41:40effectively.
  981. 41:43So if you go through uh uh part 26 of uh
  982. 41:47your enormous you know thousandpage data
  983. 41:49sheet for this chip you'll come up to
  984. 41:51the GPL port and this somewhat
  985. 41:53complicated diagram uh has all the major
  986. 41:56functions that you need to think about
  987. 41:58and then it goes through and documents
  988. 41:59what their functionality is and what uh
  989. 42:02the registers do that control it.
  990. 42:07So, one concept that they have here is
  991. 42:09this idea of a pad, a port slice, and a
  992. 42:12port. And so, a pad
  993. 42:16is that one of those little bumps over
  994. 42:18here. That's the the place where the
  995. 42:20gold bond goes in. And that actually has
  996. 42:23some logic built into it. It's not
  997. 42:25purely a passive device. It has an
  998. 42:27output stage. It has an input stage and
  999. 42:29a pull-up devices. We'll go through each
  1000. 42:31one of those, but conceptually that pad
  1001. 42:34exists separate from everything else.
  1002. 42:37Then it has what this data sheet calls a
  1003. 42:39port slice, which is just one register.
  1004. 42:42So remember how I had that concatenated
  1005. 42:44slide of things that all came together?
  1006. 42:46This is just one of those. And then
  1007. 42:48you'd have say 16 of these on top of
  1008. 42:50each other to make a entire port.
  1009. 42:56And so here is a little bit more an
  1010. 42:58alternate representation of that same
  1011. 43:00thing. We have uh you know output
  1012. 43:03registers and bit select registers,
  1013. 43:04input registers. The reason I pull up
  1014. 43:06this diagram because it's not easy to
  1015. 43:08see in your particular data sheet is
  1016. 43:10that on the input side there is ESD
  1017. 43:13protection. So this is electrostatic
  1018. 43:15discharge protection. There are dodes
  1019. 43:17built into your GPO pins. Normally you
  1020. 43:20never think about that and if you shock
  1021. 43:23your devices still likely to destroy
  1022. 43:25them even though you have ESD
  1023. 43:26protection. But one edge condition that
  1024. 43:28can often occur is that if you put say
  1025. 43:32you have a 3.3 volt system and you put 5
  1026. 43:34volts into it, what's going to happen?
  1027. 43:36You're going to put 5 volts in the IO
  1028. 43:38pin and VDD uh IO is at 3.3. It's going
  1029. 43:42to conduct current through the thing and
  1030. 43:45blow up your device. So this is why you
  1031. 43:47say, "Hey, it's just an input. I should
  1032. 43:49be tolerant. Well, it's not going to be.
  1033. 43:50Almost all devices have some sort of uh
  1034. 43:53overvoltage and ESD protection just to
  1035. 43:56be aware of. You do have to control the
  1036. 43:58voltages between devices or have a
  1037. 44:00voltage translator.
  1038. 44:03Okay, that's a side note.
  1039. 44:05Um, so I tried Oh, you guys can't see
  1040. 44:08anything. But, uh, here is this the
  1041. 44:10input port. I tried to highlight the
  1042. 44:12part we're talking about up here as well
  1043. 44:13as put it up here. This is the register
  1044. 44:16that represents the data coming off of
  1045. 44:18the port. And here SD uh infinion says
  1046. 44:22okay a port is uh made up of 16
  1047. 44:27um pins even though it has a 32-bit
  1048. 44:30register and the top register here is
  1049. 44:33all zeros and the R here means reserved
  1050. 44:36means uh well this actually means read
  1051. 44:38but there's no data in here. It doesn't
  1052. 44:41do anything but you can uh read data out
  1053. 44:43of these registers.
  1054. 44:45A nomenclature here it says PN that's
  1055. 44:48because you replace the N with your port
  1056. 44:51number and then the addressing scheme
  1057. 44:53here. If you are in port one then the
  1058. 44:56address is this this this plus one times
  1059. 44:59100. So now you can see that each one of
  1060. 45:02their addresses for each port is just a
  1061. 45:04uh increment of each other. And then
  1062. 45:08yeah and then these are the a key for
  1063. 45:10these symbols. So basically data is
  1064. 45:11going to come in and it's available to
  1065. 45:13be read in the lower 16 bits.
  1066. 45:18Uh likewise the output port is very
  1067. 45:20similar. Uh it's just a register for
  1068. 45:23right now. We're not having talking
  1069. 45:24about how to configure it. It's just 16
  1070. 45:26bits here. You can read or write from
  1071. 45:29it. And it's saying here hardware can
  1072. 45:31update it. Hardware can also update.
  1073. 45:33That's what the H means. uh here.
  1074. 45:37And how could hardware update it? We'll
  1075. 45:38talk about it a little bit later, but
  1076. 45:40you could have an alternate function
  1077. 45:41like an SPI pin that's going to change
  1078. 45:44uh this uh these registers independent
  1079. 45:47of what you're doing even though it's a
  1080. 45:48right pin. So basically, if it says
  1081. 45:50hardware, you cannot rely on it to store
  1082. 45:52data for you because something else
  1083. 45:54could update it. And it provides you the
  1084. 45:56lower 16 bits here representing the
  1085. 45:59output of the 16 um pins.
  1086. 46:03And then uh well any questions any
  1087. 46:06questions
  1088. 46:08you yeah
  1089. 46:10>> in the case you have to make sure that
  1090. 46:15variable in your code
  1091. 46:18>> correct yep
  1092. 46:22and hopefully our compiler will catch
  1093. 46:24that but no guarantees.
  1094. 46:27All right. Um let's see. And then we got
  1095. 46:30to the uh there's a special they give
  1096. 46:32you a special extra port. It's a
  1097. 46:33modified port where you can uh you get
  1098. 46:36the lower 16 bit of this register as a
  1099. 46:39you can go through and let's see you can
  1100. 46:41bit you can set pins or you can reset
  1101. 46:45pins. So they're giving you this
  1102. 46:46convenient method. So normally what you
  1103. 46:47would have to do is you have to uh go
  1104. 46:49and like say you want to output
  1105. 46:51something and you want to change one bit
  1106. 46:53you'd have to load all of that into the
  1107. 46:55core change your one bit and then write
  1108. 46:58it all back. if you just uh in the nive
  1109. 47:00case just put one bit in there. That
  1110. 47:01means you erase everything else that's
  1111. 47:03in that pin. So here they're giving you
  1112. 47:05the special functionality. They're
  1113. 47:07saying okay you can put bits into here
  1114. 47:08and we'll only either reset or set that
  1115. 47:11particular pin. So it makes it a nice uh
  1116. 47:14lower number of instructions to update
  1117. 47:16just one pin. And they specifically say
  1118. 47:18that this is a these are not physical
  1119. 47:21registers. They are just virtual
  1120. 47:23registers. Um basically they're just
  1121. 47:25another way to get data into the
  1122. 47:26flip-flop. That's all it is. And they
  1123. 47:28just have a special function that if you
  1124. 47:30put a one in there, if you put a zero
  1125. 47:32somewhere else, it will not change uh
  1126. 47:34that the function of that pin. So, it
  1127. 47:35allows you to easily update things.
  1128. 47:40All right. Any other questions before we
  1129. 47:41go on to the control register because
  1130. 47:43that's painful.
  1131. 47:46Okay. So, the control register which is
  1132. 47:50essentially has controls the entire
  1133. 47:52function of the device does a bunch of
  1134. 47:53stuff. uh they have uh and I don't know
  1135. 47:57why but they say here that the lowest
  1136. 48:00[clears throat] three bits is always
  1137. 48:01read you can't write to it and then it's
  1138. 48:04five bits then it's zero bits and five
  1139. 48:06bits so they have the structure here
  1140. 48:07basically they're going to give you five
  1141. 48:09bits per pin to configure this uh pin
  1142. 48:12and then they need four registers in
  1143. 48:14total to do that
  1144. 48:16and then they say they you know if you
  1145. 48:18go to the next table here you have all
  1146. 48:21the pins [snorts] or all the functions
  1147. 48:23available able and uh those are the five
  1148. 48:26bits you can put. X means don't care.
  1149. 48:28But you can do things like set this is
  1150. 48:30the input. You're controlling how data
  1151. 48:32gets input. You can make it just a
  1152. 48:34normal input pin. You can have it be
  1153. 48:37pulled up or pulled down. And you can
  1154. 48:39for some reason, which I have not
  1155. 48:40figured out yet, you can have it also
  1156. 48:42update the output register. Don't know
  1157. 48:43why we want that, but I'm sure they they
  1158. 48:46figured out a good reason. And then you
  1159. 48:48also have the option to invert the
  1160. 48:49input. Uh you can imagine that somebody
  1161. 48:52had some chip and it only came in one
  1162. 48:54logic state and you everything else on
  1163. 48:56that bus was inverted logic and so you
  1164. 48:59could spend the time in uh your al or in
  1165. 49:02your core flipping that bit each time it
  1166. 49:04comes in or they're just going to
  1167. 49:05provide you with a functionality just to
  1168. 49:07invert that bit. Uh so here this is that
  1169. 49:10path you're coming in here through the
  1170. 49:12Schmidt trigger. You have the invert and
  1171. 49:14then you have um basically data
  1172. 49:16synchronization and then you have your
  1173. 49:17port. So a Schmidt trigger is
  1174. 49:20particularly important and almost all
  1175. 49:21devices have it. And so that's because
  1176. 49:23digital signals are not always just ones
  1177. 49:25and zeros. Sometimes they're crossing uh
  1178. 49:29through a variety of reasons uh not as
  1179. 49:31square waves. And so if you're going to
  1180. 49:33go and hit some arbitrary threshold and
  1181. 49:35just make ones and zeros, it can look
  1182. 49:36kind of chaotic. Uh you're getting this
  1183. 49:39half. This thing didn't go all the way
  1184. 49:40to the top. And so you got this like uh
  1185. 49:43maybe it was never intended to be high
  1186. 49:44or low. Well, this one did go all the
  1187. 49:46way to the top. So the schmidt trigger
  1188. 49:48is a gate type of gate that has
  1189. 49:52hysteresus which basically means that uh
  1190. 49:54as you transition from low to high you
  1191. 49:57must go very high before it'll be
  1192. 49:59transitioned. And if you're going from
  1193. 50:00below or high to low, you must go very
  1194. 50:02low. So there's a window here. It's not
  1195. 50:04just a 50% threshold. It's a structured
  1196. 50:07threshold where you have to be going in
  1197. 50:09the right direction uh to actually have
  1198. 50:11a count. And that has a good function of
  1199. 50:14actually. So here's the guard bands. you
  1200. 50:17actually have to go from like if you're
  1201. 50:18going high to low, you have to go
  1202. 50:19through red and then to blue, but you
  1203. 50:21can't just go down to red a little bit
  1204. 50:23and then red again. You actually have to
  1205. 50:24make that full transition and it helps
  1206. 50:26clean up your waveforms. It also helps
  1207. 50:28uh with metastability and other issues.
  1208. 50:31And so you might be like, well, this
  1209. 50:32looks like a, you know, weird signal.
  1210. 50:34Like these signals do exist. This is
  1211. 50:36kind of a this is a a button being
  1212. 50:38debounced. Um it has some weird things
  1213. 50:41in here where it has some little runs
  1214. 50:42that didn't go over 50%. It has this
  1215. 50:44little one that maybe didn't go high
  1216. 50:45enough. And then it has the actual
  1217. 50:47button press and then it gets let go. So
  1218. 50:49here you don't want to get triggered on
  1219. 50:51all those. You want it to really go
  1220. 50:52high. You want some higher up threshold.
  1221. 50:59>> Any questions so far? Yeah.
  1222. 51:11>> Um Oh, they're reusing the don't care
  1223. 51:13bit later on. We're going to see that in
  1224. 51:15a second. It's just for that particular
  1225. 51:17function, they don't care. So they they
  1226. 51:19could have defined it for you. Why they
  1227. 51:21didn't define it, I don't know. Some
  1228. 51:22architect had a good reason,
  1229. 51:25but they do use the bit. It's not that
  1230. 51:26it's never used. Um,
  1231. 51:30so here we have uh pull up and pull
  1232. 51:32down, which are options. So uh they
  1233. 51:36actually add into each one of those uh
  1234. 51:39pads resistors. And those wristers allow
  1235. 51:42you to pull a signal up or pull a signal
  1236. 51:44down. And what does that mean? So you
  1237. 51:46can select them with these uh these
  1238. 51:49codes here.
  1239. 51:51And that essentially means the output
  1240. 51:53pin has a resistor that's pulled up to
  1241. 51:55VDD and then it goes into the input. Or
  1242. 51:57you could have an option of pulling it
  1243. 51:58down. Why?
  1244. 52:01It's resistors are relatively cheap,
  1245. 52:04right? You can resistors 603 resistors
  1246. 52:07less than a penny if you buy them in
  1247. 52:08volumes. Why is S uh Infinine making the
  1248. 52:12decision to spend precious space inside
  1249. 52:15putting resistors inside that could be
  1250. 52:18you know digitally selected? What would
  1251. 52:19be take 30 seconds? What would be the
  1252. 52:21reason why Infinion would make this
  1253. 52:23choice?
  1254. 52:27Why would a manufacturer of a mic
  1255. 52:30controller give an option to have
  1256. 52:33resistors be connected to the input pin
  1257. 52:35rather than just have the board designer
  1258. 52:37put resistors on the PCB itself? If you
  1259. 52:39know you need them, why are you putting
  1260. 52:41them on GPO pins?
  1261. 52:45All right, take 30 seconds. See what See
  1262. 52:46what you guys come up with.
  1263. 52:52Oh boy.
  1264. 52:55Yeah.
  1265. 53:05All
  1266. 53:29right. What do we think? Why in the
  1267. 53:31world would they put resistors in a
  1268. 53:33digital device?
  1269. 53:40You guys are talking to each other. You
  1270. 53:42have ideas.
  1271. 53:49>> Why?
  1272. 53:51Oh, there you go. Okay.
  1273. 53:58>> All right. So the argument it's so
  1274. 54:00ubiquitous, but why not just make the
  1275. 54:03PCB people do it?
  1276. 54:11>> Oh, so you couldn't reconfigure it,
  1277. 54:13right? So this is this allows you to
  1278. 54:14configure on the fly.
  1279. 54:17I don't know if I've ever actually done
  1280. 54:19that, but that's true. I think what they
  1281. 54:21found
  1282. 54:25you sell.
  1283. 54:30>> Okay. I was more thinking on the P on
  1284. 54:32the PCB. So, you sell the chip to the
  1285. 54:34board manufacturer or the device
  1286. 54:35manufacturer. You sell it to I don't
  1287. 54:36know somebody and then they make a PCB.
  1288. 54:38They could just put a resistor on there.
  1289. 54:40Like what's the advantage here? And so
  1290. 54:41it really comes out to um actual space
  1291. 54:45on PCBs is so constrained that having
  1292. 54:47the physical footprint became a problem.
  1293. 54:50And then it's actually relatively easy
  1294. 54:52that it's not a great resistor, but it's
  1295. 54:54okay to put it inside. And so now they
  1296. 54:56can differentiate themselves from the
  1297. 54:57marketplace and say, "Hey, I have you
  1298. 55:00can have less bill of materials because
  1299. 55:02you can put these resistors inside." And
  1300. 55:03then everybody started doing it. So it's
  1301. 55:05just more like a convenience thing. It's
  1302. 55:07not like uh inherently that to make
  1303. 55:10these things function you would have to
  1304. 55:11have it. You could just have it on the
  1305. 55:13outside.
  1306. 55:15All right. Uh where was I? So pull up
  1307. 55:17pull down resistors. Uh other
  1308. 55:19functionality. Let's see. You have a
  1309. 55:20control output. What is this one? Oh,
  1310. 55:23now we can control the types of outputs
  1311. 55:25you're going to have. Um let's for
  1312. 55:27example here you can have a pushpull
  1313. 55:29output. So this is uh it looks like an
  1314. 55:31inverter. It has a little controller on
  1315. 55:33it. And the idea of a pushpull output is
  1316. 55:35that they're really beefy uh NMOS and
  1317. 55:38POSs that can drive lots of current. And
  1318. 55:40this is the thing that's going to be
  1319. 55:42pushing voltage or current out on that
  1320. 55:44GPO pen. And either you're going to
  1321. 55:46connect one or the other. You can also
  1322. 55:48disconnect both so that it's not driving
  1323. 55:50the pin and then that becomes an input
  1324. 55:52device. So here you connect the top of
  1325. 55:55course you're you're driving current
  1326. 55:56out. Oops. You're driving current out.
  1327. 55:58Here you're driving you're sucking
  1328. 56:00current into ground essentially.
  1329. 56:02Um the concept of open drain is that you
  1330. 56:05only do half of that. to disable the POS
  1331. 56:08on the top and they call it open drain
  1332. 56:11because here the D on that N MOS is uh
  1333. 56:15open to the to the world and so now it
  1334. 56:18can have the option of pulling down
  1335. 56:20current or not pulling any current down
  1336. 56:24and so now I can leave that pin floating
  1337. 56:26and you'll find that uh when you talk
  1338. 56:28about I squared C buses that this is the
  1339. 56:30preferred modality of how you would
  1340. 56:32interact with those devices but this
  1341. 56:34just showing you that you this is a
  1342. 56:36different mode of operation. When you
  1343. 56:37see it, you can either be um pulling to
  1344. 56:40connected to ground or disconnected from
  1345. 56:42that pin altogether. Those are the two
  1346. 56:44two options for open drain.
  1347. 56:48Uh output pins also have um alternate
  1348. 56:52functionality. And what does that mean?
  1349. 56:54What does that even mean? So there's a
  1350. 56:57table uh table whatever 2612 that
  1351. 57:00defines all the alternate functionality
  1352. 57:02that the GPL pin can do. And uh thinking
  1353. 57:05about spy or communication, you don't
  1354. 57:07want to have a dedicated pin just for
  1355. 57:09spy. That would be kind of annoying. Uh
  1356. 57:12so what you can because then you
  1357. 57:13couldn't use it for anything else. So
  1358. 57:14what they say is a general purpose IO
  1359. 57:16pin. They can configure it to run
  1360. 57:18peripheral acts like other peripherals
  1361. 57:20can u send data out through that pin.
  1362. 57:23And so what would that look like? So
  1363. 57:26here we have the this is a GPO pin on
  1364. 57:29the advanced peripheral bus. And we want
  1365. 57:31to add in an alternate function. So you
  1366. 57:33would go look up on the table, figure
  1367. 57:34out what bit pattern to put in there,
  1368. 57:35and then for instance, you could have
  1369. 57:37your spy will literally connect a wire,
  1370. 57:39not through the advanced peripheral bus,
  1371. 57:41just directly as an alternate input. And
  1372. 57:43then when you configure your spy to send
  1373. 57:45out data, it will pass those bits out on
  1374. 57:48the pin. So this is a way that you get
  1375. 57:50to reuse that pin for multiple other
  1376. 57:52functions. It's not always just a fixed
  1377. 57:53function device.
  1378. 57:58What questions you have? Yeah.
  1379. 58:02at all.
  1380. 58:07>> Yeah, it doesn't go through the bus
  1381. 58:09structure. It's just it's just I mean
  1382. 58:10it's all on chip. Um but it just goes
  1383. 58:14straight from the UR peripheral
  1384. 58:17uh and makes a line to that output pin
  1385. 58:20because it would just be it would cause
  1386. 58:21you this extra delay if you had to go
  1387. 58:23back through the advanced peripheral
  1388. 58:24bus. So it's just a direct path and
  1389. 58:26you'll do that for ADCs and all these
  1390. 58:28other peripherals. Sure.
  1391. 58:41>> What are you thinking? What's your
  1392. 58:42question?
  1393. 58:43>> I just how does it work?
  1394. 58:45>> Ah
  1395. 58:47uh
  1396. 58:49so how it works is these are just magic
  1397. 58:50switches. Uh we don't some people took
  1398. 58:52an analog class and you could figure out
  1399. 58:54that these things could be like quasi
  1400. 58:56resistors and nobody cares about that.
  1401. 58:58These are not amplifiers. These are
  1402. 58:59switches. Okay. And all we're saying is
  1403. 59:02that in this particular case, the NOS
  1404. 59:05switch is closed, which means the uh
  1405. 59:08ground is connected to that pin, which
  1406. 59:10any voltage that's on that pin is going
  1407. 59:11to be sucked down to ground. And then
  1408. 59:14the the other is true as well, right? So
  1409. 59:18you can pull it up to to high here.
  1410. 59:20You're going to source current out on
  1411. 59:21that pin up until the pin is raised to
  1412. 59:23VCC.
  1413. 59:25So these are just switches. uh I think
  1414. 59:28uh lecture one or two there were some
  1415. 59:30false ad uh diagrams to play with. So I
  1416. 59:33encourage you you can click on those
  1417. 59:35false ad um URLs or copy them into your
  1418. 59:38browser and then you can play with the
  1419. 59:39circuits you see in slides and you can
  1420. 59:41just like I think getting the intuition
  1421. 59:42about how circuits work is more
  1422. 59:44important than calculating them
  1423. 59:45calculating for this class. So go play
  1424. 59:47with them.
  1425. 59:48>> Yeah.
  1426. 59:57No,
  1427. 59:58>> it's not preferred. There are certain
  1428. 59:59peripherals when we talk about I squared
  1429. 1:00:01C which is a communication style that
  1430. 1:00:02that's the requirement. It has to be
  1431. 1:00:04that way.
  1432. 1:00:05>> But why would it why would you want the
  1433. 1:00:08output to be floating?
  1434. 1:00:10>> We will find out. But basically that bus
  1435. 1:00:12structure uh
  1436. 1:00:15uh it tries to handle a case where you
  1437. 1:00:18have multiple devices on the same line
  1438. 1:00:21and any one of those devices could
  1439. 1:00:23interact with a bus and they want to
  1440. 1:00:25guarantee there's a case where two
  1441. 1:00:27things can't one can't drive high one
  1442. 1:00:29can't drive low and then you would you
  1443. 1:00:31know short circuit. So they're trying to
  1444. 1:00:33eliminate that and then this option has
  1445. 1:00:35emerged as high impedance as a way to
  1446. 1:00:37get around it. But don't have to worry
  1447. 1:00:38about that now. You just have to know
  1448. 1:00:39that it can do it.
  1449. 1:00:45Okay.
  1450. 1:00:49Yeah. And uh you will find out later
  1451. 1:00:51that there's lots of wires. Um it's not
  1452. 1:00:54always the bus is not the only way to
  1453. 1:00:56talk to different devices. They have
  1454. 1:00:57dedicated functions. So here the SPI
  1455. 1:01:02peripheral can talk there. The ADCs can
  1456. 1:01:03talk talk to the devices. And later on
  1457. 1:01:05we'll learn about interrupts. So the bus
  1458. 1:01:07is not the only way. The bus is just the
  1459. 1:01:10primary way for the core to to send push
  1460. 1:01:12data around with data being different
  1461. 1:01:14than signals.
  1462. 1:01:16Okay. And the last register of note here
  1463. 1:01:19is that there's a pad driver mode
  1464. 1:01:20register which I suppose would be I mean
  1465. 1:01:22the registers are over here but it's
  1466. 1:01:24really affecting uh this output device.
  1467. 1:01:26And it has weird things. It took me a
  1468. 1:01:28while to kind of figure out what they
  1469. 1:01:30really meant but you have options to
  1470. 1:01:32drive weakly to drive strong. You can
  1471. 1:01:36also drive sharp and drive medium and
  1472. 1:01:39drive soft. And I can't figure out what
  1473. 1:01:41the difference between uh hard and soft
  1474. 1:01:44and all and weak and soft and sharp is
  1475. 1:01:46but kind of took me a while to figure it
  1476. 1:01:49out. And so what they're saying is this
  1477. 1:01:51is the drive strength of the GP of the
  1478. 1:01:54uh pushpull pair. And you can either
  1479. 1:01:58have it transition from high to low very
  1480. 1:02:00quickly. That would be the sharp, medium
  1481. 1:02:03or soft. And then you can also configure
  1482. 1:02:05it to push out more current or less
  1483. 1:02:07current. And why would you want that?
  1484. 1:02:09Why don't you just get normal square
  1485. 1:02:10waves? Well, what you find out is that
  1486. 1:02:12the loading conditions of your bus of
  1487. 1:02:15the off device bus like as the GPO pin
  1488. 1:02:19is trying to talk to something else will
  1489. 1:02:20affect your signal. And so if there's
  1490. 1:02:23lots of capacitance or lots of
  1491. 1:02:25inductance on that, you will get
  1492. 1:02:26overshooting. So you might want to go as
  1493. 1:02:28fast as possible, but then you get this
  1494. 1:02:30ringing. So if you saw that you're like
  1495. 1:02:32oh I am driving too strong I need to
  1496. 1:02:35reduce I need to go from sharp to medium
  1497. 1:02:38to soft so that I don't get that
  1498. 1:02:40overshooting and that overshooting will
  1499. 1:02:41cause noise and could cause data
  1500. 1:02:43corruption. Um and also the drive
  1501. 1:02:46strength allows you to drive slightly
  1502. 1:02:48bigger things. It's not a lot more
  1503. 1:02:49currents like half a milliamp versus 2
  1504. 1:02:51milliamps but maybe enough to change how
  1505. 1:02:53you would uh light up an LED for
  1506. 1:02:55instance.
  1507. 1:02:58Okay, any questions on the peripheral
  1508. 1:03:00itself? And I think the real goal is
  1509. 1:03:03trying to connect like, okay, I have
  1510. 1:03:06some functionality here. I have some
  1511. 1:03:08registers. I know where the address is.
  1512. 1:03:10I can read through the data sheet and
  1513. 1:03:12say, okay, I need to drive this thing
  1514. 1:03:14stronger or faster. And now I can figure
  1515. 1:03:16out the bit fields I would need to do to
  1516. 1:03:18put into that register to control the
  1517. 1:03:20function of the GPO port.
  1518. 1:03:24What questions do you have before we
  1519. 1:03:25move forward?
  1520. 1:03:28Did you guys cover all this in lab? Is
  1521. 1:03:29this a 100% review?
  1522. 1:03:33Kind of like I I just pushed the buttons
  1523. 1:03:36in lab. I have no idea what I did.
  1524. 1:03:39Totally fine. Totally fine. I remember
  1525. 1:03:40taking this class. Okay. So, what we're
  1526. 1:03:43going to do next is we're just going to
  1527. 1:03:45try to do an example working together to
  1528. 1:03:48try to connect up a uh GPO port
  1529. 1:03:55to an APB just to think through the
  1530. 1:03:58logic signals
  1531. 1:04:00here. Can you pass those down there?
  1532. 1:04:04And there will be lots of prompting. And
  1533. 1:04:06so, can you pass these up?
  1534. 1:04:09And you can pass those up and over.
  1535. 1:04:13And
  1536. 1:04:16you can go up and over
  1537. 1:04:18or over and up. There you go. Cute.
  1538. 1:04:26Here. You guys might run out. You guys
  1539. 1:04:28can start here. Send him that way.
  1540. 1:04:41All right.
  1541. 1:04:43So, we'll need lots of prompting for
  1542. 1:04:45this one. So, my goal, and you're not
  1543. 1:04:47supposed to be perfect at it. You're
  1544. 1:04:49just supposed to think through it, is to
  1545. 1:04:50give this given this data sheet, which
  1546. 1:04:52I'll leave up here. So, this data sheet
  1547. 1:04:54is kind of like a simplified version.
  1548. 1:04:56The other one, it says it has an output
  1549. 1:04:58input register, an output register, and
  1550. 1:05:00a mode register. And then it tells you
  1551. 1:05:03what is the functionality of those pins
  1552. 1:05:05of the the the register should do.
  1553. 1:05:07Right? So here it says uh you can make a
  1554. 1:05:10general purpose output. You can make a
  1555. 1:05:12general purpose input. You uh how many
  1556. 1:05:16bits there are in the system, how many
  1557. 1:05:17pads there are in the system. Okay. And
  1558. 1:05:20you're also given, you know, a standard
  1559. 1:05:22notation. You could use other logic
  1560. 1:05:24elements if you really wanted to, but
  1561. 1:05:25this is kind of standard set of
  1562. 1:05:27elements. And now the goal is wire this
  1563. 1:05:30thing up. Okay, so here you got your AP
  1564. 1:05:34signals. And what you want to be able to
  1565. 1:05:35do is uh implement a full ports worth of
  1566. 1:05:38logic. So you want to be able to write
  1567. 1:05:40and read and control the output
  1568. 1:05:42registers and think through all the
  1569. 1:05:44signals that would have to be to be put
  1570. 1:05:46in here. And you should do this part for
  1571. 1:05:49the full port, but you only have to wire
  1572. 1:05:50up one of the pads here. And so you have
  1573. 1:05:53to figure out how many bits you want in
  1574. 1:05:54your registers and how they should all
  1575. 1:05:56be connected. So you should be able to
  1576. 1:05:58write to the um output register. You
  1577. 1:06:01should be able to read from the output
  1578. 1:06:02register. You should be able to read
  1579. 1:06:03from the input register and you should
  1580. 1:06:05be able to write to the um
  1581. 1:06:08uh control register and read from it as
  1582. 1:06:10well.
  1583. 1:06:12All right. And then we'll go through it
  1584. 1:06:14together. All right. Go for it.
  1585. 1:06:20Did you miss one?
  1586. 1:06:22>> Of course.
  1587. 1:06:23>> No, I lost my uh my my purse here.
  1588. 1:06:27>> Oh, go look.
  1589. 1:06:29You need one.
  1590. 1:06:31>> Sure. Uh, I don't know.
  1591. 1:06:34>> Yeah.
  1592. 1:06:36You need more up there? Oh, yeah. They
  1593. 1:06:37need a whole bunch up there. Okay.
  1594. 1:06:47>> They need it. There we go.
  1595. 1:06:49Being stingy with them. I should have
  1596. 1:06:52pass it down.
  1597. 1:06:55Oh, here. Just take that. There you go.
  1598. 1:06:57You guys need some. Thank you.
  1599. 1:07:09There you go. I suppose you need one to
  1600. 1:07:12there. Okay.
  1601. 1:07:38No,
  1602. 1:07:54[clears throat and cough]
  1603. 1:08:07>> [clears throat]
  1604. 1:08:08>> You have to draw.
  1605. 1:08:20>> All right. So, this is what the the
  1606. 1:08:25manufacturer says. the data sheets that
  1607. 1:08:27that the ports have to do these things,
  1608. 1:08:31right? So from basically if you look
  1609. 1:08:34through data sheet, you will see a bunch
  1610. 1:08:36of port definitions and registry
  1611. 1:08:38definitions and then you can think for
  1612. 1:08:40yourself what should be in that chip.
  1613. 1:08:42What have to be there? So here we know
  1614. 1:08:45that there is at some uh memory location
  1615. 1:08:48some address 48008
  1616. 1:08:51there is a register in and you can only
  1617. 1:08:54read from it.
  1618. 1:09:11There's a pin missing for data in the
  1619. 1:09:14path. You can describe
  1620. 1:09:20No, this
  1621. 1:09:31morning
  1622. 1:10:08All right.
  1623. 1:10:25[clears throat]
  1624. 1:10:36Yeah.
  1625. 1:11:03SMB.
  1626. 1:11:17Bless
  1627. 1:11:39you.
  1628. 1:12:07Now
  1629. 1:12:11that They're
  1630. 1:12:27all
  1631. 1:12:36right.
  1632. 1:12:39Yeah.
  1633. 1:12:51Yeah.
  1634. 1:13:17Wow.
  1635. 1:13:52I don't know.
  1636. 1:14:02President
  1637. 1:14:12[snorts]
  1638. 1:14:28[clears throat]
  1639. 1:14:41Is
  1640. 1:15:05that
  1641. 1:15:10position?
  1642. 1:15:33Are you
  1643. 1:15:46Holy name.
  1644. 1:16:28>> [clears throat]
  1645. 1:16:41>> So it's All
  1646. 1:16:55right, let's go through the rest and
  1647. 1:16:56see.
  1648. 1:17:03>> All right, I saw lots of good answers
  1649. 1:17:05out there. Let's see.
  1650. 1:17:11All right.
  1651. 1:17:13So, one of the tricks is these are six.
  1652. 1:17:15You only need 16- bit addresses, not
  1653. 1:17:1732-bit registers. It doesn't really
  1654. 1:17:19matter, but uh because the data sheet
  1655. 1:17:22said only need the lower 16. The upper
  1656. 1:17:2416 didn't do anything. And now we got to
  1657. 1:17:27figure out how to connect these up. And
  1658. 1:17:28so, the data sheet also said that uh I I
  1659. 1:17:31should explain this better that the
  1660. 1:17:32motor was the control. And then we have
  1661. 1:17:34output input. You have to be able to
  1662. 1:17:36write to the output register of course.
  1663. 1:17:38And you should be able to read from
  1664. 1:17:40that. You have to be able to write to
  1665. 1:17:42the control register of the motor and
  1666. 1:17:44read out of it. But you only need to
  1667. 1:17:46read out of the input register. So the
  1668. 1:17:49so if you look through the data sheet,
  1669. 1:17:50it tells you how it's connected to the
  1670. 1:17:52ABB, right? You can like look through
  1671. 1:17:54the data sheet to understand what the
  1672. 1:17:56architecture underneath is. And so I can
  1673. 1:17:58draw some of those lines here. Let's see
  1674. 1:17:59what I did. So I took PR data, I
  1675. 1:18:02connected it to those two.
  1676. 1:18:05And then I took the output because I
  1677. 1:18:08have to be able to read from all of
  1678. 1:18:09them. And it shouldn't say 32. It should
  1679. 1:18:10say 15 to zero. And then I didn't didn't
  1680. 1:18:13explain this to you, but you would
  1681. 1:18:14probably need to have a MX there to
  1682. 1:18:17select which one of those should be read
  1683. 1:18:19back when. And I didn't really prompt
  1684. 1:18:20you on that one. So that you need a MX
  1685. 1:18:22to connect it back to the output because
  1686. 1:18:25you can't have three 30 or three 16- bit
  1687. 1:18:28buses going back at once. Okay.
  1688. 1:18:32And then what are we going to do? P
  1689. 1:18:34clock no worries.
  1690. 1:18:36Then we need to be able to individually
  1691. 1:18:39select which register will the data be
  1692. 1:18:42written into. So that means we have have
  1693. 1:18:45to have to have a way to individually
  1694. 1:18:48uh select uh individual peripherals or
  1695. 1:18:51individual registers. So here we've got
  1696. 1:18:53a mask on there and then we have a we
  1697. 1:18:57also have our and in there. So all those
  1698. 1:18:58have to be true and all that has to be
  1699. 1:19:02true.
  1700. 1:19:03such that I have to have P write, P
  1701. 1:19:06enable, P select and the correct address
  1702. 1:19:08to enable say the output register to
  1703. 1:19:11latch in data that will be sent out to
  1704. 1:19:13the output register.
  1705. 1:19:18Um, and then you don't really have to
  1706. 1:19:20worry about it, but there's extra
  1707. 1:19:21control lines because when you are uh
  1708. 1:19:24when you're reading from the APB is
  1709. 1:19:25reading from one of these registers,
  1710. 1:19:27that register has to be uh connected to
  1711. 1:19:29the output uh bus.
  1712. 1:19:33And then what else? Oh, then the output
  1713. 1:19:36of the pin has to go to the input of the
  1714. 1:19:39input register. Okay.
  1715. 1:19:43And then the outputs of the GPO uh
  1716. 1:19:47control register goes to the control and
  1717. 1:19:49the output of the output register goes
  1718. 1:19:51to the output or input pin I suppose of
  1719. 1:19:54the uh pad.
  1720. 1:19:57And then let's see. I forgot what what
  1721. 1:19:59is

About this transcript

This page contains the full transcript of EECS 373 - Fall 2026 - Lecture 5: “GPIO & MMIO” by Interactive Sensing and Computing Lab , generated from the public captions YouTube serves with the video. The transcript has 11,860 words across 1,721 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.