Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| 
                    raspberrypipico:pico_pio [2021/03/13 19:30] admin [irq(option, irq_num, rel)]  | 
                
                    raspberrypipico:pico_pio [2021/12/04 09:40] (current) admin [Knowledge]  | 
            ||
|---|---|---|---|
| Line 17: | Line 17: | ||
| The RP2040 contains two **programmable IO blocks** with four **state machines** each, to control  | The RP2040 contains two **programmable IO blocks** with four **state machines** each, to control  | ||
| {{: | {{: | ||
| + | |||
| + | //diagram taken from the [[https:// | ||
| + | |||
| Each PIO block has one **instruction memory** with 32 instructions. Four read ports allows all state machine simultaneously access.\\ | Each PIO block has one **instruction memory** with 32 instructions. Four read ports allows all state machine simultaneously access.\\ | ||
| Each state machine has:\\ | Each state machine has:\\ | ||
| Line 30: | Line 33: | ||
| - | //diagrams  | + | //diagram  | 
| ---- | ---- | ||
| Line 51: | Line 54: | ||
| **frequency** the frequency of the state machine, should be between 1000 and 125000000\\ | **frequency** the frequency of the state machine, should be between 1000 and 125000000\\ | ||
| - | **GPIO pin** depending on the first on all following pins will be mapped (up to 32)\\ | + | **GPIO pin** depending on the first one, all following pins will be mapped (up to 32)\\ | 
| INPUT: in_base (sets input pins) | INPUT: in_base (sets input pins) | ||
|    sm = StateMachine(0, |    sm = StateMachine(0, | ||
| Line 152: | Line 155: | ||
|     |     | ||
| - | ====wait()==== | + | ====wait(option)==== | 
| **wait(// | **wait(// | ||
| It will waits until the specified GPIO has the specified polarity.\\ | It will waits until the specified GPIO has the specified polarity.\\ | ||
| Line 166: | Line 169: | ||
| - num (interrupt number, with rel the relative interrupt numbers could be used)\\   | - num (interrupt number, with rel the relative interrupt numbers could be used)\\   | ||
| + |     | ||
| ====in(source, | ====in(source, | ||
| Line 234: | Line 238: | ||
|   mov(osr, x) #copy the x scratch register to the output shift register  |   mov(osr, x) #copy the x scratch register to the output shift register  | ||
| - | ====irq(option, | + | ====irq(option, | 
| The IRQ instruction sets or clears an interrupt flag.\\ | The IRQ instruction sets or clears an interrupt flag.\\ | ||
| **option**\\ | **option**\\ | ||
| Line 240: | Line 244: | ||
| - wait (wait until the flag is zero before setting it)\\ | - wait (wait until the flag is zero before setting it)\\ | ||
| - clear (clears the flag)\\ | - clear (clears the flag)\\ | ||
| - | **num**, number of the interrupt 0-7\\ | + | **num** number of the interrupt 0-7\\ | 
| - | **rel** relative IRQ number, can set different IRQ per StateMachine, | + | **rel** relative IRQ number\\ | 
| In the StateMachine | In the StateMachine | ||
|     |     | ||
| Line 278: | Line 282: | ||
|     |     | ||
| ====nop()==== | ====nop()==== | ||
| - | The NOP instruction stands for no operations.  | + | The NOP instruction stands for no operations.  | 
| - | nop (31) #delay 31 cycles | + | nop () [31] #delay 31 cycles | 
| ====wrap()==== | ====wrap()==== | ||
| Line 324: | Line 328: | ||
| ---- | ---- | ||
| - | ===== Simple Audio Out===== | ||
| - |     | ||
| - | | | ||
| - |     | ||
| - | |------ Audio Out | ||
| - |     | ||
| - | | | ||
| - |     | ||
| - | ---- | ||
| - | ==== Resistor DAC ==== | ||
| - | |||
| - | |||
| - | ---- | ||
| ===== Knowledge ===== | ===== Knowledge ===== | ||
| [[https:// | [[https:// | ||
| Line 346: | Line 337: | ||
| Stepper motor example on [[https:// | Stepper motor example on [[https:// | ||
| - | [[https:// | + | [[https:// | 
| + | |||
| + | [[https:// | ||
| + | |||
| + | ---- | ||
| + | ==== License ==== | ||
| + | |||
| + | This manuals is made by **Wolfgang Spahn** 2021.\\ | ||
| + | Except where otherwise noted, content on this wiki is licensed under the following license: [[http:// | ||
| + | |||
| + | < | ||
| + | <a rel=" | ||
| + | </ | ||
| ---- | ---- | ||