Commit graph

409 commits

Author SHA1 Message Date
Earle F. Philhower, III
f07079bb7d
Remove dead debug code in PIOProgram (#2992) 2025-06-12 11:15:12 -07:00
Earle F. Philhower, III
e7a23550ce
Update to GCC 14.3, Newlib 4.5.0 (#2975)
Moves to just released GCC 14.3

Moves to full-fat printf/scanf because Newlib no longer supports all the
calls libstdc++ requires with the older, smaller, nano-formatted-io option.

Moves to latest SDK develop branch with important float acceleration fixes
for the RP2350, among other updates.

Moves to latest pioasm, picotool develop branches

* SDK was refactored, update the includes
* Rebuild PicoSDK and BearSSL libs
* Update certs in BSSL validation example
* Don't spell check the certs!
* Updated tools with full fat++ newlib printf/scanf
2025-06-12 10:54:37 -07:00
Earle F. Philhower, III
7dcfe4d483 Update version 2025-05-22 08:19:51 -07:00
Earle F. Philhower, III
d5e844b2bd
Panic on stack protector crash instead of exit (#2955)
Newlib has a stack protector fail handler which write(2)s a
message to STDERR which doesn't work here.  Override with a
call to panic().

Tell GCC to protect all functions for stack protection instead of
ones that it heuristically decides need protection.  Slower but
safer, and only when stack protection is enabled.
2025-05-14 07:38:25 -07:00
Earle F. Philhower, III
47c2cd2b0b Update version 2025-05-02 08:59:52 -07:00
Ahmed ARIF
59614a99c8
optimize parity calculations in SerialPIO (#2932) (#2933)
use bit manipulation technique from http://www.graphics.stanford.edu/~seander/bithacks.html#ParityParallel for parity calculation

Co-authored-by: Ahmed ARIF <contact@eotics.com>
2025-05-01 14:06:52 -07:00
Earle F. Philhower, III
5e74bbbbb2
Rewrite SerialPIO receive path, ensure proper edge (#2929)
The SerialPIO(SoftwareSerial) receive path was convoluted and required
a lot of work on the host to get the actual data out.  It also wasn't
always sampling on the proper edge leading to errors whenever clocks
or hold times shifted slightly.

Rewrite the SerialPIO RX path to explicitily wait for start bit,
pause 1/2 bit time, then idle for a full bit time for all bits.
Takes more PIO instruction memory but works flawlessly even with
mismatched clocks.

Tested with a loopback from HW UART to SW UART with a 5% clock
mismatch @ 19200 baud without reception errors, whereas the
original code would fail with less than a 0.5% variation.

Fixes #2928

````

SoftwareSerial s(15, -1);
void setup() {
  Serial1.setTX(0);
  Serial1.begin(19200 + 1920/2, SERIAL_8N1);
  s.begin(19200, SERIAL_8N1);
}

void loop() {
  Serial.println("---");
  Serial1.write("Had we but world enough and time", 32);
  uint32_t now = millis();
  while (millis() - now < 500) {
    while (s.available()) {
      auto c = s.read();
      Serial.printf("%02x '%c'\n", c, c);
    }
  }
}
````
2025-04-29 13:39:34 -07:00
Earle F. Philhower, III
bc5b2c24ff
Fix rp2040.getCycleCount() from core1 (#2915)
Fixes #2914

There are 2 systick units, one per core.  Set up and start core1's
systick unit and track each core's epoch separately.

Document a method of preserving 100% user-only code on core1
and add a core1_disable_systick boolean flag that works like the
separate stack one.
2025-04-18 09:16:36 -07:00
Earle F. Philhower, III
60d28d6c92
Add PIO.h header verification to CI (#2911)
* Add PIO.h header verification to CI

Ensure all PIO .pio.h headers match the .pio sources in the tree

* Install all tools for Style check

* Clean up mismatched PIO headers

No functional changes, but the PDM pdm.pio file did not init a data pin
while the pdm.pio.h (the one actually used in the core) did.  Correct to
match.

* No need for submodules in the style check
2025-04-16 14:56:31 -07:00
Earle F. Philhower, III
e8bd9daa82 Update version 2025-04-16 13:22:14 -07:00
Earle F. Philhower, III
9747990c16
Fix remaining PICO_RP2350B reference (#2910)
Minor fix to #2898
2025-04-16 08:28:53 -07:00
Earle F. Philhower, III
e05dd50d62
Convert to SDK RP2350A/B determination (#2898)
* Convert to SDK RP2350A/B determination

Fixes #2878

The SDK uses `defined(PICO_RP2350) && !PICO_RP2350A` to indicate an RP2350B
chip, not the define PICO_RP2350B.

Match the SDK's usage by converting from `defined(PICO_RP2350B)` to
`defined(PICO_RP2350) && !PICO_RP2350A` and update the chip variants
accordingly.

* Need to explicitly override PICO_RP2350A for all

The *SDK*'s board definition file hardcodes a PICO_RP2350A value for
all boards, but we use the same board file for both A and B variants.
Override the SDK board definition in the variant definition file.

* Generic RP2350 needs 2-stage PICO_RP2350A setting

Also ensure SDK board definition included before pins_arduino.h for
clearing up redefinition errors.

* Factor out undef PICO_RP2350A

* Update Arduino.h
2025-04-08 16:02:54 -07:00
Earle F. Philhower, III
54885d79e0
Add explicit using arduino::IPAddress to headers (#2894)
Fix issue with WiFiNINA includes.  Fixes #2887
2025-04-07 10:17:03 -07:00
Earle F. Philhower, III
49397a7f3d Update version 2025-03-18 17:03:18 -07:00
Earle F. Philhower, III
aabbba67ce
Add some Doxygen documentation to core and libraries (#2780) 2025-03-18 17:00:44 -07:00
Earle F. Philhower, III
e60858c327 Update version 2025-03-11 13:35:52 -07:00
Earle F. Philhower, III
14145e4469
Update to SDK 2.1.2-develop (#2844)
Supercedes #2815

Move to pico-sdk official develop branch which includes a necessary
IRQ header fix.

200MHz is now default for the Pico, but 133 is still available from
the menus.
2025-03-11 13:30:17 -07:00
Earle F. Philhower, III
5bfc35caf5
Enable add'l UART_AUX pinouts for RP2350 (#2837)
Fixes #2835.  Thanks @deltaford!
2025-03-05 07:02:32 -08:00
Earle F. Philhower, III
8deb6b9724
Adjust the PSRAM clock when over/underclock F_SYS (#2824)
* Adjust the PSRAM clock when over/underclock F_SYS

Fixes #2818

* Need to increase PSRAM divider before sysclk increase

Per datasheet, when increasing sysclk speed we need to set the qmi
clocks first and do a dummy transfer to ensure no invalid speed
operations happen on the bus.  Handle the logic for this while setting
up the overclock.
2025-02-26 16:38:52 -08:00
Earle F. Philhower, III
31786cdc24 Update version 2025-02-18 12:55:03 -08:00
Earle F. Philhower, III
c79e543c41
Move to Arduino API 10501 (#2797)
* Move to Arduino API 10501

Track upstream Arduino API headers

* IPAddress V4/V6 compatiblity restored

* Fix WiFiUDP includes

* String differences in example

* HardwareSerial using exported
2025-02-08 22:45:10 -08:00
Earle F. Philhower, III
5e2fbf324b Update version 2025-02-04 14:34:53 -08:00
Earle F. Philhower, III
9480c2a55d Update version 2025-01-21 10:15:08 -08:00
Markus Gyger
b3d0ccc7e3
Change duty cycle of PIO Tone to 50% (#2770) 2025-01-21 10:03:31 -08:00
Dryw Wade
5a34395f46
PIOProgram: Replace __pioHighGPIO with pio_get_gpio_base() (#2769)
Fixes #2768
2025-01-21 09:33:04 -08:00
Earle F. Philhower, III
83b8d122d7
Restore Bluetooth TLV on Pico2/RPiWiFi boards (#2753) 2025-01-13 17:38:51 -08:00
Earle F. Philhower, III
5296241949 Update version 2024-12-31 10:35:02 -08:00
Earle F. Philhower, III
2f99b0ae2f Update version 2024-12-18 17:51:11 -08:00
Earle F. Philhower, III
eecbcdf59a
Derive playback devices from common AudioOutputBase (#2703)
The audio output objects all have the same general necessary configuration
calls.  Abstract them out to a generic AudioOutputBase interface class that
they will inherit from.  Simplifies letting applications use different
output channels.

Should be backwards compatible with existing code.
2024-12-18 12:19:40 -08:00
Earle F. Philhower, III
21a767e7e4
Semihosting part of core, RISC-V support (#2685)
Semihosting is handy for debugging, so allow the core to use `SerialSemi` as the
::printf port.  Add menu item to the IDE to allow selection.

Add RISC-V implementation of semihost call
2024-12-14 09:42:45 -08:00
Earle F. Philhower, III
0061d3f97f
Enable gprof onboard profiling (#2669)
Adds a menu item to enable onboard profiling.  This requires significant
RAM and really only makes sense on devices with PSRAM to store the state.

When the menu item is selected, allocates RAM and tracks function calls and
periodically samples the PC to generate a histogram of application usage.
The onboard gmon.out file can be written over Semihosting or
some other way to transfer to a PC for analysis.

Adds a profiling example with command lines.
2024-12-05 17:30:45 -08:00
Earle F. Philhower, III
34e02aaeb5 Update version 2024-12-02 11:39:24 -08:00
Linar Yusupov
e16c459598
Fix for cyw43_wrappers.h build with C code (#2639) 2024-11-26 00:48:34 -08:00
Earle F. Philhower, III
7add6250e0 Update version 2024-11-25 10:44:58 -08:00
Earle F. Philhower, III
4068601b01
Update to SDK 2.1.0, add Pico 2W (#2629)
Update to Pico SDK 2.1.0, remove XIP and PSRAM workarounds.

Add Pico2W board.
2024-11-25 10:43:55 -08:00
Earle F. Philhower, III
996c3bfab9
Clean up unused parameter warnings (#2624) 2024-11-19 13:55:00 -08:00
Earle F. Philhower, III
322a1af6da
Avoid memory (de)allocation in GPIO ISR handler (#2623)
Replace std::map, which can `new` and `delete` elements of the tree,
with a statically allocated array and housekeeping.

Fixes #2622
2024-11-19 12:26:47 -08:00
Earle F. Philhower, III
e25d382732
Support WiFi/BT/BLT with RP2350 CYW43 boards (#2616)
Using pico-sdk develop branch, add in support for CYW43-based
WiFi/BT/BLE boards on the RP2350 such as the
SparkFun Thing Plus RP2350 or the Pimoroni Pico Plus 2W.

Fixes #2608

Rolls in dynamic SPI divider #2600

* Support LED digitalWrite on RP2350+CYW

Also move "special GPIO" to 64 since the Pimoroni Pico 2W uses the
RP2350B with 48 GPIOs.

* Enable CYW43_PIN_WL_DYNAMIC in IDE and P.IO

Allows calling `cyw43_set_pins_wl(cyw43_pin_array);` to redefine the
CYW43 hookup in the variant initialization.
2024-11-19 10:28:12 -08:00
Earle F. Philhower, III
ca30518510 Update version 2024-11-15 10:03:00 -08:00
Earle F. Philhower, III
083d86d251
rp2040.enableDoubleResetBootloader only on RP2040 (#2607)
The RP2350 boot ROM seems to randomize memory on a HW reset, including
both CPU stacks where we normally stuff the "reset to bootloader" flag.
Update the docs and source to remove rp2040.enableDoubleResetBootloader()
on RP2350-based boards.

Fixes #2606
2024-11-14 10:46:53 -08:00
Earle F. Philhower, III
5ef8a5a5cc Update version 2024-10-29 07:08:45 -07:00
Earle F. Philhower, III
0d26c5eded
Update PSRAM cache flush algorithm (#2563)
New info from RPI engineers give a slightly better/safer method.
2024-10-28 16:27:23 -07:00
Earle F. Philhower, III
5b135fabc4
Fix 2.0 SDK BLE devices (#2560)
Remove old pre-release BTStack files from sdkoverrides (were needed for
compound BLE devices, but the latest BTStack now incorporates these
changes).

Fixes #2547
2024-10-27 12:52:43 -07:00
Ikechukwu Ofili
3aa8df5ab7
GPIO interrupt dispatcher, minimize blocking (#2558)
Only need to lock around the std::map check, not the whole IRQ callback

This is important if you have a time sensitive interrupt on one of the cores
2024-10-26 13:37:24 -07:00
Earle F. Philhower, III
599c226b8c
Workaround PSRAM cache invalid'n by reading flash (#2551)
* Workaround PSRAM cache invalid'n by reading flash

Fixes #2537

While waiting for a working direct cache flush routine, try and force the
cache to evict all PSRAM values by reading a bunch of flash addresses (which
share the XIP cache).  This hurts performance when PSRAM is not used, but
is required for correctness until we have a working XIP flush.

* Invalidate after cleaning the cache line

gmx from the RPI forums came up with this hack and it seems to work!
https://forums.raspberrypi.com/viewtopic.php?p=2262371#p2262371
2024-10-23 16:12:37 -07:00
Earle F. Philhower, III
e7419fbdf9
Add ARM assembly optimized memcpy for RP2350 (#2552)
33% faster for 4K memcpy using DMAMemcyp example

With this assembly:
CPU: 4835 clock cycles for 4K
DMA: 2169 clock cycles for 4K

Using stock Newlib memcpy:
CPU: 7314 clock cycles for 4K
DMA: 2175 clock cycles for 4K
2024-10-23 15:11:19 -07:00
Earle F. Philhower, III
fdd7557156
Preserve PSRAM QMI interface around flash ops (#2539)
The flash ROM routines seem to overwrite the QMI configuration we set for
PSRAM, rendering it unreadable after any erase or write or ID command.

Wrap the 4 flash control functions to preserve the QMI state on the
RP2350.  On the RP2040, simply pass through the call.

Fixes #2537
2024-10-12 12:32:56 -07:00
Maximilian Gerhardt
58c0d95114
Fix getStackPointer() to work in RISC-V and ARM mode (#2526) 2024-10-06 09:44:30 -07:00
Thomas Pfister
2f55223b70
Add getResetReason() by palmerr23 (#2516)
* Add support for RP2350
2024-10-04 17:37:36 -07:00
Earle F. Philhower, III
67bf5a734a
Remove 2 instructions from tone PIO program (#2515)
Manually load the 2 needed registers using pio_execute to save a couple
PIO instruction slots.
2024-10-03 13:27:14 -07:00