Commit Graph

504 Commits

Author SHA1 Message Date
Dan Halbert 955d2723d0 RP2040 SleepMemory 2023-05-21 19:05:25 -04:00
Dan Halbert f2bfced407
Merge pull request #7976 from anecdata/ap_ipv4_picow
Allow Access Point static IPv4 on the raspberrypi port
2023-05-16 18:45:22 -04:00
Bill Sideris 95c1d849d3
Just 500
Co-authored-by: Dan Halbert <halbert@halwitz.org>
2023-05-16 04:47:44 +03:00
Bill Sideris ed31c7dc8f
Await down on stop_station 2023-05-15 22:38:59 +03:00
anecdata 4ac7e7643a
netutils dhcp server 2023-05-14 17:44:27 -05:00
anecdata 6dd2e86727
remove dhcp calls 2023-05-14 14:52:49 -05:00
anecdata cd41fb101a
oops 2023-05-13 22:55:08 -05:00
anecdata 8196366c94 initial 2023-05-13 22:06:16 -05:00
anecdata 29bf64decb raspberrypi common-hal f(x)s Not Implemented 2023-05-08 22:41:33 -05:00
Scott Shawcroft 750615f2da
Merge pull request #7430 from Lanzaa/rp2040_cpu_frequency
Add frequency setting for RP2040 boards.
2023-05-02 09:52:28 -07:00
Scott Shawcroft 488dca565f
Merge pull request #7922 from tannewt/dvi320
Take in framebuffer resolution, not output res
2023-05-02 09:22:51 -07:00
Scott Shawcroft 0aa71ed6e6
Tweak the picodvi docs and arg checking 2023-05-01 11:30:04 -07:00
Scott Shawcroft b08714bb8f
Take in framebuffer resolution, not output res
Fixes #7911
2023-04-28 17:13:17 -07:00
Scott Shawcroft 8104b824e0
Standardize CPU temp and voltage. Add autogen warning 2023-04-28 16:19:43 -07:00
Scott Shawcroft 0f9fb33371
Merge branch 'main' into rp2040_cpu_frequency 2023-04-19 17:05:58 -07:00
Scott Shawcroft e2ab7a4751
Change voltage. Refine docs 2023-04-19 17:04:54 -07:00
Scott Shawcroft 66edcf5d03
Add PicoDVI support
PicoDVI in CP support 640x480 and 800x480 on Feather DVI, Pico and
Pico W. 1 and 2 bit grayscale are full resolution. 8 and 16 bit
color are half resolution.

Memory layout is modified to give the top most 4k of ram to the
second core. Its MPU is used to prevent flash access after startup.

The port saved word is moved to a watchdog scratch register so that
it doesn't get overwritten by other things in RAM.

Right align status bar and scroll area. This normally gives a few
pixels of padding on the left hand side and improves the odds it is
readable in a case. Fixes #7562

Fixes c stack checking. The length was correct but the top was being
set to the current stack pointer instead of the correct top.
Fixes #7643

This makes Bitmap subscr raise IndexError instead of ValueError
when the index arguments are wrong.
2023-04-19 15:14:02 -07:00
Ted Hess 9825b7fbb7 Web Workflow sockets and threads handling improvements.
Fixes polling thread looping forever hangs preventing new connections.
Don't lose listening sockets on mp resets and re-init.
Keep better separation of "system" and "user" sockets.
Track socket states to prevent re-use of sockets before closed.
Close REST socket when transaction completes. No post-init.
Remove unnecessary state flags.
2023-04-05 13:50:42 -04:00
Dan Halbert 5c429320a8 Add wifi.radio.connected, wifi.radio.ap_active 2023-03-31 17:57:53 -04:00
Gregory Neverov 173bc198c6 don't set tcp_err callback for listen sockets 2023-03-29 11:49:32 -07:00
hathach 8c1095b268
Merge branch 'main' into add-codespell 2023-03-23 14:09:57 +07:00
Jeff Epler e05f0ba3b2
Revert "Correctly raise OS error in socketpool_socket_recv_into()"
This reverts commit 7e6e824d56.

Fixes #7770

The change in #7623 needs to be revered; the raise-site added in #7632
is the correct one and the one in socketpool needs to be reverted.

This is not affecting 8.0.x because #7623 was not back-ported to there
before we realized it was not a full fix.

