Commit graph

30 commits

Author SHA1 Message Date
rlcamp
f5f7267f44
Add Serial.dtr() and Serial.rts() methods (#1779)
* add Serial.dtr() and Serial.rts() methods

* added documentation for Serial.dtr() and Serial.rts()
2023-10-24 19:02:17 +02:00
marklinmax
23e68973c0
Add SerialUSB::ignoreFlowControl() method (#1624)
Fixes #1620
2023-08-02 17:00:26 -07:00
Earle F. Philhower, III
579e366bcf
Fix serial reset hang under FreeRTOS (#1495)
The serial port reset logic was calling `sleep_ms()` which ended up doing
a task switch...while the other core was frozen and everything was supposed
to be locked.

Use `busy_wait_ms()` which is a tight loop to delay in the reset portion.

Fixes #1486
2023-06-04 13:28:11 -07:00
Earle F. Philhower, III
b57ac66815
Cleanup legacy includes (#1452) 2023-05-16 23:47:17 -07:00
Earle F. Philhower, III
ae908c8e9b
Use real FreeRTOS tasks to idle core during flash (#1444)
Fixes #1439

Use a real FreeRTOS task, at the highest priority, to idle the other core
while doing flash accesses.

The USB stack seems to have some timing dependent bits which get broken
if FreeRTOS switches out the current task when it's running.  Avoid any
issue by disabling preemption on the core for all tud_task calls.

The PendSV handler disable flag can live completely inside the FreeRTOS
variant port, so remove any reference to it in the main core.

Tested using Multicode-FreeRTOS, #1402 and #1441

The USB FIFO interrupts were still being serviced even when the core was
frozen, leading to crashes.  Explicitly shut off IRQs on both the victim
and the initiator core when freezing.

Removed the need for hack __holdUpPendSV flag
2023-05-15 18:10:30 -07:00
Earle F. Philhower, III
36e0b4a908
Unbreak FreeRTOS (#1193)
USB changes caused FreeRTOS to not be able to swap tasks when the Serial port
was connected.  Clear the "stop PendSV" flag after checking for reset signal.
2023-02-15 12:10:52 -08:00
Andrew Kroll
5dafbf57e9
Optimize and improve upload experience (#1136)
Stop the IDE from reporting large "Serial port not fount"-type errors after
every upload by delaying a bit before the uploader exits to give the OS/Pico
time to renegotiate.

Fixes flashing problems on certain Linux distros by checking all possible mount
locations instead of only the first one to be found.

Make 1200bps reset tickle more robust

Co-authored-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
2023-02-11 12:33:44 -08:00
Earle F. Philhower, III
b0d0e292c9
Minor - Add number separators (#845) 2022-09-07 15:19:12 -07:00
Earle F. Philhower, III
db337a9b36
Increase SerialUSB speed (#833)
Add calls to `tud_task` to pump the USB interface in the SerialUSB methods.

See #832 for more info.
2022-09-06 12:44:34 -07:00
Earle F. Philhower, III
a582ca7b95
Avoid potential lockup w/Serial.read unconnected (#817)
Fixes #816

If a byte is available, return it even if the USB stack reports
disconnected.
2022-08-30 12:05:08 -07:00
Earle F. Philhower, III
0edba2ee2a
Add WebServer, WebServerSecure, HTTPUpdateServer, HTTPUpdateServerSecure (#791)
* Add HTTP-parser lib to support ESP32 WebServer
* Add WebServer from ESP32.  Only supports HTTP
* Separate HTTP server from the network server
Instead of managing the WiFiServer/WiFiServerSecure in the same object
as the HTTP handling, split them into separate objects.  This lets
HTTP and HTTPS servers work without templates or duplicating code.
The HTTP block just gets a `WiFiClient*` and works with that to only
do HTTP processing, while the upper object handles the appropriate
server and client types.
* Add HTTPS server
* Clean up some THandlerFunction refs
* Refactor into a template-ized WebServer/WebServerSecure
* Add DNSServer examples which need WebServer
* Fix CoreMutex infinite recursion crash
Core could crash while Serial debugging was going on and prints were
happening from LWIP/IRQ land and the main app.
* Add HTTPUpdateServer(Secure)
* Add MIME include, optimize WebServer::send(size,len)
When send()ing a large buffer, the WebServer::send() call would
actually convert that buffer into a String (i.e. duplicate it, and
potential issues with embedded \0s in binary data).
Make a simple override to send(size, len) to allow writing from the
source buffer instead.
* Fix WiFiClient::send(Stream), add FSBrowser example
2022-08-23 15:51:32 -07:00
Earle F. Philhower, III
da8ab1e9dd
Return # of bytes written by SerialUSB::write (#662)
Before always returned 0 on a ::write.  Now properly return the count
of bytes that were sent to the USB port.

Thanks to Terry Haas for the report.
2022-06-28 13:01:06 -07:00
majbthrd
47a4d9f803
Add pico-debug support (#239) 2021-07-07 12:55:03 -07:00
Earle F. Philhower, III
08b6748d79
Update to PICO-SDK version 1.2.0 (#207)
Minor rev to the tinyUSB version used, new ID function.
2021-06-11 12:48:09 -07:00
Earle F. Philhower, III
8016a932f3
Add astyle format, boards.txt, and package check (#166)
Miscellaneous CI checks for code style, boards.txt update, and that all
referenced packages are available.
2021-05-24 15:01:03 -07:00
Earle F. Philhower, III
83a32f1ba3
Add compilation to CI (#155)
Stolen from ESP8266, modified to run basic sanity compiles on the core.

Fix warnings identified by the new checks.
2021-05-22 02:58:57 -07:00
Ha Thach
f8a2f38fe7
Port Adafruit_TinyUSB_Arduino lib (#127)
* initial tinyusb lib port

* add Adafruit_TinyUSB_Arduino as submodules

* add yield() to main loop

* sync with tinyusb lib latest

* add USB manufacturer and product

* fix typo in tinyusb lib

* sync with master

updating implementation

* Rationalize link stage command line

Make the build process less insane.

* clean up delay

* clean up platform and board

* update makeboards.py for generating usbstack menu

* update tinyusb lib to 1.0.0
2021-05-18 18:10:47 -07:00
Earle F. Philhower, III
4a8ac3d902
Add support for shared USB Serial, Keyboard, Mouse (#132)
Use a shared infrastructure based on TinyUSB, allow users to use sketches
with ported Arduino Keyboard and Mouse libraries.
2021-05-13 19:20:24 -07:00
Earle F. Philhower, III
b2cef8d8d6 Adafruit Feather, overclocking, flash FS shims
Add support for Adafruit Feather RP2040 (8MB).  Identified with a unique
USB PID so it displays properly once programmed one time.  Moved LED to
pin 13 (per the website docs), but have no board to test.

Add over/underclocking menus, applied at boot.  Use at your own risk, as
usual.

Add shims to allocate flash space for a filesystem (but not implemented
yet).

Add a "generic" RP2040 board
2021-03-28 10:56:53 -07:00
Earle F. Philhower, III
09ec5e0d22 Refactor USB/UART mutexes, code cleanup, CoreMutex addition
Add a CoreMutex class which implements a deadlock-safe mutex and reqork
the SerialUSB and SerialUART classes to use it to synchronize output
when in a multicore sketch.
2021-03-27 09:41:23 -07:00
Earle F. Philhower, III
c4bbccdead Add serialEvent support for USB, UART0, UART1 2021-03-25 12:42:05 -07:00
Earle F. Philhower, III
1138d822bf Increase SerialUSB maximum transfer speed
Use chunks not bytes to transfer data to host, like in the serial_usb
SDK.
2021-03-24 08:32:34 -07:00
Earle F. Philhower, III
058e9e245f Use CDC class for the USB serial port
Fixes #8 and some other weirdness seen when going between computers.
Use the CDC and not MISC class to identify the Pico
2021-03-23 18:32:29 -07:00
Earle F. Philhower, III
50d68f0bec Update SN in USBN device using the device ID 2021-03-21 08:55:37 -07:00
Earle F. Philhower, III
68b656a55e Update USB serial to be a HW Serial 2021-03-13 12:22:41 -08:00
Earle F. Philhower, III
b3dad2ba62 Cleanup, add licenses to all files 2021-03-05 22:09:05 -08:00
Earle F. Philhower, III
4ac271af72 Automatic script upload working, no buttons or fiddling
Add smarts to the UF2 uploader to potentially trigger a reboot if the
device passed in is /dev/tty* or COM*.  Will cause reboot to USB
bootloader and standard UF2 upload will happen w/o any user
intervention.
2021-02-26 19:16:03 -08:00
Earle F. Philhower, III
77d7a26428 Reboot directly into USB bootloader on Serial reset 2021-02-26 18:47:39 -08:00
Earle F. Philhower, III
e0e0d9e115 Reboot using Arduino standard 1200bps/DTR=0
Allow the IDE to cause the chip to reboot when the Serial port is active
and the baud is set to 1200 followed by a DTR toggle.  The user still
needs to hold the BOOTSEL button to enable the UF2 boot, for now.
2021-02-26 18:31:15 -08:00
Earle F. Philhower, III
369dea88ba Add Serial(USB) support
Serial via USB /dev/ttyACM0 now works using standalone minicom terminal
app but not via the IDE's serial monitor.
2021-02-25 17:07:42 -08:00