Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
raspberrypipico:raspberrypipico [2021/03/12 13:10] admin [Programmable I/O] |
raspberrypipico:raspberrypipico [2021/06/07 18:07] (current) admin [Links & Projects] |
||
|---|---|---|---|
| Line 6: | Line 6: | ||
| ==== Pinout ==== | ==== Pinout ==== | ||
| {{: | {{: | ||
| + | // schematic from [[https:// | ||
| On ADC 04 is a temperature sensor.\\ | On ADC 04 is a temperature sensor.\\ | ||
| Line 15: | Line 16: | ||
| [[https:// | [[https:// | ||
| - | Plug in the RP Pico with pressed BOOTESL button | + | |
| - | Download | + | Plug in the RP Pico with pressed BOOTESL button.\\ |
| - | wget " | + | Download the [[https:// |
| + | wget " | ||
| Copy it to the RP Pico | Copy it to the RP Pico | ||
| Line 68: | Line 70: | ||
| More sound with [[https:// | More sound with [[https:// | ||
| + | |||
| + | ---- | ||
| + | ==== Power ==== | ||
| + | |||
| + | VBUS – USB power, 5V | ||
| + | VSYS – power in (2-5V) | ||
| + | 3V3 – power out 3.3V, 300mA | ||
| + | | ||
| + | RUN – enable, disable or reset | ||
| ---- | ---- | ||
| Line 76: | Line 87: | ||
| one can change the duty cycle, 0 to 65535 | one can change the duty cycle, 0 to 65535 | ||
| pwm.duty_u16(duty) | pwm.duty_u16(duty) | ||
| + | |||
| + | ---- | ||
| + | ==== ADC ==== | ||
| + | The Raspberry Pi Pico has four 12bit analog to digital converter: | ||
| + | ADC_VREF | ||
| + | GP28 - ADC2 | ||
| + | AGND (analog ground) | ||
| + | GP27 - ADC1 | ||
| + | GP27 - ADC0 | ||
| + | The fourth ADC is internally wired to a temperature sensor.\\ | ||
| + | [[https:// | ||
| ---- | ---- | ||
| Line 109: | Line 131: | ||
| ---- | ---- | ||
| - | [[https:// | + | ==== Links & Projects ==== |
| - | The RP Pico has eight state machines (0-7) including these parameters: | + | |
| - | - state machine number\\ | + | |
| - | - PIO program\\ | + | |
| - | - frequency (between 2000 and 125000000)\\ | + | |
| - | - GPIO pin\\ | + | |
| - | These mini programs run on the PIO state machines and run continuously.\\ | + | |
| - | from rp2 import PIO, StateMachine, | ||
| - | from machine import Pin | ||
| - | import utime | ||
| - | | ||
| - | led_onboard = machine.Pin(25, | ||
| - | led_onboard.value(1) | ||
| - | utime.sleep(2) | ||
| - | led_onboard.value(0) | ||
| - | | ||
| - | @asm_pio(set_init=PIO.OUT_LOW) | ||
| - | def faint_led(): | ||
| - | set(pins, 0) [20] | ||
| - | set(pins, 1) | ||
| - | | ||
| - | sm1 = StateMachine(1, | ||
| - | | ||
| - | while(True): | ||
| - | sm1.active(1) | ||
| - | utime.sleep(1) | ||
| - | sm1.active(0) | ||
| - | utime.sleep(1) | ||
| - | The commands set(pins, 0) and set(pins, 1) turns the GPIO pin on and off.\\ | + | **WS2812**\\ |
| - | In square brackets are numbers between 1 and 31 to pause this clock cycles\\ | + | [[https:// |
| - | The @asm_pio descriptor above the function takes the set_init parameters.\\ | + | |
| - | To start and stop the state machine use the active method (1 or 0)\\ | + | |
| - | ==The Nine State Machine Instructions== | + | **Usb Micro**\\ |
| - | | + | [[https:// |
| - | | + | |
| - | | + | |
| - | | + | |
| - | * mov() – moves data x or y in register, e.g. mov(y, osr) osr=output shift register | + | |
| - | * irq – Sets or clears interrupt flag e.g. irq(rel(0)) in python: sm.irq(myFunction) | + | |
| - | * set() [] – Writes data to destination, | + | |
| - | * wait – Pauses until a defined action happens | + | |
| - | * label(" | + | |
| - | ==Some more Instructions== | + | |
| - | - nop () [] - no operations, delays 0 to 31 circles\\ | + | |
| - | - wrap_target() and wrap () - resets program counter and starts over again\\ | + | |
| - | - lable() | + | |
| - | - jmp () - jumps conditions: | + | |
| - | _ jump if zero: jmp(not_x, " | + | |
| - | _ shift the register, jump if not exhausted: jmp(not_osre, | + | |
| - | _ decrements, jump if not zero: jmp(x_dec," | + | |
| - | Example by [[https:// | + | ---- |
| - | ]] and on [[https:// | + | ==== License ==== |
| - | [[https://datasheets.raspberrypi.org/rp2040/rp2040-datasheet.pdf|RP2040 Datasheet]], Chapter 30, page 330 following\\ | + | This manuals is made by **Wolfgang Spahn** 2021.\\ |
| + | Except where otherwise noted, content on this wiki is licensed under the following license: | ||
| - | [[https://www.seeedstudio.com/blog/2021/ | + | < |
| - | + | <a rel=" | |
| - | ---- | + | </ |
| - | ==== WS2812 ==== | + | |
| - | + | ||
| - | [[https://makersportal.com/blog/ws2812-ring-light-with-raspberry-pi-pico]]\\ | + | |
| ---- | ---- | ||