Both #7770 and #7606 should be re-tested. I didn't test.
2023-03-22 14:32:06 -05:00
hathach fecc1bdedb
fix typos (partial) detected by codepell 2023-03-18 22:17:02 +07:00
MicroDev 11cf031284
reset watchdog conditionally 2023-03-15 19:03:57 +05:30
MicroDev 8ff408161a
update watchdog implementation for raspberrypi 2023-03-15 16:38:50 +05:30
Dan Halbert 859a48723f
Merge pull request #7633 from tannewt/fix_imx_pwm
Fix `pwmio` on iMX RT.
2023-02-28 14:11:06 -05:00
Dan Halbert f9831b3bbc
Merge pull request #7639 from adafruit/8.0.x
Merge 8.0.x up to main
2023-02-24 19:32:09 -05:00
Scott Shawcroft 1acf65ee22
Fix `pwmio` on iMX RT.
It now handles deinit, never_reset and sharing tracking. PWM
now runs in the WAIT state as well during a time.sleep().

_reset_ok() was removed because it was called in one spot right
before deinit().

Some PWMOut were also switched to a bitmap for use instead of
reference count. That way init and deinit are idempotent.

Fixes #6589. Fixes #4841. Fixes #4541.
2023-02-22 11:22:39 -08:00
Jeff Epler de9233f84a
raspberrypi: SSLSocket: raise OSError when appropriate
Rather than returning the negative error value.

This is intended to close #7606, though I did not test with mqtt.
Instead, I created a simple standalone test program:
```python
import wifi, socketpool, ssl, time
#wifi.radio.connect(<omitted>)
import socketpool
socket = socketpool.SocketPool(wifi.radio)
ctx = ssl.create_default_context()

b = bytearray(8)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sss = ctx.wrap_socket(s, server_hostname='example.com')
sss.connect(('example.com', 443))
sss.setblocking(False)
r = sss.recv_into(b)
print(r, b)  # prints 4294967285 which is -11 as unsigned
sss.close()
```

Before the change, r was the out of range value 4294967285. After the
change, the recv_into call raises OSError instead.

This is comparable to the behavior on standard Python, though an
SSLWantReadError is raised instead.

The original (mis)behavior seems to match what was uncovered deep inside
minimqtt by adding logging:
```
370.578: DEBUG - PKT: _sock_exact_recv: recv_len = 4294967285
```
2023-02-22 10:07:48 -06:00
root 7e6e824d56 Correctly raise OS error in socketpool_socket_recv_into() 2023-02-21 13:38:29 -06:00
MicroDev 508f2015b6
Merge pull request #7605 from Neradoc/pico-uart-in-use-error
Tweak the UART in use message on RP2040
2023-02-18 08:35:52 +05:30
Neradoc 13716c9c30 tweak the UART in use message on RP2040 2023-02-17 23:29:44 +01:00
Dan Halbert bbadc00599
Merge pull request #7577 from dhalbert/safemode-py
Implement safemode.py
2023-02-16 14:15:20 -05:00
MicroDev 32d86c3ea3
Merge pull request #7580 from adafruit/8.0.x
Merge 8.0.x up to main
2023-02-15 09:16:51 +05:30
Gregory Neverov 98b61279e4 Add function common_hal_busio_uart_never_reset for rp2 2023-02-14 09:05:24 -08:00
Dan Halbert d8231f1588 Implement safemode.py 2023-02-13 18:26:38 -05:00
Jeff Epler b9f689adf4 Use lowest drive level for PIO 2023-02-08 16:18:58 -06:00
Gregory Neverov 77c6daf4b8 don't throw exception 2023-02-01 16:33:22 -08:00
Dan Halbert 13338df9f1
Merge pull request #7462 from tannewt/fix_rp2_reset_reason
Tweak RP2040 reset reason
2023-01-19 21:10:57 -05:00
Scott Shawcroft 82a313065e
Tweak RP2040 reset reason
Watchdogs are used to reboot out of the bootloader. There is a
scratch register for user watchdogs. So use sdk functions to better
distinguish these.

Related to #7346
2023-01-17 16:12:08 -08:00
Scott Shawcroft 683e393878
Add comments for MDNS code 2023-01-17 14:07:30 -08:00
Colin B bfba1e4100 Change common_hal_mcu_processor_set_frequency to void
* Add warning about setting RP2040 frequency
2023-01-16 21:26:13 -08:00
Scott Shawcroft ee2fe993dd
Fix repeated MDNS use on Pico W 2023-01-12 14:56:06 -08:00
Scott Shawcroft 5c517b7e5a
Handle MDNS deinited better. 2023-01-12 11:24:20 -08:00
Scott Shawcroft 78c2fa5b28
Merge pull request #7437 from dhalbert/improve-type-checking-error-msgs
Improve type validation error messages, especially for pins
2023-01-11 10:54:22 -08:00
Jeff Epler e817563ca0
Update cyw43-driver, fix no-password wifi
Now, open wifi works on Pico W, so this closes #7438.

For the web workflow it's now OK to either
 * specify an empty password string (as before)
 * not have the CIRCUITPY_WIFI_PASSWORD key at all (new functionality)
