= Raspberry Pi Pico =
<<TableOfContents(2)>>

 * https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#technical-specification
 * https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf
 * https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf
 * https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf
 * https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf
 * https://mauser.pt/catalog/product_info.php?cPath=1667_2620_1672&products_id=095-0598
 * https://mauser.pt/catalog/product_info.php?cPath=1667_2620_1672&products_id=095-0596
 * https://github.com/raspberrypi/pico-sdk.git
 * https://github.com/raspberrypi/pico-examples.git

Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces.

[[ https://datasheets.raspberrypi.com/pico/RPi-Pico-R3-PUBLIC-20200119.zip | Raspberrypi pico design files]]

== raspberry pi pico pinout ==
 * https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#pinout-and-design-files

{{attachment:pinoutrpipico-h.png|alt text|width=800 }}

== Run-Reset button (right side) ==
To help set mass storage with BOOTSEL + RUN-Reset button 
{{attachment:reset-run-button.jpg|alt text|width=800 }}

== Connect with micro-usb ==
Click on BOOTSEL button to enable mass storage

{{{#!highlight sh
sudo dmesg
# [ 3570.065996] usb 1-4.3: Product: RP2 Boot
# [ 3570.066006] usb 1-4.3: Manufacturer: Raspberry Pi
# [ 3570.066016] usb 1-4.3: SerialNumber: E0C9xxxxxxxx
# [ 3570.163372] usb-storage 1-4.3:1.0: USB Mass Storage device detected
# [ 3570.164049] scsi host2: usb-storage 1-4.3:1.0
# [ 3570.164381] usbcore: registered new interface driver usb-storage
# [ 3570.180142] usbcore: registered new interface driver uas
# [ 3571.192940] scsi 2:0:0:0: Direct-Access     RPI      RP2              3    PQ: 0 ANSI: 2
# [ 3571.194468] sd 2:0:0:0: Attached scsi generic sg1 type 0
# [ 3571.195164] sd 2:0:0:0: [sdb] 262144 512-byte logical blocks: (134 MB/128 MiB)
# [ 3571.195818] sd 2:0:0:0: [sdb] Write Protect is off
# [ 3571.195830] sd 2:0:0:0: [sdb] Mode Sense: 03 00 00 00
# [ 3571.196325] sd 2:0:0:0: [sdb] No Caching mode page found
# [ 3571.196335] sd 2:0:0:0: [sdb] Assuming drive cache: write through
# [ 3571.217448]  sdb: sdb1
# [ 3571.237585] sd 2:0:0:0: [sdb] Attached SCSI removable disk
}}}

Serial USB ttyACM0
{{{#!highlight sh
sudo dmesg
# [9067045.808125] usb 1-1.3: new full-speed USB device number 7 using dwc_otg
# [9067045.941554] usb 1-1.3: New USB device found, idVendor=2e8a, idProduct=000a, bcdDevice= 1.00
# [9067045.941564] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
# [9067045.941568] usb 1-1.3: Product: Pico
# [9067045.941572] usb 1-1.3: Manufacturer: Raspberry Pi
# [9067045.941577] usb 1-1.3: SerialNumber: E661xxxxxxxxxxxx
# [9067045.944106] cdc_acm 1-1.3:1.0: ttyACM0: USB ACM device
apt install picocom 
picocom -b 115200 --echo /dev/ttyACM0 
# on
# Led is ON 5
# Periodical timer at 4238154004018
# on
# Led is ON 5
# off
# Led is OFF 5
# on
# Led is ON 5
# Periodical timer at 4238164004155
# gp21on
# GP21 is ON
# ctrl+a , ctrl+x
# Thanks for using picocom
}}}

{{attachment:gp25-gp21-on.jpg|alt text|width=800}}

== ADC2 GP28 PIN34 (hello_adc.c) ==
 * https://github.com/raspberrypi/pico-examples/blob/master/adc/hello_adc/hello_adc.c
{{{#!highlight c
adc_init()
adc_gpio_init(28)
adc_select_input(2)
uint16_t res = adc_read()
conversion_factor = 3.3f/(1<<12)
}}}

== ADC4 onboard temperature sensor (onboard_temperature.c) ==

In the section '''4.9. ADC and Temperature Sensor''' available in [[https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf | rp2040 datasheet]] it's mentioned that ADC4 reads values from an onboard temperature sensor. 

 * https://github.com/raspberrypi/pico-examples/blob/master/adc/onboard_temperature/onboard_temperature.c
{{{#!highlight c
adc_init()
adc_set_temp_sensor_enabled(true)
adc_select_input(4)
uint16_t res = adc_read()
conversion_factor = 3.3f/(1<<12)
}}}