But that doesn't really make sense. I would want as follows:PULL IFEMPTY is useful if an OUT with autopull would stall in an inappropriate location when the TX FIFO is empty. For
example, a UART transmitter should not stall immediately after asserting the start bit. IfEmpty permits some of the same
program simplifications as autopull, but the stall occurs at a controlled point in the program.
- wait for TX FIFO data
- assert a 0 on TX line (start bit)
- shift out data
- assert a 1 on TX line (stop bit)
So I headed to the examples, and found the UART TX example code on page 361, which has
Code: Select all
7 .program uart_tx 8 .side_set 1 opt 9 10 ; An 8n1 UART transmit program. 11 ; OUT pin 0 and side-set pin 0 are both mapped to UART TX pin. 12 13 pull side 1  ; Assert stop bit, or stall with line in idle state 14 set x, 7 side 0  ; Preload bit counter, assert start bit for 8 clocks 15 bitloop: ; This loop will run 8 times (8n1 UART) 16 out pins, 1 ; Shift 1 bit from OSR to the first OUT pin 17 jmp x-- bitloop  ; Each loop iteration is 8 cycles.
Which is, you know, exactly what I thought it would be except for no outer jump back to the start. Note it says "or stall with line in idle state" which is exactly what I would expect. Wait until there's data, when there is, shift it out. I'm sure there are a lot of great examples for IFEMPTY, but the only place I see it used is in a different example that seems like it isn't an existing peripheral interface specification. It just seems weird, is all. Why explicitly mention a use case that doesn't make sense and then not even show me how it's supposed to be used?
Another side note, the whole section seems kind of "off." On page 329 it uses a "nop " instead of a "wait " which is odd considering the last I read on the ISA on page 325, there was no NOP instruction (this oddity also shows up on page 355). Also on page 325 is the same example code twice and without any identifier like "example x.yz" (which would allow the text to refer to it twice without it appearing twice) and that made me think there was some difference I didn't see until I read the information on where the code was from. And on page 332 it says "Expressions may be freely (boldly?) used within pioasm values." Why include that? Why not just "Expressions may be used within pioasm values." Seems like something left in from editing. I'm more curious about the IFEMPTY thing, but those kinds of oddities in a manual with something that is, to my knowledge, an industry leading technology (programmable QSPI is common but this is a whole new level), is confusing.
EDIT:::: Some more oddities I found since making the post
- I was reminded when I saw again about space requirements that this section occasionally seems like it's trying to market the PIO system. This is weird. I'm not the layout person, I don't really care if things take up more or less physical die space. I don't know why it's included every now and then.
- The use of push/pull instead of push/pop is odd but not impossible to deal with. But in figure 44, it has a "TX Fifo Pop" line. So that's inconsistent. This inconsistency happens again at the top of page 355.