2023-01-10 15:07:17 -06:00
Dan Halbert a974402542 Improve type validation errors messages, especially for pins 2023-01-10 15:02:55 -05:00
Colin B a84a8855ed Add frequency setting for RP2040 boards. 2023-01-07 17:41:37 -08:00
Dan Halbert a3adcf0e1a clarify read-only mac address; reuse translate msgs 2023-01-02 10:13:20 -05:00
Jeff Epler 928fb0a9c4
Make the "name or service not known" message translatable 2022-12-26 13:58:31 -06:00
Dan Halbert 66efed5ba5 fix AuthMode printing regression 2022-12-15 15:49:58 -05:00
Jeff Epler 297657ea9a
Refactor so that all sites of name lookup failure result in gaierror 2022-12-14 14:45:32 -06:00
Jeff Epler 243ecc2502
remove debugging prints 2022-12-08 14:18:22 -06:00
Jeff Epler 1fe05cb8cd
pico w: re-use previous connection if ssid matches 2022-12-08 12:44:34 -06:00
Scott Shawcroft d7874e65c2
Merge pull request #7299 from BooleanMattock/main
Fix to Issue #7224 - Servo update slow due to PWM channel duty cycle update busy-wait
2022-12-05 12:54:41 -08:00
BooleanMattock afb5301cef Fix to Issue #7224 - tested 2022-12-02 20:21:40 -05:00
Scott Shawcroft 4c064c263e
Merge pull request #7294 from tannewt/analogbufio_rework
Rework the analogbufio API.
2022-12-02 14:53:16 -08:00
Scott Shawcroft f7504ff857
Tweaks based on review comments 2022-12-02 10:19:31 -08:00
Scott Shawcroft 255e997345
Rework the analogbufio API.
* read() is now readinto() and takes the buffer to write into.
* readinto() returns the number of valid samples.
* readinto() can be interrupted by ctrl-c.
* readinto() API doesn't support signed numbers because it never did.
* sample_rate is now required in the constructor because supported
  values will vary per-port.
* 16 bit values are full range. 12 bit samples from RP2040 are stretched
  in the same way they are for AnalogIn.

Fixes #7226
2022-12-01 17:46:07 -08:00
Bill Sideris f8070d2141
Change comment, and logic on dhcpserver 2022-11-30 21:51:50 +02:00
Bill Sideris 44d5326d4c
fix picow-ap 2022-11-30 19:36:00 +02:00
Bill Sideris 362018dcca
Merge branch 'main' into picow-ap 2022-11-30 19:11:03 +02:00
Scott Shawcroft c13ca95da1
Add MDNS support to Pico W
This adds both cpy-MAC.local and circuitpython.local support.

Fixes #7214
2022-11-28 16:15:28 -08:00
Scott Shawcroft ad2d190507
Merge pull request #7247 from tannewt/picow_web_workflow
Enable* web workflow for Pico W
2022-11-28 14:19:42 -08:00
Dan Halbert 17be447c4b correct Radio.connect() and .start_ap() signatures; clean up some code 2022-11-22 17:11:03 -05:00
Scott Shawcroft c3a96a63c0
Enable* web workflow for Pico W
* Except for circuitpython.local which depends on MDNS and will be
done in a follow up PR.

Progress on #7214
2022-11-21 16:24:05 -08:00
Bill Sideris b40facd0b4
Error msg changes 2022-11-22 01:00:34 +02:00
Dan Halbert 1611cf98da have clock start high in SPI mode 3 2022-11-18 18:27:38 -05:00
Bill Sideris 88bd9ef6b8
just change the ap error 2022-11-18 22:51:05 +02:00
Bill Sideris b8cd6c093f
picow-ap progress 2022-11-17 21:47:39 +02:00
Bill Sideris a234b74e87
Merge branch 'adafruit:main' into picow-ap 2022-11-16 21:32:46 +02:00
Jeff Epler ef93eda0a0
Merge pull request #7192 from bill88t/picow-debug
Fix pi cow debug compilation
2022-11-15 14:08:44 -06:00
Bill Sideris 6954e569b7
since it ain't leaving.. 2022-11-15 00:05:01 +02:00
Bill Sideris 6ad61a3fd1
Radio.c work 2022-11-14 19:31:18 +02:00
Bill Sideris 2e6dd1bf1f
Radio.c no longer needs ping.h 2022-11-14 18:36:42 +02:00
Jeff Epler cdab078d9d
shared-bindings: Get rid of CYW43 special cases in shared-bindings
.. by moving it into a new weak function that can be replaced
just by the picow build.
2022-11-14 08:44:08 -06:00
Dan Halbert 8f414eb4ee
Merge pull request #7179 from jepler/picow-voltage-monitor
Add ability to read VOLTAGE_MONITOR on Pico W
2022-11-13 22:40:54 -05:00
Dan Halbert 983502d6e3 ignore pin changes before sleep 2022-11-11 15:31:49 -05:00
Bill Sideris e6a4e2982f
Update ports/raspberrypi/common-hal/wifi/Radio.c
u32_t -> uint32_t

