Commit Graph

790 Commits

Author SHA1 Message Date
Mark
37ee18349f
Merge branch 'main' into rp2040_countio 2021-03-02 19:47:53 -06:00
gamblor21
4246cc3f6d Counter and PWMOut slice conflict check 2021-03-02 19:32:06 -06:00
Jeff Epler
b27afad9cb move LED to the right spot in the file 2021-03-02 19:02:38 -06:00
Jeff Epler
efc2667b5f
Merge pull request #4186 from jepler/update-protomatter-rp2
Enable protomatter on RP2040 builds
2021-03-02 19:01:37 -06:00
Dan Halbert
15615effc2
Merge pull request #4276 from bergdahl/patch-1
Update StateMachine.c
2021-03-02 17:11:45 -05:00
Dan Halbert
f31b472309 Merge remote-tracking branch 'adafruit/main' into rp2040-i2c-short-writes 2021-03-02 15:17:12 -05:00
Dan Halbert
9939c59caa wip 2021-03-02 15:16:55 -05:00
Jeff Epler
8bfd308d37 feather rp2040: add board.LED 2021-03-02 13:16:09 -06:00
Scott Shawcroft
ce70b95990
Merge pull request #4177 from microDev1/nvm-rp
RP2040: Support for NVM
2021-03-02 09:57:36 -08:00
Dan Halbert
f41fb6fafc
Apply suggestions from code review
copyediting
2021-03-02 12:01:50 -05:00
Scott Shawcroft
2651e15a52
Merge pull request #4309 from jepler/rp2040-interrupt-pio
rp2pio: allow keyboard interrupt while waiting for tx fifo to empty (& stall)
2021-03-02 08:55:27 -08:00
Jeff Epler
f560b5f3a3 raspberry: switch pico back to the boot2 for W25Q16
Presumably, switching it to generic hurt performance a bit.

I verified that the build-raspberry_pi_pico/boot2_padded_checksummed.S
built file has the same checksum as the old
bs2_default_padded_checksummed.S
2021-03-02 08:08:41 -06:00
microDev
b029031286
minor structural modification 2021-03-02 14:36:28 +05:30
Jeff Epler
5a00862b1d raspberrypi: allow directly specifying the original boot .S file
.. all the necessary steps to transform it into a padded, checksummed
file are now done by the build system.

Since it is assigned by "?=", it _should_ be the case that individual
builds can override it.

I did not "test" this per se, but it gives the same content and checksum
(except for the identifying comment with a path) as #4302.
2021-03-01 21:08:19 -06:00
Jeff Epler
4b63a8c9b4 rp2pio: allow keyboard interrupt while waiting for tx fifo to empty (& stall) 2021-03-01 21:07:04 -06:00
Scott Shawcroft
21a8752166
Merge pull request #4297 from adafruit/tannewt-patch-1
Update flash sizes for Adafruit RP2040 boards
2021-03-01 13:19:50 -08:00
Jeff Epler
238484ec26 Merge remote-tracking branch 'origin/main' into update-protomatter-rp2 2021-03-01 15:18:32 -06:00
Scott Shawcroft
532e7db293
Merge pull request #4267 from dhalbert/rp2040-digitalinout-fixes
RP2040: change DigitalInOut direction only when necessary; strong drive strength
2021-03-01 13:14:13 -08:00
Scott Shawcroft
af9dfccab1
Update QT Py flash size 2021-03-01 10:34:25 -08:00
Scott Shawcroft
dac047db61
Update Feather RP2040 to 8MB 2021-03-01 10:33:04 -08:00
gamblor21
d7bc8a46a5 Added counters per slice 2021-02-27 15:17:27 -06:00
root
29c89a2487 Removed more includes 2021-02-26 22:35:38 -06:00
root
f3515502b7 Removed unecessary includes 2021-02-26 22:33:50 -06:00
root
6374408c06 Changed reset_rp2pio_statemachine to clean up any PIO interrupts. 2021-02-26 22:28:50 -06:00
Jonny Bergdahl
f7eac46c78
Update StateMachine.c
Changed woring to use max instead
2021-02-27 00:07:30 +01:00
Scott Shawcroft
776301c932
Typo fix: direcion -> direction 2021-02-26 15:03:56 -08:00
Scott Shawcroft
888a0c5f08
Merge pull request #4224 from microDev1/busio-uart-rp
RP2040: Support for UART
2021-02-26 14:57:23 -08:00
Dan Halbert
d9234ffa82 need to gpio_set_dir() at some point 2021-02-26 15:27:35 -05:00
root
7942932176 Requested changes 2021-02-26 14:14:55 -06:00
Scott Shawcroft
2e6e91dc5c
Merge pull request #4253 from tannewt/rp2040_fix_pwm_reuse
Fix second shared PWM
2021-02-26 11:53:54 -08:00
Scott Shawcroft
7c8d7d77dd
Merge remote-tracking branch 'adafruit/main' into busio-uart-rp 2021-02-26 09:04:42 -08:00
Limor "Ladyada" Fried
caedc3bba6
Merge pull request #4270 from tannewt/rp2040_feather_pinout
Update RP2040 Feather pinout for production rev
2021-02-26 11:11:44 -05:00
Jeff Epler
1d1ff5f308 Merge remote-tracking branch 'origin/main' into update-protomatter-rp2 2021-02-26 09:56:35 -06:00
Scott Shawcroft
3f08cb47b8
Merge remote-tracking branch 'adafruit/main' into busio-uart-rp 2021-02-25 16:59:15 -08:00
Scott Shawcroft
52bc935fa7
A few minor fixes for corner cases
* Always clear the peripheral interrupt so we don't hang when full
* Store the ringbuf in the object so it gets collected when we're alive
* Make UART objects have a finaliser so they are deinit when their
  memory is freed
