Commit Graph

652 Commits

Author SHA1 Message Date
Scott Shawcroft 351a0e747d
Merge pull request #4047 from kmatch98/esp32s2_ParallelBus
Add initial ParallelBus support for ESP32-S2
2021-01-26 13:07:58 -08:00
Lucian Copeland 815ab5277b Fix stubs error, out of sockets error, invalid TLS leak 2021-01-26 14:13:12 -05:00
Kevin Banks fbfb7b68cc Most of the code we need has been pulled in from the tinyusb webusb_serial demo. Still LOTS to do regarding descriptors. 2021-01-25 20:37:58 -06:00
Kevin Matocha 61850acd14 Fixed bug in pin error handling, deleted debug prints 2021-01-25 16:51:12 -06:00
Kevin Matocha 4140012430 Allow pins >= 32, allow write pin on different register than data pins 2021-01-25 16:25:56 -06:00
Lucian Copeland 9f34ec78c4 Separate Socket and SSLSocket, add LWIP connect 2021-01-25 17:07:25 -05:00
Dan Halbert 69869e1439 CIRCUITPY_* switches for JSON, RE, etc. Doc cleanup 2021-01-24 23:10:20 -05:00
Kevin Matocha 10965e5989 Delete unnecessary comments 2021-01-23 11:30:17 -06:00
Kevin Matocha 34aa01c5f9 Remove redundant clear_write, add make translate 2021-01-22 22:29:51 -06:00
Kevin Matocha 811a34fc3d Add initial ParallelBus support for ESP32-S2 2021-01-22 14:42:09 -06:00
Dan Halbert f72c1474c5
Merge branch 'main' into connect 2021-01-22 03:56:57 -05:00
hierophect f88a896c03
Merge pull request #3854 from hierophect/esp-tcpserver
ESP32S2: Implement TCP Server bindings
2021-01-21 17:25:14 -05:00
anecdata 1f6cd496c7 1. check enabled before scan; 2. make start-station() the single control point for esp_wifi_set_mode() 2021-01-21 13:54:19 -06:00
Scott Shawcroft eff68b0d9f
Merge pull request #4011 from dheera/main
prevents going into safe mode for watchdog resets
2021-01-20 11:30:12 -08:00
anecdata a01ff658ea fix case of connecting when wifi is stopped 2021-01-18 19:57:01 -06:00
Dan Halbert ee48e4b452 ESP32-S2: Initialize touch in proper order 2021-01-18 11:52:03 -05:00
anecdata c524900a1b check connected before connecting 2021-01-17 20:21:31 -06:00
jerryneedell a9389343a8
Revert "UMFEATHERS2 - implement use of DotStar for status led" 2021-01-17 05:15:19 -05:00
dheera d43eb7e84b prevents going into safe mode for watchdog resets 2021-01-16 17:38:08 -08:00
Scott Shawcroft 816cbe4704
Merge pull request #3992 from anecdata/reason4
wifi: more disconnect reasons for retries & include error code in exception
2021-01-15 11:52:34 -08:00
Lucian Copeland 4bc664fe5f Merge remote-tracking branch 'upstream/main' into esp-tcpserver 2021-01-15 12:02:16 -05:00
Dan Halbert aedc8efeda Add pin A1 as alias for AD1; A1 is preferred 2021-01-14 14:43:47 -05:00
Lucian Copeland 287770f885 Merge remote-tracking branch 'upstream/main' into esp-tcpserver 2021-01-14 10:21:08 -05:00
anecdata f75bb5c50f Rename to match WIFI_REASON. Also return specific reason code. 2021-01-13 23:46:35 -06:00
anecdata e519dd3c52 Retry on all disconnect reasons other than: 2 exception reasons & 1 manual disconnect reason. 2021-01-13 23:45:59 -06:00
Lucian Copeland 37a8c1c575 Complete non-blocking implementations, add socket close checking 2021-01-13 19:05:07 -05:00
Jeff Epler ed0cb248e9 esp32s2: Fix 'make flash'
As reported by @jerryneedell, this change was incorrect; the given
ESPTOOL_FLAGS caused `write_flash` to be repeated twice, which doesn't
work.