Co-authored-by: MicroDev <70126934+MicroDev1@users.noreply.github.com>
2022-11-11 14:40:47 +02:00
Bill Sideris 0bf9df232a
fix debug 2022-11-11 14:17:57 +02:00
paul-1 851c2cd8cb
picow: Add channel setting when starting AP 2022-11-10 17:23:59 +02:00
Bill Sideris 25c0a0aca9
Merge branch 'adafruit:main' into picow-ap 2022-11-10 17:04:21 +02:00
Jeff Epler 7f36a365cf
delay 100us for analog voltage to stabilize
.. otherwise, depending on the prior state of the pin as a digital
input, the value read could be 20% low.
2022-11-08 10:43:14 -06:00
Jeff Epler 09f6919c93
Add ability to read VOLTAGE_MONITOR on Pico W
Because this must be treated like an in-use pin for all other purposes,
unfortunately a special case must be added in shared-bindings.

Multiple AnalogIn objects for VOLTAGE_MONITOR can be created (because
in use tracking isn't working) but this causes no harm.

Testing performed: Read the monitor, then imported wifi. When the
pin state was insufficiently restored, the second step would fail
with debug messages about do_ioctl timeout.

```
import analogio, board
a = analogio.AnalogIn(board.VOLTAGE_MONITOR)
print(a.value)
import wifi
```

Closes: #7020
2022-11-08 09:37:15 -06:00
Jeff Epler 452ebe27ae
socketpool: make socket objects selectable
.. which will lead to them being usable in async contexts, pending
relevant changes in asyncio
2022-11-05 12:05:19 -05:00
Dan Halbert ded134c346 store wake_alarm in a static object 2022-10-29 16:26:36 -04:00
Dan Halbert 0221cc8df7 Merge remote-tracking branch 'adafruit/main' into alarm-lifetime 2022-10-28 14:11:32 -04:00
Dan Halbert 4e20049c38
Merge pull request #7122 from jepler/picow-ssl-server
pico w: implement sslsocket bind, listen, accept
2022-10-28 09:33:21 -04:00
Dan Halbert 9307b62ad5 wip 2022-10-27 22:42:04 -04:00
Jeff Epler 0cf096dda1
pico w: implement sslsocket bind, listen, accept 2022-10-25 14:46:41 -05:00
Jeff Epler f997d0053d
Enable, use SOF_REUSEADDR
This is the lwip no-os version of SO_REUSEADDR, which is set on all
listening sockets in the espressif port; do so here as well,
it makes running servers easier. The "address in use" error does
not occur.
2022-10-25 10:09:16 -05:00
Bill Sideris 7a50beb67e
PicoW more ap work 2022-10-22 11:58:44 +03:00
Bill Sideris 8cc536bb7f
PicoW start_ap() 2022-10-21 13:20:16 +03:00
microDev b33a2b45dc
add coproc alarm 2022-10-20 18:38:20 +05:30
Dan Halbert 7015b7396e
Merge pull request #7089 from jepler/picow-gpio-number
pico w: Disentangle "TOTAL_GPIO_COUNT", it's complicated
2022-10-19 22:42:16 -04:00
Jeff Epler 576a1ac700
pico w: Disentangle "TOTAL_GPIO_COUNT", it's complicated
You might wonder how this fixes a problem with PulseIn, when the
changes aren't to any of those files! PulseIn is implemented in terms of
StateMachine, which had some assumptions about the relation between
the index of a pin object in mcu_pin_global_dict_table and its "pin
number". This was true, until some pins were removed from the
microcontroller module on Pico W.

Closes: #7078
2022-10-19 21:09:50 -05:00
Jeff Epler 8bef4282c0
pico w: implement static configuration methods in wifi.Radio 2022-10-19 20:54:53 -05:00
Dan Halbert 08e1cdb282
Merge pull request #7079 from jepler/picow-2xmss
Pico W grab bag
2022-10-19 15:03:00 -04:00
Jeff Epler 6e350a65cf
Merge pull request #7076 from bill88t/early-wifi
Implement async wifi connection on picow
2022-10-17 19:54:58 -05:00
Jeff Epler 3b7feccd9b
picow: Implement stop_station
Weirdly we have to stop the AP too (which we never started),
or cyw43_tcpip_link_status still reports that STA is connected.
As long as AP mode isn't implemented, this doesn't matter and
we can just do it.
2022-10-17 19:42:10 -05:00