* Copy bytes into the ringbuf from the FIFO after we read to ensure
  the interrupt is enabled ASAP
* Copy bytes into the ringbuf from the FIFO before measuring our
  rx available because the interrupt is based on a threshold (not
  > 0). For example, a single byte won't trigger an interrupt.
2021-02-25 16:50:57 -08:00
Scott Shawcroft
f0432b9d6f
Remove neopixel power 2021-02-25 16:37:34 -08:00
Dan Halbert
d0f1cfb039 address review; use gpio_set() carefully 2021-02-25 18:41:22 -05:00
Scott Shawcroft
2b163ccd6a
Fix incorrect deinit mask 2021-02-25 14:57:46 -08:00
Scott Shawcroft
1b00d94b23
Fix second shared PWM
Fixes #4210
2021-02-25 14:49:09 -08:00
Scott Shawcroft
80f7972f72
Update RP2040 Feather pinout for production rev 2021-02-25 14:46:08 -08:00
Jeff Epler
22276710e6 rp2pio: Fix writing where the stride was 2 or 4
The wrong stride value was being checked.
2021-02-25 15:50:49 -06:00
Dan Halbert
199a8ce8b0 change DigitalInOut direction only when necessary; strong drive strength 2021-02-25 14:10:19 -05:00
root
f8eb5bc275 Cleanup PIOs and State Machines on soft reset 2021-02-25 12:38:43 -06:00
microDev
8170e26a86
more uart improvements
- address suggested changes
- refine uart instance availibility checks
- improve pin validation and rx buffer handling
2021-02-25 23:46:00 +05:30
root
86e60f5f35 Clean up formatting 2021-02-24 17:26:35 -06:00
root
17ff5dcc99 Return NotImplementedError for PulseOut 2021-02-24 17:04:05 -06:00
root
8e15f36baa pulseio (pulsein) for RP2040 2021-02-24 16:58:29 -06:00
microDev
5d7fdafcde
implement suggested changes
- add internal buffering
- rtc initialization fix
2021-02-25 00:48:36 +05:30
Mark
b935dcafdc
Merge branch 'main' into rp2040_countio 2021-02-23 19:46:41 -06:00
gamblor21
379f454ce6 Adding countio to rp2040 2021-02-23 19:38:05 -06:00
Scott Shawcroft
abbbb91fa8
Add state machine divisor check
This causes an exception when setting a state machine too slow or
too fast.

Fixes #4222
2021-02-23 16:30:46 -08:00
Scott Shawcroft
360475e266
Implement audiobusio and enhance PIO for it
This adds I2SOut and PDMIn support via PIO.

