Compare commits
1 Commits
fix_debug
...
debugprobe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aec24bf076 |
@@ -50,6 +50,4 @@
|
|||||||
#define PICOPROBE_UART_RX_LED 7
|
#define PICOPROBE_UART_RX_LED 7
|
||||||
#define PICOPROBE_UART_TX_LED 8
|
#define PICOPROBE_UART_TX_LED 8
|
||||||
|
|
||||||
#define PROBE_PRODUCT_STRING "Debug Probe (CMSIS-DAP)"
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -68,6 +68,9 @@
|
|||||||
#define PICOPROBE_UART_RX 5
|
#define PICOPROBE_UART_RX 5
|
||||||
#define PICOPROBE_UART_INTERFACE uart1
|
#define PICOPROBE_UART_INTERFACE uart1
|
||||||
#define PICOPROBE_UART_BAUDRATE 115200
|
#define PICOPROBE_UART_BAUDRATE 115200
|
||||||
|
/* Flow control - some or all of these can be omitted if not used */
|
||||||
|
#define PICOPROBE_UART_RTS 9
|
||||||
|
#define PICOPROBE_UART_DTR 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* LED config - some or all of these can be omitted if not used */
|
/* LED config - some or all of these can be omitted if not used */
|
||||||
@@ -77,6 +80,4 @@
|
|||||||
#define PICOPROBE_UART_RX_LED 7
|
#define PICOPROBE_UART_RX_LED 7
|
||||||
#define PICOPROBE_UART_TX_LED 8
|
#define PICOPROBE_UART_TX_LED 8
|
||||||
|
|
||||||
#define PROBE_PRODUCT_STRING "Example Debug Probe"
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#define PROBE_PIN_SWCLK (PROBE_PIN_OFFSET + 0) // 2
|
#define PROBE_PIN_SWCLK (PROBE_PIN_OFFSET + 0) // 2
|
||||||
#define PROBE_PIN_SWDIO (PROBE_PIN_OFFSET + 1) // 3
|
#define PROBE_PIN_SWDIO (PROBE_PIN_OFFSET + 1) // 3
|
||||||
// Target reset config
|
// Target reset config
|
||||||
#define PROBE_PIN_RESET 1
|
#define PROBE_PIN_RESET 0
|
||||||
|
|
||||||
// UART config
|
// UART config
|
||||||
#define PICOPROBE_UART_TX 4
|
#define PICOPROBE_UART_TX 4
|
||||||
@@ -45,6 +45,4 @@
|
|||||||
|
|
||||||
#define PICOPROBE_USB_CONNECTED_LED 25
|
#define PICOPROBE_USB_CONNECTED_LED 25
|
||||||
|
|
||||||
#define PROBE_PRODUCT_STRING "Picoprobe (CMSIS-DAP)"
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -54,6 +54,17 @@ void cdc_uart_init(void) {
|
|||||||
gpio_set_pulls(PICOPROBE_UART_TX, 1, 0);
|
gpio_set_pulls(PICOPROBE_UART_TX, 1, 0);
|
||||||
gpio_set_pulls(PICOPROBE_UART_RX, 1, 0);
|
gpio_set_pulls(PICOPROBE_UART_RX, 1, 0);
|
||||||
uart_init(PICOPROBE_UART_INTERFACE, PICOPROBE_UART_BAUDRATE);
|
uart_init(PICOPROBE_UART_INTERFACE, PICOPROBE_UART_BAUDRATE);
|
||||||
|
|
||||||
|
#ifdef PICOPROBE_UART_RTS
|
||||||
|
gpio_init(PICOPROBE_UART_RTS);
|
||||||
|
gpio_set_dir(PICOPROBE_UART_RTS, GPIO_OUT);
|
||||||
|
gpio_put(PICOPROBE_UART_RTS, 1);
|
||||||
|
#endif
|
||||||
|
#ifdef PICOPROBE_UART_DTR
|
||||||
|
gpio_init(PICOPROBE_UART_DTR);
|
||||||
|
gpio_set_dir(PICOPROBE_UART_DTR, GPIO_OUT);
|
||||||
|
gpio_put(PICOPROBE_UART_DTR, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cdc_task(void)
|
void cdc_task(void)
|
||||||
@@ -139,7 +150,7 @@ void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* line_coding)
|
|||||||
vTaskSuspend(uart_taskhandle);
|
vTaskSuspend(uart_taskhandle);
|
||||||
interval = MAX(1, micros / ((1000 * 1000) / configTICK_RATE_HZ));
|
interval = MAX(1, micros / ((1000 * 1000) / configTICK_RATE_HZ));
|
||||||
debounce_ticks = MAX(1, configTICK_RATE_HZ / (interval * DEBOUNCE_MS));
|
debounce_ticks = MAX(1, configTICK_RATE_HZ / (interval * DEBOUNCE_MS));
|
||||||
picoprobe_info("New baud rate %ld micros %ld interval %lu\n",
|
picoprobe_info("New baud rate %d micros %d interval %u\n",
|
||||||
line_coding->bit_rate, micros, interval);
|
line_coding->bit_rate, micros, interval);
|
||||||
uart_deinit(PICOPROBE_UART_INTERFACE);
|
uart_deinit(PICOPROBE_UART_INTERFACE);
|
||||||
tud_cdc_write_clear();
|
tud_cdc_write_clear();
|
||||||
@@ -150,6 +161,13 @@ void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* line_coding)
|
|||||||
|
|
||||||
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
|
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
|
||||||
{
|
{
|
||||||
|
#ifdef PICOPROBE_UART_RTS
|
||||||
|
gpio_put(PICOPROBE_UART_RTS, !rts);
|
||||||
|
#endif
|
||||||
|
#ifdef PICOPROBE_UART_DTR
|
||||||
|
gpio_put(PICOPROBE_UART_DTR, !dtr);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* CDC drivers use linestate as a bodge to activate/deactivate the interface.
|
/* CDC drivers use linestate as a bodge to activate/deactivate the interface.
|
||||||
* Resume our UART polling on activate, stop on deactivate */
|
* Resume our UART polling on activate, stop on deactivate */
|
||||||
if (!dtr && !rts) {
|
if (!dtr && !rts) {
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ int main(void) {
|
|||||||
tusb_init();
|
tusb_init();
|
||||||
|
|
||||||
DAP_Setup();
|
DAP_Setup();
|
||||||
stdio_uart_init();
|
|
||||||
|
|
||||||
led_init();
|
led_init();
|
||||||
|
|
||||||
|
|||||||
@@ -26,47 +26,29 @@
|
|||||||
#ifndef PICOPROBE_H_
|
#ifndef PICOPROBE_H_
|
||||||
#define PICOPROBE_H_
|
#define PICOPROBE_H_
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
|
||||||
#include "task.h"
|
|
||||||
|
|
||||||
#if false
|
#if false
|
||||||
#define picoprobe_info(format,args...) \
|
#define picoprobe_info(format,args...) printf(format, ## args)
|
||||||
do { \
|
|
||||||
vTaskSuspendAll(); \
|
|
||||||
printf(format, ## args); \
|
|
||||||
xTaskResumeAll(); \
|
|
||||||
} while (0)
|
|
||||||
#else
|
#else
|
||||||
#define picoprobe_info(format,...) ((void)0)
|
#define picoprobe_info(format,...) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if false
|
#if false
|
||||||
#define picoprobe_debug(format,args...) \
|
#define picoprobe_debug(format,args...) printf(format, ## args)
|
||||||
do { \
|
|
||||||
vTaskSuspendAll(); \
|
|
||||||
printf(format, ## args); \
|
|
||||||
xTaskResumeAll(); \
|
|
||||||
} while (0)
|
|
||||||
#else
|
#else
|
||||||
#define picoprobe_debug(format,...) ((void)0)
|
#define picoprobe_debug(format,...) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if false
|
#if false
|
||||||
#define picoprobe_dump(format,args...)\
|
#define picoprobe_dump(format,args...) printf(format, ## args)
|
||||||
do { \
|
|
||||||
vTaskSuspendAll(); \
|
|
||||||
printf(format, ## args); \
|
|
||||||
xTaskResumeAll(); \
|
|
||||||
} while (0)
|
|
||||||
#else
|
#else
|
||||||
#define picoprobe_dump(format,...) ((void)0)
|
#define picoprobe_dump(format,...) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO tie this up with PICO_BOARD defines in the main SDK
|
// TODO tie this up with PICO_BOARD defines in the main SDK
|
||||||
|
|
||||||
#include "board_pico_config.h"
|
//#include "board_pico_config.h"
|
||||||
//#include "board_debugprobe_config.h"
|
#include "board_debugprobe_config.h"
|
||||||
//#include "board_example_config.h"
|
//#include "board_example_config.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ char const* string_desc_arr [] =
|
|||||||
{
|
{
|
||||||
(const char[]) { 0x09, 0x04 }, // 0: is supported language is English (0x0409)
|
(const char[]) { 0x09, 0x04 }, // 0: is supported language is English (0x0409)
|
||||||
"Raspberry Pi", // 1: Manufacturer
|
"Raspberry Pi", // 1: Manufacturer
|
||||||
PROBE_PRODUCT_STRING, // 2: Product
|
"Debug Probe (CMSIS-DAP)", // 2: Product
|
||||||
usb_serial, // 3: Serial, uses flash unique ID
|
usb_serial, // 3: Serial, uses flash unique ID
|
||||||
"CMSIS-DAP v1 Interface", // 4: Interface descriptor for HID transport
|
"CMSIS-DAP v1 Interface", // 4: Interface descriptor for HID transport
|
||||||
"CMSIS-DAP v2 Interface", // 5: Interface descriptor for Bulk transport
|
"CMSIS-DAP v2 Interface", // 5: Interface descriptor for Bulk transport
|
||||||
|
|||||||
Reference in New Issue
Block a user