Closes #3981.
2021-01-12 16:04:29 -06:00
Lucian Copeland 4cdb298a20 WIP of non-blocking calls 2021-01-12 15:05:28 -05:00
Dan Halbert f9c762256f
Merge pull request #3733 from jepler/audioout-esp32
esp32s2: Add I2SAudioOut
2021-01-12 13:25:40 -05:00
Scott Shawcroft bfdaa6eb9c
Merge pull request #3959 from ladyada/main
try adding new feather def
2021-01-12 08:26:29 -08:00
Jeff Epler 1ca29ec47c Merge remote-tracking branch 'origin/main' into audioout-esp32 2021-01-12 09:23:07 -06:00
microDev cd16f29efd
Merge branch 'main' into TouchAlarm 2021-01-12 18:28:38 +05:30
Scott Shawcroft 081249f796
Merge pull request #3944 from BennyE/wifi-authmode
esp32-s2: Adding authmode keyword
2021-01-11 16:05:28 -08:00
Scott Shawcroft 3cf4d9c57f
Merge pull request #3954 from anecdata/mpconfigport
ESP32-S2: added sys.platform
2021-01-11 16:03:17 -08:00
Scott Shawcroft 3a7755b311
Merge pull request #3930 from jerryneedell/jerryn_feathers2_led
UMFEATHERS2 - implement use of DotStar for status led
2021-01-11 15:29:09 -08:00
microDev 5f448139e0
fixes and enhancement for touch alarm
- prevent touch alarm initialization if not set
- fix wake_alarm is set to touch alarm on autoreload
- add ability to have multiple touch alarms in light sleep
2021-01-11 15:30:45 +05:30
lady ada c87e1a6527 ok lets try without auto-display 2021-01-10 11:58:39 -05:00
BennyE 53e4d78a3c
Update ports/esp32s2/common-hal/wifi/Network.c
Avoid to use yet another variable.

Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2021-01-10 17:18:43 +01:00
lady ada d036620c70 compilier 2021-01-09 23:19:04 -05:00
lady ada 5b9ce9e7cf fix dup usb 2021-01-09 22:42:43 -05:00
lady ada b5b0d45b73 add tft 2021-01-09 22:36:54 -05:00
lady ada 68a5e6dcba copypaste typo 2021-01-09 15:52:58 -05:00
Jeff Epler e20c65d8f0 background tasks: Add, use port_wake_main_task
Some ports need an extra operation to ensure that the main task is
awoken so that a queued background task will execute during an ongoing
light sleep.

This removes the need to enable supervisor ticks while I2SOut is operating.

Closes: #3952
2021-01-09 14:02:47 -06:00
Jeff Epler 4735cf4747 esp32s2: audiobusio: move i2s_common inside
Originally, I believed the implementation might be shared with AudioOut,
as on the ESP32 (non-S2) the I2S peripheral was also used to drive the DAC.
However, this is not the case on ESP32-S2 and appears it will not be
the case with the ESP32-S3 or -C3, to the extent that there's skeletal
support for either of them in esp-idf master branch.

