Commit graph

889 commits

Author SHA1 Message Date
Earle F. Philhower, III
80d6e2f0ec
Throw away UART bytes with errors in reception (#1036)
Fixes #1021

The UART hardware will push characters into the receive FIFO even if there
are parity, framing, or other errors.  These are invalid and shouldn't be
returned to the application, so drop them if errors detected.

This will also avoid the glitch-induced initial garbage character.
2022-12-09 12:30:52 -08:00
Eli Lipsitz
d35e938c36
Fix File::readString to work with binary data (#1030)
Previously, File::readString used a C-style string as an intermediate
buffer via the String += operator. This treats a NUL byte as a
terminator, making this function work incorrectly if the File contains
binary data.

This commit switches the function to use String::concat, which doesn't
treat NUL bytes any differently (and is a bit faster, because it doesn't
need to use strlen).
2022-12-04 13:23:16 -08:00
Sebastian Krzyszkowiak
4e16a700c6
pluggable_discovery: Allow the scanner thread to quit (#1029)
When receiving a `QUIT` message, the main thread was trying to tell   
the scanner thread to quit - however, what it was actually doing was
creating a local variable that shadowed the global flag used by the
scanner thread. Fix that by ensuring that the main thread uses the
global variable instead.

Fixes #1028
2022-12-04 11:50:06 -08:00
Earle F. Philhower, III
d717b58001
Speed up ClientContext::write(Stream) by chunking (#1017)
Instead of sending a single packet per byte, send out larger chunks to
TCP/IP while doing a ::write(Stream).

Fixes #999
2022-11-29 15:00:47 -08:00
Earle F. Philhower, III
861da4c361
Add Waveshare JSONs for Platform.IO (#1015) 2022-11-28 12:26:23 -08:00
Earle F. Philhower, III
f9321b034f Update version 2022-11-28 10:07:41 -08:00
Earle F. Philhower, III
65dd19a158
Allow building w/o USB for normal and picoprobe builds (#1013)
Supersedes #972.  Thanks @kholk
2022-11-28 10:01:35 -08:00
Earle F. Philhower, III
be60060941
Fix newline issue w/Waveshare PR (#1012)
Go back to UNIX format endlines.  No functional changes.
2022-11-28 09:43:55 -08:00
Engineer_Will
39ac1d6bfb
Add some Waveshare board descriptions (#1004) 2022-11-28 09:35:23 -08:00
Earle F. Philhower, III
d94ca66e3e
Update Wire per @chrisckc debugging (#1011)
Merge in changes @chrisckc debugged while working at 400khz on his own project.
See https://github.com/earlephilhower/arduino-pico/issues/979#issuecomment-1328237128
2022-11-28 08:50:51 -08:00
brabl2
e47e3c73c2
Fix memcpy to unallocated memory in EEPROM.cpp (#1000)
The memcpy to unallocated memory was done in two cases:
1) The 'size' parameter was not multiple of 256.
2) The begin() was called two times and the 2nd call 'size' was greater than 1st time 'size'. (e.g. 1st size=256, 2nd size=512)
2022-11-24 10:25:48 -08:00
diesel437
f11c22d984
Using PIO_FRAMEWORK_ARDUINO_NO_USB build flag would cause internal rp2040 fifo not being initialized correct. (#1001) 2022-11-24 10:02:25 -08:00
Earle F. Philhower, III
bd4a2d232f
Update rp2040.rst 2022-11-23 08:19:36 -08:00
Earle F. Philhower, III
158cf3c7b3
Update rp2040.rst 2022-11-23 07:57:59 -08:00
imwoo90
a7cf5cd1ca
Fix GPIO interrupt on freeRTOS (#959) 2022-11-22 18:26:19 -08:00
Sylwester
4e6e1d6024
Use PIN_I2S_ defines if they exist in board pin definition. (#991) 2022-11-22 17:42:32 -08:00
Earle F. Philhower, III
0133ecc887
Avoid race conditions in I2C(Wire) callbacks (#995)
Fixes #979

Make sure to read the last byte of I2C data in the case where the IRQ happens
and the STOP signal is also asserted.

Also ensure all branches of the IRQ handler look at the same point in time
value for the IRQ status.
2022-11-22 17:14:44 -08:00
Paint Your Dragon
913dfad1ad
Add Adafruit Feather RP2040 SCORPIO (#987)
* add rough for scorpio

* Add SCORPIO items from ladyada

* Change PID in makeboards.py instead of boards.txt

* Fix PID in scorpio JSON

* README: Add Feather SCORPIO to supported boards

* Fix PIDs using values from MBAdafruitBoards

Still unsure about pid.[1-7] but let's see what happens

* boards.txt fixed by running makeboards.py

Co-authored-by: lady ada <limor@ladyada.net>
2022-11-22 16:56:48 -08:00
Earle F. Philhower, III
2062f94adc
Update README.md 2022-11-21 09:01:30 -08:00
Maximilian Gerhardt
f9db547cf3
Do not require USB init variable for TinyUSB (#981) 2022-11-21 09:00:41 -08:00
Maximilian Gerhardt
2782dd1716
Add Waveshare RP2040 Zero (#980) 2022-11-21 08:52:00 -08:00
Sylwester
852219caf5
Add DatanoiseTV PicoADK board (#964) 2022-11-08 16:18:03 -08:00
Earle F. Philhower, III
07fbed06c6
Fix Arduino Nano Connect USB VID:PID tuples (#970)
Fixes #968
2022-11-08 08:59:21 -08:00
Earle F. Philhower, III
ea5f8241e3
Remove stdio.h include from CYW43 SDK override (#965) 2022-11-07 08:48:54 -08:00
Earle F. Philhower, III
895ffced8e
Fix analogWrite scaling issues (#962)
The PWM internals on the RP2040 are based on 8 slices with independent
clocking.  Make sure that we init the PWM slice being used only once per
change of frequency/range.

Only init the scaling values one time, because we also adjust the input
scale/frequency values when calculating them.  If we ran this twice (i.e.
writing to two slices), it would overwrite the pseudo scale/slow scale
values with 1 causing the wrong PWM values to be set.

Fixes #955
2022-11-07 06:43:14 -08:00
Earle F. Philhower, III
40855c90fb Update version 2022-11-03 08:54:31 -07:00
Earle F. Philhower, III
6570c4856b
Fix deadlock in attachInterruptParam (#953)
Thanks to @imwoo90 comment in https://github.com/earlephilhower/arduino-pico/issues/878#issuecomment-1302276196
2022-11-03 08:40:57 -07:00
风飘雨
008c4d62ef
Fix SerialPIO bit length, update flyboard2040 pins (#950) 2022-11-03 08:35:40 -07:00
Earle F. Philhower, III
63dfd9ab6b
Properly disable Ethernet IRQ, don't drop packets (#951)
Fix #944
2022-11-02 15:27:02 -07:00
Earle F. Philhower, III
9b28fc3e17
Free PIO SM on SerialPIO::end (#949)
Fixes #945
2022-10-31 17:10:59 -07:00
Drzony
6bbaf64daf
Async scan + bugfixes (#947)
* Support asynchronous WiFi scan

* Fixed buffer overflow in getChipId

* ESP compatibility fixes

* fixup! ESP compatibility fixes
2022-10-31 17:01:10 -07:00
AngeloGioacchino Del Regno
44eeebbc6f
cores/rp2040: _freertos.cpp: Avoid memory leak and unnecessary allocation (#948)
There's a memory leak around the corner: creating the mutex means
that we allocate memory for it, but if we cannot find any free slot in the
FMMap array, we're simply returning a nullptr without ever freeing the
previously allocated memory.

Instead of allocating it out of the free-slot check, do it inside.
While at it, also check if the mutex creation succeeded before assigning
it to a FMMap slot.
2022-10-31 14:29:00 -07:00
Earle F. Philhower, III
ec7631096b
Update GH actions to non-deprecated versions (#938) 2022-10-27 14:35:52 -07:00
Earle F. Philhower, III
07a1484d72
Add WiFi.channel() reporting (#937)
Also return error conditions when WiFi status is inquired while not
connected.
2022-10-27 13:02:09 -07:00
Earle F. Philhower, III
9503620525
Add WiFi.BSSID() undocumented call (#936)
Using same method as #934 and Infineon wifi-host-driver sources
2022-10-27 09:09:48 -07:00
mecparts
e05a3b8ad0
Add a way to return the RSSI value (#934)
See https://forums.raspberrypi.com/viewtopic.php?t=341774
2022-10-27 08:00:59 -07:00
Earle F. Philhower, III
9d0b9bef67 Update version 2022-10-25 08:02:54 -07:00
per1234
0446b732fa
Add protocol-explicit upload.tool properties required for pluggable discovery compatibility (#933)
A new flexible and powerful "pluggable discovery" system was added to the Arduino boards platform framework. This system
makes it easy for Arduino boards platform authors to use any arbitrary communication channel between the board and
development tools.

Boards platform configurations that use the old property syntax are automatically translated to the new syntax by
Arduino CLI:

https://arduino.github.io/arduino-cli/latest/platform-specification/#sketch-upload-configuration

> For backward compatibility with IDE 1.8.15 and older the previous syntax is still supported

This translation is only done in platforms that use the old syntax exclusively. If `pluggable_discovery` properties are
defined for the platform then the new pluggable discovery-style `upload.tool.<protocol_name>` properties must be defined
for each board as well.

This platform includes a "UF2 Devices" discovery tool for `uf2conv` protocol ports. This tool now uses the modern
Arduino pluggable discovery system. `pluggable_discovery` properties were added to `platform.txt` in order to configure
the Arduino development tools to use this pluggable discovery tool. The `upload.tool.<protocol_name>` properties in
`boards.txt` were not updated at that time.

Global properties of that name were added to platform.txt, but this approach is not provided for by the Arduino Platform
specification:

https://arduino.github.io/arduino-cli/latest/platform-specification/#sketch-upload-configuration

> A specific upload.tool.<protocol_name> property should be defined for every board in boards.txt:

Those missing properties caused uploads to fail for users of the recent versions of Arduino IDE and Arduino CLI with an
error of the form:

Error during Upload: Property 'upload.tool.<protocol_name>' is undefined

(where `<protocol_name>` is the protocol of the selected port, if any)

It is also important to provide compatibility with versions of Arduino development tools from before the introduction of
the modern pluggable discovery system. For this reason, the old style `<board ID>.upload.tool` properties are retained.
Old versions of the development tools will treat the `<board ID>.upload.tool.<protocol_name>` properties as an unused
arbitrary user defined property with no special significance and the new versions of the development tools will do the
same for the `upload.tool` properties.
2022-10-24 08:50:13 -07:00
Earle F. Philhower, III
c3da4ada61
Add basic Pimoroni PGA2040 board definition (#930)
Because the board needs a unique BOOT2.S, add a definition to make it
easier to use.
2022-10-22 10:19:30 -07:00
Earle F. Philhower, III
4fdcc6e5ac
Only init PWM on requested pin (#926)
Avoid glitches on other pins, fix #919
2022-10-20 04:56:44 -07:00
Maximilian Gerhardt
b82336c8d9
Add W25Q64JV QSPI /4 Boot2 file (#929)
Fixes #927
2022-10-20 04:25:37 -07:00
Earle F. Philhower, III
075958883f Update version 2022-10-16 10:50:29 -07:00
Fredrik Jansson
fe632cde4b
Increase analogWrite frequency range, bugfixes (#918)
* analogWrite: fix overflow and wrap value (#917)

-avoid overflow when calculating analogScale * analogFreq, perform
the multiplication in floating point.

-use analogScale - 1 to set the PWM wrap value. Wrap is the highest
value the counter reaches, not the counter period.

* analogWrite: increase frequency range (#917)

- increase frequency range to 10 MHz

- decrease the lowest allowed resolution to 2 bits, and the
  minimal analogRange value to 3. This makes 10 MHz output possible
  with system clock frequencies down to 50 MHz.

- allow clkdiv values >= 1.0, was 2.0. This makes it possible to
  manually set frequency and analogRange so that
  frequency * analogRange = system clock frequency.
  This gives the best possible frequency accuracy and
  resolution.
2022-10-16 10:43:49 -07:00
Earle F. Philhower, III
10090b60a9
Rewrite PicoW LWIP interface for stability (#916)
Random crashes, infinite loops, and other lockups were happening to the PicoW
while under high load from multiple clients.

This seems to have been due to two issues:

* The periodic sys_check_timeouts() call from an alarm/IRQ was happening while
  the core was in LWIP code. LWIP is not re-entrant or multi-core/thread safe
  so this is a bad thing. Some calls may not have been locked with a manual
  addition of the LWIPMutex object to hit this.
* The WiFi driver supplies packet data during an interrupt. PBUF work is
  legal in an interrupt, but actually calling netif->input() from an IRQ to
  queue up the Ethernet packet for processing is illegal if LWIP is already
  in progress.
   
Rearchitect the LWIP interface to fix these problems:
* Disable interrupts during malloc/etc. to avoid the possibility of the
  periodic LWIP timeout check interrupting and potentially calling user
  code which did a memory operation
* Wrap all used LWIP calls to note LWIP code will be executing, instead of
  manually eyeballing and adding in protection in user code.
* Remove all user code LWIPMutex blocking, the wrapping takes care of it.
* When an Ethernet packet is received by interrupt and we're in LWIP code,
  just throw the packet away for now. The upper layers can handle retransmit.
  (A possible optimization would be to set the packet aside and add a
  housekeeping portion to the LWIP wrappers to netif->input() them when safe).
* Ignore callbacks during TCP connection teardown when the ClientContext
  passed from LWIP == nullptr
2022-10-15 12:00:35 -07:00
Earle F. Philhower, III
a6bdb27178
Use static allocation for IRQ stack (#915)
noInterrupts/interrupts use a stack to allow multiple calls to work
properly.  The original code was using a std::stack which will use
malloc() to allocate entry space.  This seems like a bad idea, and
makes it so it's impossible to disable interrupts for malloc/free,
etc.

Define a fixed stack size and use straight C code to manage the IRQ
stacks.  Slightly more fixed memory requirements, but significantly
lower total RAM requirements and no malloc() dependency.
2022-10-14 13:46:00 -07:00
brtchip-tuannguyen
62ed93f12a
Add board BridgeTek IDM2040-7A (#912) 2022-10-13 08:26:11 -07:00
Earle F. Philhower, III
e89ce78c79
Fix memory leak in WebServer (#914)
Fixes #908
2022-10-12 11:25:56 -07:00
Earle F. Philhower, III
98c4b921b8
Un-hardcode LED pin in AdvancedWebServer example (#909)
Partial #908
2022-10-11 09:30:41 -07:00
Sabas
86765cebb2
Update VID&PID HunterCatNFC 2040 (#907) 2022-10-11 09:12:56 -07:00
Earle F. Philhower, III
25ceb08f93
Clear LWIP started flag on LWIPIntfDev::end (#905)
When moving between different modes or even WiFi.begin/ends, any setting
of the IPs will fail because the internal flag _started was not cleared.
Clear _started on a ::end call.

Fixes #884
2022-10-09 18:25:24 -07:00