show PICOPROBE_LED_TARGET_TX on debug probe

output board on startup
This commit is contained in:
Hardy Griech
2023-04-17 22:39:46 +02:00
parent 3590ff9049
commit c3ed78423d
8 changed files with 73 additions and 18 deletions

View File

@@ -9,7 +9,8 @@
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// This header may be included by other board headers as "boards/pico.h"
// This header may be included by other board headers as "boards/pico.h".
// But normally this is included via "#include <pico/stdlib.h>" if PICO_BOARD is set accordingly.
#ifndef _BOARDS_PICO_H
#define _BOARDS_PICO_H

View File

@@ -9,7 +9,8 @@
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// This header may be included by other board headers as "boards/pico_debug_probe.h"
// This header may be included by other board headers as "boards/pico_debug_probe.h".
// But normally this is included via "#include <pico/stdlib.h>" if PICO_BOARD is set accordingly.
// Schematic: https://datasheets.raspberrypi.com/debug/raspberry-pi-debug-probe-schematics.pdf
#ifndef _BOARDS_PICO_DEBUG_PROBE_H
@@ -47,6 +48,8 @@
#define PICOPROBE_LED PICO_DEFAULT_LED_PIN
#define PICOPROBE_LED_CONNECTED 15
#define PICOPROBE_LED_RUNNING 16
#define PICOPROBE_LED_TARGET_RX 7 // host -> probe -> target UART / RTT data, i.e. target is receiving
#define PICOPROBE_LED_TARGET_TX 8 // target -> probe -> host UART / RTT data, i.e. target is transmitting
// PIO config
#define PROBE_PIO pio0

View File

@@ -9,7 +9,8 @@
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------
// This header may be included by other board headers as "boards/pico.h"
// This header may be included by other board headers as "boards/pico.h".
// But normally this is included via "#include <pico/stdlib.h>" if PICO_BOARD is set accordingly.
#ifndef _BOARDS_PICO_W_H
#define _BOARDS_PICO_W_H

View File

@@ -222,7 +222,7 @@ void on_uart_rx(void)
}
if (cnt != 0) {
led_state(LS_UART_DATA);
led_state(LS_UART_RX_DATA);
cdc_uart_put_into_stream(buf, cnt, true);
}

View File

@@ -33,6 +33,7 @@
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "picoprobe_config.h"
#include "led.h"
@@ -41,14 +42,50 @@
static TaskHandle_t task_led;
static bool msc_connected;
static bool dapv1_connected;
static bool dapv2_connected;
static led_state_t sigrok_state;
static bool target_found;
static unsigned rtt_flash_cnt;
static uint64_t uart_data_trigger;
static uint64_t rtt_data_trigger;
static bool msc_connected;
static bool dapv1_connected;
static bool dapv2_connected;
static led_state_t sigrok_state;
static bool target_found;
static unsigned rtt_flash_cnt;
static uint64_t uart_data_trigger;
static uint64_t rtt_data_trigger;
#ifdef PICOPROBE_LED_TARGET_TX
static TimerHandle_t timer_led_tx_off;
static void *timer_led_tx_off_id;
static void led_tx_off(TimerHandle_t xTimer)
{
gpio_put(PICOPROBE_LED_TARGET_TX, false);
}
static void rx_data_from_target(void)
{
static bool initialized;
if ( !initialized) {
initialized = true;
gpio_init(PICOPROBE_LED_TARGET_TX);
gpio_set_dir(PICOPROBE_LED_TARGET_TX, GPIO_OUT);
}
gpio_put(PICOPROBE_LED_TARGET_TX, true);
xTimerReset(timer_led_tx_off, 10);
} // rx_data_from_target
static void rx_data_from_target_init(void)
{
timer_led_tx_off = xTimerCreate("led_tx_off", pdMS_TO_TICKS(5), pdFALSE, timer_led_tx_off_id, led_tx_off);
} // rx_data_from_target_init
#else
#define rx_data_from_target()
#define led_tx_off_init()
#endif
@@ -149,7 +186,7 @@ void led_thread(void *ptr)
vTaskDelay(pdMS_TO_TICKS(200));
}
led(0);
vTaskDelay(pdMS_TO_TICKS(1000 - rtt_flash_cnt * 220));
vTaskDelay(pdMS_TO_TICKS(1000 - flash_cnt * 220));
}
}
} // led_thread
@@ -205,12 +242,14 @@ void led_state(led_state_t state)
rtt_flash_cnt = 2;
break;
case LS_RTT_DATA:
case LS_RTT_RX_DATA:
rtt_data_trigger = time_us_64();
rx_data_from_target();
break;
case LS_UART_DATA:
case LS_UART_RX_DATA:
uart_data_trigger = time_us_64();
rx_data_from_target();
break;
case LS_SIGROK_WAIT:
@@ -235,5 +274,7 @@ void led_init(uint32_t task_prio)
led(1);
rx_data_from_target_init();
xTaskCreateAffinitySet(led_thread, "LED", configMINIMAL_STACK_SIZE, NULL, task_prio, 1, &task_led);
} // led_init

View File

@@ -34,8 +34,8 @@ typedef enum _led_state {
LS_TARGET_FOUND, // there is a target
LS_NO_TARGET, // no target found
LS_RTT_CB_FOUND, // found an RTT control block on target
LS_RTT_DATA, // RTT data received from target
LS_UART_DATA, // UART data received from target
LS_RTT_RX_DATA, // RTT data received from target
LS_UART_RX_DATA, // UART data received from target
LS_MSC_CONNECTED, // MSC connected
LS_MSC_DISCONNECTED, // MSC disconnected
LS_DAPV1_CONNECTED, // DAPV1 connected

View File

@@ -515,6 +515,15 @@ int main(void)
picoprobe_info_out(" [DAPLink MSC]");
#endif
picoprobe_info_out("\n");
#if defined(TARGET_BOARD_PICO)
picoprobe_info(" Probe HW: Pico\n");
#elif defined(TARGET_BOARD_PICO_W)
picoprobe_info(" Probe HW: Pico_W\n");
#elif defined(TARGET_BOARD_PICO_DEBUG_PROBE)
picoprobe_info(" Probe HW: Pico Debug Probe\n");
#else
picoprobe_info(" Running on UNKNOWN board\n");
#endif
picoprobe_info("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
events = xEventGroupCreate();

View File

@@ -159,7 +159,7 @@ static void do_rtt_console(uint32_t rtt_cb)
// put received data into CDC UART
cdc_uart_write(buf, cnt);
led_state(LS_RTT_DATA);
led_state(LS_RTT_RX_DATA);
}
}
} // do_rtt_console