Commit Graph

51 Commits

Author SHA1 Message Date
Jonathan Bell
0b6f8db41a cdc_uart: support databits, stopbits and parity setup 2023-09-18 16:17:29 +01:00
Jonathan Bell
e51647492e cdc_uart: cater for Windows driver deficiencies
It's possible for the Windows CDC-ACM driver to ignore the IN endpoint
for long periods of time - multiple frames - if the host application
doesn't consume uart RX data. Boost buffer sizes to compensate.

Also prevent usb_thread from potentially being idle for a tick when
there's work to do.
2023-09-05 10:59:50 +01:00
Sunaabh Trivedi
58fa7a14cd Added a custom USB endpoint handler to process commands on a packet basis, as opposed to the byte FIFO employed previously. This allows multiple commmands to be framed correctly, so they can be processed sequentially without losing packets.
Suspend DAP thread until the end of the USB callback. This prevents the need for continous polling by DAP thread.
2023-08-24 17:15:47 +01:00
Jonathan Bell
1586ef0caa picoprobe version 1.0.3 2023-08-15 11:48:50 +01:00
Jonathan Bell
0761424821 probe: hook up reset functionality to DAP commands 2023-08-15 11:48:50 +01:00
Jonathan Bell
d47b3082f8 Fix debug prints
- The reset pin must move otherwise uart0 tx is squashed
- Don't preempt printf, it doesn't like it
- Set up the UART by default
2023-08-15 11:48:50 +01:00
P33M
6473166494 usb_descriptors: disable remote wake (#91)
see https://github.com/raspberrypi/picoprobe/issues/71
2023-08-09 13:13:36 +01:00
Roger Wolff
eb494103d4 buildsystem improvements to make it easier to build for debugprobe. (#87)
Merge documentation pull request from @rewolff
2023-06-22 13:50:25 +01:00
Luke Wren
0746b5a844 Don't call probe_read_mode() in deinit() without matching prior init(), fixes #88 2023-06-17 19:59:52 +01:00
Luke Wren
57f5569894 Update probe_oen.pio to use the same logic as the new probe.pio.
Fix a couple of compilation issues in the helpers for probe_oen.pio.
2023-05-09 13:36:10 +01:00
Luke Wren
ae5bdb082d Reduce SWCLK frequency from SM/2 to SM/4, to reduce dead cycles.
Also fix divider becoming 0 when extremely high SWCLK frequencies
are requested (this would have been safe but you would get an
extremely slow SWCLK).
2023-05-09 11:29:53 +01:00
Luke Wren
491b96c1d4 Update PIO program to pass read/write commands through FIFO
alongside bit counts. Also, don't return RX data on write commands.
These two changes allow the probe code to return early after
pushing write commands into the FIFO, which improves throughput.
2023-05-09 11:15:12 +01:00
Jonathan Bell
46eb924601 board configs: differentiate the USB product strings 2023-05-02 10:09:01 +01:00
Jonathan Bell
cdc33333c9 picoprobe_config: default should be the Pico, not Debug Probe 2023-05-02 10:00:44 +01:00
Jonathan Bell
c8eb077c6c cdc_uart: avoid compilation warning if UART LEDs not used 2023-02-27 15:07:10 +00:00
Jonathan Bell
fbc4116141 probe: split pioasm and setup code into variant files, and add OEN variant 2023-02-27 15:07:10 +00:00
Jonathan Bell
364adfe1f1 picoprobe_config: split board-related pin setup into separate header files 2023-02-27 15:07:10 +00:00
Jonathan Bell
08ed872793 probe: drop support for PROTO_OPENOCD_CUSTOM
CMSIS-DAP is a complete superset of the Picoprobe protocol, so
now we default to DAPv2 there's no need to keep the downstream
code.

Also make setting up the reset pin conditional and in the correct place.
2023-02-27 15:07:10 +00:00
Jonathan Bell
5a9c6940c4 probe: use a more generic method for direction changes 2023-02-27 15:07:10 +00:00
Jonathan Bell
bb1c547b07 picoprobe: rename to Debug Adapter 2023-02-27 15:07:10 +00:00
Jonathan Bell
724e5de6c8 probe: if we have a separate SWDIO input, use it
For boards with a level-shifter on SWDIO for compatibility with 1.8V VDDIO.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2023-02-27 15:07:10 +00:00
Jonathan Bell
1ca6aa36dd picoprobe: add a USB Connected LED and signal it appropriately
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2023-02-27 15:07:10 +00:00
Jonathan Bell
db24224846 picoprobe: use GPIO definitions for the new debug adapter, PCB R2
Limitations:
- Power LED doesn't yet do anything sensible
- The level-shifted SWDIO input isn't utilised by the PIO SM, so only 3.3v I/O

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2023-02-27 15:07:10 +00:00
Jonathan Bell
e187e5754b RTOS: reduce DAP polling delay - improves throughput.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2023-02-27 15:07:10 +00:00
Jonathan Bell
a2890561c0 Add DAP and UART LED options. Use a debounce for UART LEDs.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2023-02-27 15:07:10 +00:00
Jonathan Bell
156a33fa01 freeRTOS: shrink heap by half
A 128K reservation on a device with 256K of RAM is a bit demanding.
Shrink to fix a link error in a DebugRel build.
2023-02-27 14:06:22 +00:00
graham sanderson
599ee88582 Default TUD_OPT_RP2040_USB_DEVICE_UFRAME_FIX=1 2023-02-21 16:44:15 -06:00
Jonathan Bell
42d1ff28c8 Fix vendor interface semantics for tinyUSB >= 0.13
Explicit flushing of writes is now required.
2023-01-06 11:48:55 +00:00
Jonathan Bell
b1799bf45d usb: start using bcdDevice as a version number 2022-11-11 16:08:52 +00:00
Jonathan Bell
e5fef459ef probe: check whether we need to actually load or remove probe SMs
Calling DAP_Connect multiple times without calls to DAP_Disconnect would
cause a panic.
2022-11-11 13:35:34 +00:00
Jonathan Bell
f4fe468c85 Add CMSIS-DAP to the product string so OpenOCD udev rules are applied
Allows plugdev users to access picoprobe.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-25 15:58:28 +01:00
Jonathan Bell
8737a06202 probe: resolve a bug in init/deinit handling
OpenOCD is fond of calling PORT_OFF and PORT_SWD_SETUP frequently, which
played havoc with caching both adapter khz and the DAP delay.

Revert to caching just the DAP delay and reset it when PORT_OFF is called.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-18 16:01:40 +01:00
Jonathan Bell
e698ea5d5c Convert to threaded operation by default
Rather than polling each interface in turn, execute the interface
handling periodically.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-18 16:01:40 +01:00
Jonathan Bell
687ba956f4 Add FreeRTOS (RP2040 port) to the build
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-18 16:01:40 +01:00
Jonathan Bell
47e2043564 probe: performance enhancements
- Run out of SRAM, it goes quite a lot faster
- Cache the DAP clock frequency
- Read RDATA and write WDATA all in one go, and merge the turnaround
  into the ACK phase. Reduces the number of missed PIO SM cycles during an
  SWD transfer

Also fix a compiler warning and demote the loglevel of some debug messages.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-18 16:00:28 +01:00
Jonathan Bell
372072a706 probe: default to CMSIS-DAP v2
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-18 16:00:28 +01:00
Jonathan Bell
aabe217a68 probe: add missing data-phase recovery in ACK WAIT or FAULT states
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-18 16:00:28 +01:00
Jonathan Bell
ee4d575bf7 probe: allow for selection of CMSIS-DAP v1 and v2 protocols
CMSIS-DAP v1 is a pseudo-HID device which allows "driver-less" use on
Windows. DAP v2 is a vendor-specific bulk protocol, so there needs to be
a companion MS OS 2.0 descriptor for the debug interface with
DeviceInterfaceGUID set to the Keil GUID.

Allow for selection between these and the openocd protocol at compile time.

Parts of the v1 implementation are derived from the DapperMime project, so
add credit where due.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-18 16:00:28 +01:00
Jonathan Bell
592b8da71a probe: add CMSIS-DAP PIO-driven implementation
CMSIS-DAP implementations explicitly use CPU bitbash to control SWD and
SWDIO, but we can do better. Transfers are handed off to PIO in phases,
which gets us deterministic clock timing as well as freeing the CPU up
for other tasks.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-18 16:00:28 +01:00
Jonathan Bell
02b31998d5 probe: fix SWDIO line idle state and export low-level functions
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-18 16:00:28 +01:00
Jonathan Bell
33ed0e78dc cdc_uart: performance improvements
This commit fixes a few deadlock scenarios and makes cdc_task more
amenable to being called in a threadable context. Full-duplex is now
reliable at fast and slow baudrates.

There is still an annoyance where if the CDC interface is deactivated
while the UART RX is still active, buffers queued to the endpoint
hardware aren't flushed. This is a tinyUSB interface bug.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-08-18 16:00:28 +01:00
graham sanderson
164eaa5b80 add pico.h to fix build 2021-06-03 15:18:41 -05:00
newbrain
0ff8b5530b Hardware target reset support 2021-02-23 15:45:12 +00:00
Liam Fraser
218bd5f50a Add MIT license to all source files 2021-02-03 09:29:20 +00:00
Liam Fraser
67f5af124a Disable all debug output so any uart can be used 2021-02-03 09:25:45 +00:00
Liam Fraser
49a80059b8 Fix file permissions 2021-02-03 09:24:46 +00:00
Liam Fraser
4bcaaa915d Add missing #endif 2021-02-03 09:23:04 +00:00
Andrew Scheller
c29510f567 Move selection of UART interface and baudrate to picoprobe_config.h (#7)
Co-authored-by: Liam Fraser <liam@raspberrypi.com>
2021-02-03 09:22:09 +00:00
newbrain
0fe6a09d8b Unique serial numbers for picoprobe (#8)
Co-authored-by: newbrain <newbrain@tiscali.it>
Co-authored-by: Liam Fraser <liam@raspberrypi.com>
2021-02-03 09:19:04 +00:00
a-pushkin
8ab7ebcabe Leverage built in LED (#6)
* turn on LED on startup and blink for frequent activity
2021-02-03 09:14:55 +00:00