**** BEGIN LOGGING AT Fri Aug 23 03:00:40 2019 Aug 23 09:32:41 I have a question for anybody whose done SPI stuff with PRU Aug 23 09:32:54 I am trying to set up a wait cycle that waits until the transmission is completely finished Aug 23 09:33:12 I am manually controlling the chip-select pin Aug 23 09:33:31 so I need to know when it is finished so I can toggle that pin Aug 23 09:34:04 You'd think that the proper register for this information would be MCSPI_CHXSTAT Aug 23 09:34:33 and the proper bit in that register would be bit 1, "Channel X transmitter register status" Aug 23 09:35:14 oh, no, wait, I meant bit 2, "Channel X end-of-transfer status" Aug 23 09:35:53 however, I found that I cannot simply poll on that second bit Aug 23 09:36:39 I actually have to poll on the first bit, THEN poll on the second Aug 23 09:36:50 does this sound right? Aug 23 09:37:55 The process that seems to work is this: Aug 23 09:38:13 1) send data to MCSPI_TX1 Aug 23 09:38:47 2) poll bit 1 of MCSPI_CH1STAT until it indicates the data has been transferred to the shift register Aug 23 09:39:10 3) poll bit 2 of MCSPI_CH1STAT until it indicates the transmission is complete Aug 23 09:39:41 So, I guess if you skip step 2, then you may check for completion before the SPI transfer process has even started Aug 23 09:40:13 OK, I guess I've sorted that out. It just seems overly complicated. Thanks for listening everyboyd! Aug 23 10:49:19 dcmertens: you could also wait for the received data to be available, since that requires the transfer to complete Aug 23 10:49:39 zmatt, that's a good idea Aug 23 10:49:47 though, I disabled the receive on these Aug 23 10:50:08 but you're right, that would simplify the process. Thanks! Aug 23 10:52:38 but yeah, the alternative is ensuring the (last) word has entered the shift register and then poll EOT Aug 23 10:58:26 zmatt, true, but I'm only sending single words at a time, so that's easy for me to monitor Aug 23 10:58:39 your approach is better for sending long streams, though Aug 23 11:00:51 hmm, actually I'd say that using the received word is probably simpler for a single-word transfer, but for a long transmit-only transfer I'd be more inclined to have receive disabled and use a multi-step wait (wait until last word has entered the shfit register, then poll EOT) Aug 23 11:01:11 and now I can see why the process is the way it is. If you wanted to send multiple words, you would be checking bit 1 to make sure the TX register is clear before sending it your next word Aug 23 11:01:14 otherwise you also need to continuously discard the data during the transfer Aug 23 11:01:22 so checking you'll repeat step 2 often, but step 3 only once Aug 23 11:01:38 yep Aug 23 11:11:52 for tx+rx (without fifo) you'd use something like write word; loop { wait until tx empty; write word; wait until rx full; read word; } wait until rx full; read last word; and polling EOT is unnecessary Aug 23 11:12:44 that would be the streamlined way to do it anyway Aug 23 11:13:07 loop { write word; wait until rx full; read word; } would work too Aug 23 11:16:12 I guess with PRU synchronously waiting for the event it might be a waste of effort to try to streamline the transfer... it matters a lot more when doing it irq-driven in a linux driver with all the overhead of irq handling Aug 23 11:17:36 (if you do ever decide to try the streamlined version of tx+rx, don't forget to set the TURBO bit, otherwise it would be a bit pointless) Aug 23 11:44:34 zmatt, indeed Aug 23 11:45:11 btw, for PRU SPI stuff, I found a fantastic working example here: Aug 23 11:45:12 http://barrett-morrison.com/nathan/media/engineering/beaglebone/SPI,PRU/ Aug 23 11:45:30 I don't think I ever would have gotten the incantation correct without that Aug 23 20:03:02 jkridner[m]: tell Mark that if he wants my help, he may want to consider staying connected for more than 5 minutes :P (also, using a PM greatly increases the average time it takes me to see a message) Aug 23 20:10:05 pm...can I pm too? Aug 23 20:10:52 no, that was my whole point... don't PM me :/ Aug 23 20:10:59 Oh. Bo! Aug 23 20:11:06 Sorry. Oh. Boo! Aug 23 20:11:20 private messages...ooh la la. Aug 23 20:11:43 @zmatt: I am following along in Molloy's book again. Yea! Aug 23 20:11:56 Ch. 5. Ut oh! Aug 23 20:12:25 I am installing cython w/ pip3 now. Dang. It is hanging for days. Aug 23 20:18:05 Heh. Also, I am trying to understand the book, "Bad to the Bone," second edition. Some of the source in that book has some vague set up instructions. Aug 23 20:18:06 ... Aug 23 20:18:31 No offense. I am only on page 22. Aug 23 20:18:50 I came across a switch source that details a switch. Now, could I use any switch? Aug 23 20:19:18 open/closed or just a reed switch. I am going bonkers w/ ideas. Aug 23 20:19:47 cython installed! Yea boy! Aug 23 23:29:36 Do not worry about the switch idea. I will just use a push button or something. Aug 24 00:39:44 @zmatt: Hey! Do you know that I never properly bound my x-lite and x8r. I just figured it out. The BBBlue shall fly as planned! Aug 24 00:40:03 A fellow helped me through it online. Miracles do come true! Aug 24 00:54:50 Yes! Aug 24 00:54:52 It works! Aug 24 00:54:57 I can fly now! Aug 24 00:55:08 All over a silly binding process. Aug 24 00:55:10 Sheesh. **** ENDING LOGGING AT Sat Aug 24 02:59:57 2019