Compare commits

...

3 Commits

Author SHA1 Message Date
Jonathan Bell
5ab8c86465 picoprobe version 1.0.3 2023-08-15 11:47:19 +01:00
Jonathan Bell
2a6f9911db probe: hook up reset functionality to DAP commands 2023-08-15 11:23:54 +01:00
Jonathan Bell
5b6eb3e427 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:21:17 +01:00
9 changed files with 48 additions and 8 deletions

View File

@@ -460,7 +460,11 @@ __STATIC_FORCEINLINE void PIN_nTRST_OUT (uint32_t bit) {
\return Current status of the nRESET DAP hardware I/O pin. \return Current status of the nRESET DAP hardware I/O pin.
*/ */
__STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) { __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) {
#ifdef PROBE_PIN_RESET
return probe_reset_level();
#else
return (0U); return (0U);
#endif
} }
/** nRESET I/O pin: Set Output. /** nRESET I/O pin: Set Output.
@@ -469,7 +473,11 @@ __STATIC_FORCEINLINE uint32_t PIN_nRESET_IN (void) {
- 1: release device hardware reset. - 1: release device hardware reset.
*/ */
__STATIC_FORCEINLINE void PIN_nRESET_OUT (uint32_t bit) { __STATIC_FORCEINLINE void PIN_nRESET_OUT (uint32_t bit) {
; #ifdef PROBE_PIN_RESET
probe_assert_reset(!!bit);
#else
(void) bit;
#endif
} }
///@} ///@}

View File

@@ -38,7 +38,7 @@
/* Include CDC interface to bridge to target UART. Omit if not used. */ /* Include CDC interface to bridge to target UART. Omit if not used. */
#define PROBE_CDC_UART #define PROBE_CDC_UART
/* Target reset GPIO (active-low). Omit if not used.*/ /* Target reset GPIO (active-low). Omit if not used.*/
#define PROBE_PIN_RESET 0 #define PROBE_PIN_RESET 1
#define PROBE_SM 0 #define PROBE_SM 0
#define PROBE_PIN_OFFSET 12 #define PROBE_PIN_OFFSET 12

View File

@@ -35,7 +35,9 @@
#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 0 #if false
#define PROBE_PIN_RESET 1
#endif
// UART config // UART config
#define PICOPROBE_UART_TX 4 #define PICOPROBE_UART_TX 4

View File

@@ -139,7 +139,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 %d micros %d interval %u\n", picoprobe_info("New baud rate %ld micros %ld interval %lu\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();

View File

@@ -99,6 +99,7 @@ int main(void) {
tusb_init(); tusb_init();
DAP_Setup(); DAP_Setup();
stdio_uart_init();
led_init(); led_init();

View File

@@ -26,21 +26,39 @@
#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...) printf(format, ## args) #define picoprobe_info(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...) printf(format, ## args) #define picoprobe_debug(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...) printf(format, ## args) #define picoprobe_dump(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

View File

@@ -76,6 +76,15 @@ void probe_assert_reset(bool state)
#endif #endif
} }
int probe_reset_level(void)
{
#if defined(PROBE_PIN_RESET)
return gpio_get(PROBE_PIN_RESET);
#else
return 0;
#endif
}
typedef enum probe_pio_command { typedef enum probe_pio_command {
CMD_WRITE = 0, CMD_WRITE = 0,
CMD_SKIP, CMD_SKIP,

View File

@@ -46,5 +46,7 @@ void probe_write_mode(void);
void probe_init(void); void probe_init(void);
void probe_deinit(void); void probe_deinit(void);
void probe_assert_reset(bool state);
int probe_reset_level(void);
#endif #endif

View File

@@ -48,7 +48,7 @@ tusb_desc_device_t const desc_device =
.idVendor = 0x2E8A, // Pi .idVendor = 0x2E8A, // Pi
.idProduct = 0x000c, // CMSIS-DAP Debug Probe .idProduct = 0x000c, // CMSIS-DAP Debug Probe
.bcdDevice = 0x0101, // Version 01.01 .bcdDevice = 0x0103, // Version 01.03
.iManufacturer = 0x01, .iManufacturer = 0x01,
.iProduct = 0x02, .iProduct = 0x02,
.iSerialNumber = 0x03, .iSerialNumber = 0x03,