StateMachines can now:
 * read and read while writing
 * transfer in 1, 2 or 4 byte increments
 * init pins based on expected defaults automatically
 * be stopped and restarted
 * rxfifo can be cleared and rxstalls detected (good for tracking when
   the reading code isn't keeping up)

Fixes #4162
2021-02-23 15:50:00 -08:00
Scott Shawcroft
001d7299b2
Merge pull request #4228 from ZodiusInfuser/rp2040-boards
Added definitions for Pimoroni RP2040-based boards
2021-02-23 10:00:19 -08:00
ZodiusInfuser
1a0bf4c33f
Added flash size for PicoSystem 2021-02-23 11:04:20 +00:00
ZodiusInfuser
a9951c9b6c
Added flash size for Keybow2040 2021-02-23 11:01:40 +00:00
ZodiusInfuser
ca9b7debe0
Added flash size for Tiny2040 2021-02-23 10:43:35 +00:00
Scott Shawcroft
3fdf29e773
More parens 2021-02-22 18:35:09 -08:00
Scott Shawcroft
863981a5b8
Parens 2021-02-22 18:31:45 -08:00
Scott Shawcroft
0aafeac209
Board specific flash sizes for RP2040
Stop-gap solution for #4041. Comment is there to provide info
needed in the future. (We currently run the generic "safe" settings.)
2021-02-22 17:19:18 -08:00
ZodiusInfuser
52f2fd6d53
Removed trailing white space 2021-02-20 17:25:26 +00:00
ZodiusInfuser
417173b752
Removed trailing white space 2021-02-20 17:24:26 +00:00
ZodiusInfuser
9a4b8c5ed9
Removed trailing white space 2021-02-20 17:23:23 +00:00
ZodiusInfuser
dea498a51f
Added new line 2021-02-20 17:20:28 +00:00
ZodiusInfuser
9fbeb0baea
Added new line 2021-02-20 17:20:06 +00:00
ZodiusInfuser
03577ec81c
Added new line 2021-02-20 17:19:45 +00:00
ZodiusInfuser
dac81ea545
Added new line 2021-02-20 17:19:31 +00:00
ZodiusInfuser
0a00f91979
Added new line 2021-02-20 17:15:42 +00:00
ZodiusInfuser
f1df07002f
Added new line 2021-02-20 17:15:20 +00:00
ZodiusInfuser
27bc5492f5
Added other files for PicoSystem 2021-02-20 13:37:08 +00:00
ZodiusInfuser
e9c7af1dee
Added board.c for PicoSystem 2021-02-20 13:36:46 +00:00
ZodiusInfuser
fb7cce6503
Added other files for Keybow2040 2021-02-20 13:35:27 +00:00
ZodiusInfuser
7ac20bfb8b
Added board.c for Keybow2040 2021-02-20 13:35:06 +00:00
ZodiusInfuser
66dd74cd12
Added other files for Tiny2040 2021-02-20 13:33:54 +00:00
ZodiusInfuser
ad8916499d
Added board.c for Tiny2040 2021-02-20 13:32:54 +00:00
Dan Halbert
67406488d1 merge from upstream; re-alphabetize 2021-02-19 14:22:50 -05:00
ZodiusInfuser
ee5a48fece
Delete pimoroni_tiny2040 2021-02-19 18:30:29 +00:00
ZodiusInfuser
db102ab1ad
Create pimoroni_tiny2040 2021-02-19 18:29:57 +00:00
microDev
b12ccefbe6
uart implementation for rp2040 2021-02-19 18:36:00 +05:30
Jeff Epler
1cd4e4552e
Merge pull request #4219 from jepler/bit_transpose
Add Bit transpose function to support piopixl8
2021-02-18 20:29:05 -06:00
Jeff Epler
7fd4567893 bitops: rename from _bit_transpose, describe the algorithm 2021-02-18 15:41:23 -06:00
Dan Halbert
53a002a096 Initial fix, but bitbangio timing may be off 2021-02-18 13:14:51 -05:00
Jeff Epler
9cf7d73c6c core: add bit_transpose function
.. this version can only handle exactly 8 bits "across".  The restriction
may be relaxed in a future revision.
2021-02-18 11:32:47 -06:00
microDev
696d212dc7
fix nvm rewrite 2021-02-18 18:42:00 +05:30
Jeff Epler
ab5eb86118 raspberrypi: implement os.urandom
Since the datasheet cast some doubt on the strength of the "rosc_hw->randombit",
I use the SHA256 hash function to create a high quality random seed
from random values of uncertain entropy, as well as to generate a sequence
of random values from that seed using SHA256 as a cryptographically-secure
random number generator.

In practice, it produces over 100kB/s of random data which does not
have any gross problems according to _PractRand_.
2021-02-17 17:49:25 -06:00
Dan Halbert
0b8f1b9a90 wip: usb_cdc.serials 2021-02-15 20:06:18 -05:00
Dan Halbert
93d788543c Merge remote-tracking branch 'adafruit/main' into secondary-cdc 2021-02-15 20:03:53 -05:00
Dan Halbert
0ec99b37e0 handle 100% duty cycle; improve actual_frequency calc 2021-02-13 13:16:49 -05:00
Dan Halbert
d54b5861a3 wip 2021-02-12 19:01:14 -05:00
Dan Halbert
3e4328140c fix off-by-one PWM top issue 2021-02-12 15:53:31 -05:00
Jeff Epler
ff1942cff6 Enable protomatter on RP2040 builds
Also found a race condition between timer_disable and redraw, which
would happen if I debugger-paused inside common_hal_rgbmatrix_timer_disable
or put a delay or print inside it.  That's what pausing inside reconstruct
fixes.

So that the "right timer" can be chosen, `timer_allocate` now gets the `self`
pointer.  It's guaranteed at this point that the pin information is accurate,
so you can e.g., find a PWM unit related to the pins themselves.
This required touching each port to add the parameter even though it's
unused everywhere but raspberrypi.
2021-02-12 08:25:15 -06:00
microDev
f2d7a5f1e1
Merge branch 'main' into nvm-rp 2021-02-12 18:36:54 +05:30
microDev
527b11f99e
implement suggested changes
- update FLASH_FIRMWARE length
- use linker script define value
2021-02-12 18:28:48 +05:30
Dan Halbert
08f30fedf5
Merge pull request #4188 from ladyada/main
QT Py with RP2040
2021-02-11 22:19:56 -05:00
lady ada
6c914b8722 QT Py with RP2040 2021-02-11 19:21:42 -05:00
Dan Halbert
f0564b4986 merge from upstream; complicated webusb merge 2021-02-11 18:50:02 -05:00
microDev
205837c47b
nvm implementation for rp2040 2021-02-11 12:48:36 +05:30
Scott Shawcroft
191b143e7b
Add PWM based audio playback
See
https://learn.adafruit.com/circuitpython-essentials/circuitpython-audio-out
to get started.

Fixes #4037
2021-02-09 15:38:33 -08:00
Scott Shawcroft
b19c700d4a
Merge pull request #4165 from DavePutz/issue_4143
Issue 4143 - Fixed marking a PWM slice incorrectly as variable frequency
2021-02-09 14:30:39 -08:00
root
9a28f0bf45 Fix check for variable PWM frequency 2021-02-09 15:22:59 -06:00
Dan Halbert
3c99b09993
Merge pull request #4160 from gamblor21/rp2040_neopixel_pin_fix
RP2040 Set the neopixel pin as output after PIO use
2021-02-08 17:57:30 -05:00
Dan Halbert
b0ed258302
Merge pull request #4155 from jepler/rpi-pio-background
rp2pio: Transfer up to 32 bytes before checking background tasks
2021-02-08 16:34:16 -05:00
gamblor21
386b49c3e1 Set the pin as output after PIO use 2021-02-08 15:13:37 -06:00
Jeff Epler
5423e4966c rp2pio: Transfer up to 32 bytes before checking background tasks
@Jerryneedell noticed that this problem affected strips short enough
to not use the DMA peripheral, thanks for the hot tip!

Instead of checking for background tasks after every byte transfer,
try up to 32 transfers before attending to background tasks.

This fixes the problem I was seeing on my 5-pixel circuit.

Closes #4135.
2021-02-08 08:35:07 -06:00
Jason Nichols
ae262cde55 Fix maximum PIO instructions 2021-02-06 10:54:25 -05:00
Scott Shawcroft
22dc7d5359
Update to the very latest SDK w/GP15 restore
Also adds unique id support

Fixes #4039 and hopefully #4107
2021-02-05 18:44:06 -08:00
Scott Shawcroft
c6a7b00030
Merge pull request #4137 from ferret-guy/smps-mode-pin-rpi-pico
Add SMPS mode pin to Raspi Pico pins.c
2021-02-05 12:12:55 -08:00
Scott Shawcroft
e7438c481e
Merge pull request #4125 from xorbit/main
Add A3 pin to Raspberry Pi Pico
2021-02-05 12:08:35 -08:00
Mark Omo
1292c35d59
Add SMPS mode pin to Raspi Pico pins.c
Add SMPS mode pin to Raspi Pico pins.c; see section "4.3. Using the ADC" of the Pico datasheet for discussion. 

Driving this pin high forces the onboard regulator into a lower noise PWM mode.
2021-02-05 11:09:40 -07:00
Patrick Van Oosterwijck
a158dde628 Add alternate name VOLTAGE_MONITOR for A3 2021-02-05 10:55:03 -07:00
Dan Halbert
0802b22ed6 usb descriptors all set; rework of enabling for USB devices 2021-02-04 19:23:40 -05:00
Jeff Epler
6e153d9948 raspberrypi: implement reset, reset_to_bootloader
This makes all the following work:
 * normal microcontroller.reset()
 * reset into safe mode or UF2 bootloader via microcontroller.on_next_reset()
 * reset into UF2 bootloader via the "1200 baud trick"

The implementation of reset_cpu is from micropython.
2021-02-04 12:07:50 -06:00
Patrick Van Oosterwijck
d357a05870 Add A3 pin to Raspberry Pi Pico
We want to be able to use this to measure VSYS.
2021-02-04 10:44:37 -07:00
BiffoBear
2656c84b01 Initial commit. Edited error messages in .c files 2021-02-03 05:49:40 +07:00
Scott Shawcroft
8789a2c8a9
Merge pull request #4110 from microDev1/rtc-rp
RP2040: Support for RTC
2021-02-01 19:47:44 -08:00
microDev
ec03267035
rtc implementation for rp2040 2021-02-02 00:00:00 +05:30
Dan Halbert
459f323247
Merge pull request #4087 from DavePutz/cpu_temp_doc
Fixing microcontroller.cpu on multi-core cpus and adding microcontroller.cpus
2021-02-01 12:50:37 -05:00
Scott Shawcroft
17cf03c8e4
Merge pull request #4083 from microDev1/watchdog-rp
RP2040: Support for WatchDog
2021-01-31 19:45:38 -08:00
microDev
34fe152fcf
extend include path 2021-01-30 14:00:14 +05:30
James Bowman
acbf66dacc Make sys.platform "RP2040" on raspberrypi
[#4091]
2021-01-29 12:33:37 -08:00
James Bowman
067f42b4f8 Add Gameduino 3X Dazzler support on raspberry_pi_pico
Tested with hardware. Looks good.

Follow on from #4054
2021-01-29 12:25:59 -08:00
root
67f128c0cf Fixing microcontroller.cpu on muti-core cpus and adding microcontroller.cpus 2021-01-28 14:42:39 -06:00
microDev
a54b57ea40
watchdog implementation for rp2040 2021-01-28 15:15:15 +05:30
Dan Halbert
29e672fe86
Merge pull request #4071 from tannewt/rp2040_uart_error
Raise an error on UART use
2021-01-26 15:22:02 -05:00
Dan Halbert
a9227e15d0
Merge pull request #4063 from dhalbert/rp2040-gp15 2021-01-26 13:38:41 -05:00
Scott Shawcroft
b42e94ee2c
Raise an error on UART use 2021-01-26 08:48:30 -08:00
Dan Halbert
be4cfdd3d6 Use TOTAL_GPIO_COUNT instead of magic number 30 2021-01-25 22:16:24 -05:00
Dan Halbert
0fa5aa359d Stop treating pin 15 specially. 2021-01-25 16:07:01 -05:00
Dan Halbert
69c71bd522 fix some build errors 2021-01-25 11:54:10 -05:00
Dan Halbert
1e97d384ff add GP15 2021-01-25 11:02:32 -05:00
Dan Halbert
69869e1439 CIRCUITPY_* switches for JSON, RE, etc. Doc cleanup 2021-01-24 23:10:20 -05:00
Scott Shawcroft
de6b05a17b
Fix DigitalInOut.pull on RP2040
It used to always return None.

Fixes #4035
2021-01-22 19:00:37 -08:00
Dan Halbert
e8e8c593ac move longint choice to mpconfigport.mk 2021-01-21 22:50:15 -05:00
root
f39ca0a1d6 Adding longing support on RP2040 2021-01-21 16:42:16 -06:00
root
3aab17c98e Adding longint support on RP2040 2021-01-21 16:40:57 -06:00
Scott Shawcroft
b73b30ff9f
Switch to upstream TinyUSB 2021-01-21 11:33:13 -08:00
Scott Shawcroft
b47fd08b20
copy editing 2021-01-21 10:17:40 -08:00
Scott Shawcroft
b0f7fd933f
type fix 2021-01-20 23:33:00 -08:00
Scott Shawcroft
6a6f22b0e6
pre-commit 2021-01-20 23:30:15 -08:00
Scott Shawcroft
48721584f9
Temporarily turn off string op overflow check 2021-01-20 19:16:56 -08:00
Scott Shawcroft
733094aead
Add initial RP2040 support
The RP2040 is new microcontroller from Raspberry Pi that features
two Cortex M0s and eight PIO state machines that are good for
crunching lots of data. It has 264k RAM and a built in UF2
bootloader too.

Datasheet: https://pico.raspberrypi.org/files/rp2040_datasheet.pdf
2021-01-20 19:16:56 -08:00