Skip to content

Commit d47b308

Browse files
committed
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
1 parent 6473166 commit d47b308

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

include/board_pico_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#define PROBE_PIN_SWCLK (PROBE_PIN_OFFSET + 0) // 2
3636
#define PROBE_PIN_SWDIO (PROBE_PIN_OFFSET + 1) // 3
3737
// Target reset config
38-
#define PROBE_PIN_RESET 0
38+
#define PROBE_PIN_RESET 1
3939

4040
// UART config
4141
#define PICOPROBE_UART_TX 4

src/cdc_uart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* line_coding)
139139
vTaskSuspend(uart_taskhandle);
140140
interval = MAX(1, micros / ((1000 * 1000) / configTICK_RATE_HZ));
141141
debounce_ticks = MAX(1, configTICK_RATE_HZ / (interval * DEBOUNCE_MS));
142-
picoprobe_info("New baud rate %d micros %d interval %u\n",
142+
picoprobe_info("New baud rate %ld micros %ld interval %lu\n",
143143
line_coding->bit_rate, micros, interval);
144144
uart_deinit(PICOPROBE_UART_INTERFACE);
145145
tud_cdc_write_clear();

src/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ int main(void) {
9999
tusb_init();
100100

101101
DAP_Setup();
102+
stdio_uart_init();
102103

103104
led_init();
104105

src/picoprobe_config.h

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,39 @@
2626
#ifndef PICOPROBE_H_
2727
#define PICOPROBE_H_
2828

29+
#include "FreeRTOS.h"
30+
#include "task.h"
31+
2932
#if false
30-
#define picoprobe_info(format,args...) printf(format, ## args)
33+
#define picoprobe_info(format,args...) \
34+
do { \
35+
vTaskSuspendAll(); \
36+
printf(format, ## args); \
37+
xTaskResumeAll(); \
38+
} while (0)
3139
#else
3240
#define picoprobe_info(format,...) ((void)0)
3341
#endif
3442

3543

3644
#if false
37-
#define picoprobe_debug(format,args...) printf(format, ## args)
45+
#define picoprobe_debug(format,args...) \
46+
do { \
47+
vTaskSuspendAll(); \
48+
printf(format, ## args); \
49+
xTaskResumeAll(); \
50+
} while (0)
3851
#else
3952
#define picoprobe_debug(format,...) ((void)0)
4053
#endif
4154

4255
#if false
43-
#define picoprobe_dump(format,args...) printf(format, ## args)
56+
#define picoprobe_dump(format,args...)\
57+
do { \
58+
vTaskSuspendAll(); \
59+
printf(format, ## args); \
60+
xTaskResumeAll(); \
61+
} while (0)
4462
#else
4563
#define picoprobe_dump(format,...) ((void)0)
4664
#endif

0 commit comments

Comments
 (0)