However, it could still be shared by I2SIn or PDMIn (the latter being
hypothetically implemented as I2SIn + digital postprocessing like we did
in the atmel-sam port, to my understanding), so I moved it to
the common-hal folder.
2021-01-09 14:02:47 -06:00
Jeff Epler 10861b4038 esp32s2: Rename ESP_CALL_RAISE to CHECK_ESP_RESULT
Suggested by @tannewt, thanks!
2021-01-09 13:41:44 -06:00
lady ada a600fd3478 forgot deinit 2021-01-09 14:01:58 -05:00
lady ada 301facf102 newline 2021-01-09 13:36:21 -05:00
lady ada 7de1da45da woops out of sync header, plus... i dunno add some frozen modules cause we have almost no RAM :( 2021-01-09 13:23:17 -05:00
lady ada 813fa671f3 nowhitespace 2021-01-09 12:29:08 -05:00
Limor "Ladyada" Fried 9253351fa4
Merge branch 'main' into main 2021-01-09 12:25:16 -05:00
lady ada 999ee68e12 try adding new feather def 2021-01-09 12:22:53 -05:00
Caio Henrique de Queiroz Katayama 7b4558b750 Fix socket.recvfrom_into() 2021-01-08 19:17:17 -05:00
anecdata 06ab848a0d added platform 2021-01-08 16:48:25 -06:00
jerryneedell de5b138dcf remove commented line 2021-01-08 14:46:37 -05:00
jerryneedell 7556f38f04 initialize LDO2 in board_init() 2021-01-08 14:40:06 -05:00
Jeff Epler 5f0e41ad60 I2SOut: Enable ticks during audio playback
.. otherwise, the background callback to load the I2S fifos does not get
run.  (I'm not sure this is _correct_ behavior of sleep + background
tasks, but it is the current behavior)
2021-01-08 09:01:34 -06:00
Jeff Epler 430bcdb59d port_i2s_play: fill the initial buffer via background callback
There were _possibly_ problems where this routine was being entered
by direct call AND by background callback.  Schedule the work here,
and it will be done almost immediately, without worry about interference.
I don't know if this is strictly necessary, but it doesn't hurt.  Since
the I2S clock is being run all the time, we have to enter the background
task to fill the FIFO with zeros constantly anyway.
2021-01-08 08:49:25 -06:00
Jeff Epler 12264cca34 port_i2s_play: remove build error 2021-01-08 08:47:13 -06:00
Jeff Epler 0b7a4c4b2b i2s_fill_buffer: remove debug print 2021-01-08 08:46:56 -06:00
Jeff Epler 873a300d02 i2s_fill_buffer: Need to fill with zeros when stopping 2021-01-08 08:46:41 -06:00
Jeff Epler cfd8288dfa esp2s2: enlarge stack-buffer, use it instead of i2s_zero_dma_buffer
.. it's not clear that there was a problem with i2s_zero_dma_buffer, but
just in case.
2021-01-07 16:29:52 -06:00
Jeff Epler d3afda61d8 esp32s2: i2s: must reset buffer, otherwise wave samples don't start
.. and other housekeeping when starting to play a sample
2021-01-07 16:29:08 -06:00
Jeff Epler 352226402c esp32s2: i2s: fix accounting for "stretched" frames 2021-01-07 16:28:33 -06:00
Jeff Epler 010a4e7b0f esp32s2: port: Ensure JTAG pins are available for debugging 2021-01-07 16:23:21 -06:00
BennyE 115f3e0867 Updated code as per helpful suggestion 2021-01-07 23:05:16 +01:00
Jeff Epler 7bb196b9d2 esp32s2: 'make flash': Allow customizing the esptool flags
This can be useful so that e.g., on a Kaluga when programming via
the FTDI chip, you can override the variable to specify "--after=hard_reset"
to automatically return to running CircuitPython, choose a different
baud rate (921600 is about 2s faster than 460800), etc:
    make BOARD=espressif_kaluga_1 ESPTOOL_FLAGS="-b 921600 --before=default_reset --after=hard_reset"
2021-01-07 15:01:33 -06:00
Jeff Epler 30c6dd3f76 Merge remote-tracking branch 'origin/main' into audioout-esp32 2021-01-07 14:11:14 -06:00
jerryneedell 6976ec6ef9 Merge remote-tracking branch 'upstream/main' into jerryn_feathers2_led 2021-01-07 15:02:40 -05:00
Scott Shawcroft 55c80754c7
Merge pull request #3945 from 2bndy5/fix-table-in-a-readme
convert esp32s2 port readme to rst
2021-01-07 10:43:34 -08:00
Scott Shawcroft 0b0b476be6
Merge pull request #3940 from caternuson/magtag_accelo_irq_pin
Add MagTag accelo IRQ pin
2021-01-07 10:31:33 -08:00
brendan 18122e0455 missed a couple inline code snippets 2021-01-06 15:28:19 -08:00
brendan 092331eee1 convert esp32s2 readme to rst 2021-01-06 15:19:40 -08:00
BennyE 66d87782be Adding authmode keyword 2021-01-06 23:52:30 +01:00
caternuson 9db0a4f265 add magtag accelo irq pin 2021-01-06 09:17:19 -08:00
Scott Shawcroft a33359762d
Merge pull request #3903 from anecdata/reasons
ESP32-S2: Log all Wi-Fi events & remove unneeded call
2021-01-06 08:41:19 -08:00
anecdata 98c9492a8c change ESP_EARLY_LOG* to ESP_LOG* throughout event_handler 2021-01-05 18:39:51 -06:00
jerryneedell ec02102409 implment use of DotStar for staus led 2021-01-04 07:41:25 -05:00
Seon Rozenblum 10f178d162 Fixed incorrect pin assignment on header
IO13 is for blue LED
IO14 is the correct pin header between IO18 and IO12
The silk is wrong (shows IO13), but hardware is correct as IO14, but IO14 was not included in pins.c
Silk will be updated on next PCB production run
2021-01-04 10:06:32 +11:00
askpatricw 2ce07209df changes based on UM's input 2021-01-01 17:23:11 -08:00
askpatricw 220501e159 dupe LED entries 2020-12-31 18:02:44 -08:00
askpatricw 43f93b097f release and pre-release FeatherS2 NSync 2020-12-31 17:50:41 -08:00
Jeff Epler 5698b8bb0a
Merge pull request #3850 from microDev1/touch-s2
Support for Touch Alarm
2020-12-30 16:25:11 -06:00
microDev 0bad6110d4
update wake-alarm implementation 2020-12-31 02:44:20 +05:30
microDev b83bdc540d
enable light-sleep functionality 2020-12-31 02:22:20 +05:30
microDev 28ce5e8988
Merge branch 'main' into touch-s2 2020-12-30 22:44:22 +05:30
microDev c7f68022ef
add pretend-to-sleep functionality 2020-12-30 22:11:22 +05:30
anecdata d537d94a4c see what we're missing 2020-12-30 09:45:15 -06:00
anecdata 0914b71653 remove unneeded set_config (wrong param; called in connect anyway) 2020-12-30 09:26:25 -06:00
Hugo Dahl 72cad49c69
Fix minor typo in ESP32S2 readme 2020-12-29 22:52:59 -06:00
Jeff Epler a7542598a0 esp32s2: add I2SOut 2020-12-29 14:46:38 -06:00
Jeff Epler b40a579d18 esp32s2: espidf: Consistent error checking of esp-idf calls
By surrounding most ESP-IDF API calls with this new macro, their failure will
result in a CircuitPython exception.
2020-12-29 14:06:32 -06:00
Jeff Epler 05ba1431c3 esp32s2: espidf: Add IDFError
this is an exception class for "generic" IDF errors that don't have
their own exception type.
2020-12-29 14:06:32 -06:00
Jeff Epler d024df6b06 esp32s2: Use better optimizer flags in debug builds
(note that the before and after files both lack trailing newlines; this is
how the esp-idf do)

OPTIMIZATION_DEFAULT is -Og, which enables optimizations that do not
interfere with the debugger:
```
    elseif(CONFIG_COMPILER_OPTIMIZATION_DEFAULT)
        list(APPEND compile_options "-Og")
```
2020-12-29 14:06:32 -06:00
Jeff Epler 7401aa8e85
Merge pull request #3888 from microDev1/fix-reset-pin
FIX : common_hal_reset_pin()
2020-12-29 10:08:47 -06:00
Scott Shawcroft c3396e4b49
Merge pull request #3868 from BennyE/wifi-enhancement-countrycode
esp32-s2: wifi enhancement to include countrycode
2020-12-28 11:49:41 -08:00
microDev dc332baa87
update common_hal_reset_pin() 2020-12-28 20:04:00 +05:30
Scott Shawcroft 6c7e6abcfd
Downgrade OTA API for IDF 4.2 2020-12-27 20:30:49 -08:00
BennyE 64bb055700 Updating comment to reflect feedback of espressif from IDFGH-4486 -> works correct as per the protocol 2020-12-24 15:40:53 +01:00
Dan Halbert 8061a2574d
Merge branch 'main' into pin_alarm 2020-12-23 22:05:02 -05:00
BennyE 1a6b1b1953 implementing suggested changes 2020-12-24 00:37:37 +01:00
BennyE e9c9fce15d Remove debug log messages 2020-12-23 14:59:09 +01:00
Scott Shawcroft 1fca297a2d
A couple sleep fixes
* Better messaging when code is stopped by an auto-reload.
* Auto-reload works during sleeps on ESP32-S2. Ticks wake up the
  main task each time.
* Made internal naming consistent. CamelCase Python names are NOT
  separated by an underscore.
2020-12-22 16:13:02 -08:00
Jeff Epler da8f023665 esp32s2: make flash: use the stub
Very long ago, this was apparently not supported in esptool yet, at
least when operating over USB CDC.  This now works just fine, and
our esp webtool relies on it as well.  It makes flashing faster,
too.
2020-12-22 10:27:42 -06:00
Dan Halbert d4e9eea397
mark alarm.wake_alarm during gc sweep 2020-12-22 08:11:01 -08:00
Dan Halbert d6df43b943
Merge pull request #3863 from dhalbert/adafruit-prefix
Add Adafruit to MICROPY_HW_BOARD_NAME for various boards
2020-12-22 08:02:35 -05:00
Dan Halbert 39ca406a31 Add Adafruit to MICROPY_HW_BOARD_NAME for various boards 2020-12-21 23:32:11 -05:00
BennyE ae3b440835 more fixes and still with debug 2020-12-22 00:32:48 +01:00
Lucian Copeland 75620884e6 Fix stubs, recv_into error 2020-12-21 13:26:43 -05:00
Lucian Copeland 32736dd2c3 Implement server API 2020-12-20 17:12:03 -05:00
BennyE 2e393ed195 adding debug infos 2020-12-20 22:03:38 +01:00
microDev ecd7c0878e
expose wake pin parameter and more tweaks 2020-12-19 20:54:36 +05:30
microDev a60fabdffa
add touch alarm support for esp32s2 2020-12-19 12:56:34 +05:30
microDev 8eaf2b0c19
implement touch alarm 2020-12-18 12:54:36 +05:30
microDev 4512290ba0
Merge branch 'main' into ota-s2 2020-12-18 00:44:00 +05:30
microDev 4863413bc9
rename ota to dualbank 2020-12-18 00:34:56 +05:30
Scott Shawcroft 0dcc659d53
Swap to IDF release/4.2 branch for stability 2020-12-15 18:12:59 -08:00
Scott Shawcroft 1ad49d9a18
Add alarm.pin that wakes on pin level
Fixes #3787
2020-12-15 18:12:59 -08:00
hierophect 3ad4b12ce1
Merge branch 'main' into esp-analog-hang 2020-12-15 15:08:30 -05:00
Scott Shawcroft d076296659
Merge pull request #3816 from dhalbert/sleepmemory
alarm.sleep_memory + alarm.wake_alarm
2020-12-14 17:40:02 -08:00
Scott Shawcroft d6ee17c6fd
Merge pull request #3817 from BennyE/reserve-pins-only-for-debug
esp32s2: Reserve UART pins only if DEBUG=1 is set to address issue 3811
2020-12-14 17:32:17 -08:00
Scott Shawcroft a1f773d9ed
Merge pull request #3819 from BennyE/issue3663
Fix for issue 3663 by returning early if no scan was started before s…
2020-12-14 17:11:18 -08:00
Scott Shawcroft dc473b29e3
Merge pull request #3643 from hierophect/esp32-pin-reset
ESP32-S2: Add IDF pin resets to Microcontroller
2020-12-14 17:09:29 -08:00
Lucian Copeland d793ec2872 Change pinfunc to default of 0 at reset 2020-12-14 14:25:38 -05:00
Lucian Copeland cac755ba16 Merge remote-tracking branch 'upstream/main' into esp-analog-hang 2020-12-14 13:00:57 -05:00
Lucian Copeland f15e2d86c0 Reduce samples from 64 to 2 2020-12-14 12:59:20 -05:00
Dan Halbert e0afa32cfa use RTC_DATA_ATTR; address review comments 2020-12-14 11:36:54 -05:00
BennyE 210c0ec89c add country(code) to wifi network objects) 2020-12-13 13:32:12 +01:00
microDev 37ee5e683d
Merge branch 'main' into ota-s2 2020-12-12 05:25:46 +05:30
BennyE c5c13620f2 Fix for issue 3663 by returning early if no scan was started before stop is issued 2020-12-12 00:49:53 +01:00
BennyE 81c4871fdf Set DEBUG CFLAG if set in make 2020-12-11 22:11:39 +01:00
BennyE e3194ad54e Reserve UART pins only if DEBUG=1 is set to address issue 3811 2020-12-11 20:35:28 +01:00
Dan Halbert cf938983e9 SleepMemory + set alarm.wake_alarm 2020-12-11 08:10:26 -05:00
microDev cb35abfd04
add docs, update translation & fix ota.flash() 2020-12-11 01:01:01 +05:30
Dan Halbert 55f4110983 fix typo 2020-12-10 14:16:25 -05:00
Dan Halbert 5964163649 Initial SleepMemory code 2020-12-10 13:03:40 -05:00
microDev 6a4f74946f
reset ota module on every vm run 2020-12-10 16:48:58 +05:30
microDev 07015ad527
add ability to switch boot partition 2020-12-10 16:42:45 +05:30
microDev bfa2c604ef
add ability to flash in discontinuous chunks 2020-12-10 15:45:25 +05:30
microDev ed5add37f6
add ability to flash in continuous chunks 2020-12-10 14:36:49 +05:30
microDev dee86a014b
factor out esp_ota_end 2020-12-10 14:04:24 +05:30
microDev 20c3184c87
re-organize and clean-up 2020-12-10 12:34:56 +05:30
Scott Shawcroft e14b148e62
Merge pull request #3803 from skieast/fix_i2c_hang_with_wifi
Working, tested with two i2c busses
2020-12-09 10:03:31 -08:00
Scott Shawcroft 133013083a
Merge pull request #3808 from tannewt/panic_safe_mode
Enter safe mode after panic or brownout
2020-12-08 16:31:22 -08:00
Scott Shawcroft 57101d7da6
Merge pull request #3807 from tannewt/sleep_tweaks
Add `board_deinit` for use with sleep
2020-12-08 16:30:41 -08:00
Lucian Copeland 9a5006e241 Remove problematic calloc 2020-12-08 17:43:39 -05:00
Scott Shawcroft 0b4bcd9599
Fix build and more comments 2020-12-08 13:05:21 -08:00
Scott Shawcroft d0a806d797
Enter safe mode after panic or brownout
Uses the IDF's reset reason. Does nothing before reset.

Fixes #3389
2020-12-08 11:03:24 -08:00
Scott Shawcroft 40118bcf57
Add `board_deinit` for use with sleep
This changes lots of files to unify `board.h` across ports. It adds
`board_deinit` when CIRCUITPY_ALARM is set. `main.c` uses it to
deinit the board before deep sleeping (even when pretending.)

Deep sleep is now a two step process for the port. First, the
port should prepare to deep sleep based on the given alarms. It
should set alarms for both deep and pretend sleep. In particular,
the pretend versions should be set immediately so that we don't
miss an alarm as we shutdown. These alarms should also wake from
`port_idle_until_interrupt` which is used when pretending to deep
sleep.

Second, when real deep sleeping, `alarm_enter_deep_sleep` is called.
The port should set any alarms it didn't during prepare based on
data it saved internally during prepare.

ESP32-S2 sleep is a bit reorganized to locate more logic with
TimeAlarm. This will help it scale to more alarm types.

Fixes #3786
2020-12-08 10:52:25 -08:00
microDev 2f95c94ad8
esp32s2 - update common_hal_mcu_reset 2020-12-08 18:00:58 +05:30
microDev 602243748b
add ota support for esp32s2 2020-12-08 11:45:00 +05:30