PCB Top Side Placement
Inspect board outline, stackup, footprints, and fixed constraints
Confirm top-side placement plan and edge assignments
Place all components on the top side and resolve placement violations
Run independent placement and DRC verification
Middlewares/Qorvo_DW3xxx/ and implement only the platform callbacks in Core/Src/dw3xxx_port.c.Table
| Function/net | U1 pin | HAL configuration | Connected device |
|---|---|---|---|
| TX_SPI_SCK | PA5 | SPI1_SCK AF5 | U2 SPICLK |
| TX_SPI_MISO | PA6 | SPI1_MISO AF5 | U2 SPIMISO |
| TX_SPI_MOSI | PA7 | SPI1_MOSI AF5 | U2 SPIMOSI |
| TX_SPI_CSN | PA4 | GPIO output, default HIGH | U2 SPICSn; external 10 kΩ pull-up |
| TX_UWB_IRQ | PC4 | EXTI rising-edge input | U2 GPIO8/IRQ; also J4-7 |
| TX_UWB_RSTN | PD0 | GPIO open-drain; release = input/high-Z | U2 RSTn |
| TX_UWB_WAKE | PD2 | GPIO output, default LOW | U2 WAKEUP; external 100 kΩ pull-down |
| TX_UWB_SYNC | PA0 | GPIO/timer function as required | U2 GPIO0; TP4; J4-5 |
| RX_SPI_SCK | PB10 | SPI2_SCK AF5 | U3 SPICLK |
| RX_SPI_MISO | PB14 | SPI2_MISO AF5 | U3 SPIMISO |
| RX_SPI_MOSI | PB15 | SPI2_MOSI AF5 | U3 SPIMOSI |
| RX_SPI_CSN | PB9 | GPIO output, default HIGH | U3 SPICSn; external 10 kΩ pull-up |
| RX_UWB_IRQ | PC5 | EXTI rising-edge input | U3 GPIO8/IRQ; also J4-8 |
| RX_UWB_RSTN | PD1 | GPIO open-drain; release = input/high-Z | U3 RSTn |
| RX_UWB_WAKE | PD3 | GPIO output, default LOW | U3 WAKEUP; external 100 kΩ pull-down |
| RX_UWB_SYNC | PA1 | GPIO/timer function as required | U3 GPIO0; TP5; J4-6 |
| HOST_UART_TX | PB6 | USART1_TX AF7 | J3-3 |
| HOST_UART_RX | PB7 | USART1_RX AF7 | J3-4 |
| HOST_IRQ | PB8 | GPIO output, default LOW | J3-5 |
| HOST_READY | PB11 | GPIO input | J3-6 |
| HOST_SPI_SCK | PC10 | SPI3_SCK AF6 | J3-7, optional |
| HOST_SPI_MISO | PC11 | SPI3_MISO AF6 | J3-8, optional |
| HOST_SPI_MOSI | PC12 | SPI3_MOSI AF6 | J3-9, optional |
| HOST_SPI_CSN | PA15 | GPIO/alternate NSS as selected | J3-10, optional |
| DEBUG_UART_TX | PD8 | USART3_TX AF7 | J4-3 |
| DEBUG_UART_RX | PD9 | USART3_RX AF7 | J4-4 |
| STATUS_LED_DRV | PE3 | GPIO output | R11/LED2; active level must be confirmed on assembled board |
| 3V3_PG | none | Not connected to U1 | U4 PG is exposed only at J4-10 |
| SWDIO | PA13 | SWD | J2-2 |
| SWCLK | PA14 | SWD | J2-4 |
| SWO | PB3 | TRACE_SWO | J2-6 |
| MCU_NRST | NRST | hardware reset | J2-10, J4-9, TP6, SW1 |
| MCU_BOOT0 | BOOT0 | hardware boot strap | 10 kΩ pull-down; SW2 raises to 3V3 |
| HSE_IN/HSE_OUT | PH0/PH1 | RCC HSE crystal | Y1 STDCRA3-8M, C19/C20 10 pF |
C
static void uwb_reset_assert(GPIO_TypeDef *port, uint16_t pin) { GPIO_InitTypeDef g = {0}; HAL_GPIO_WritePin(port, pin, GPIO_PIN_RESET); g.Pin = pin; g.Mode = GPIO_MODE_OUTPUT_OD; g.Pull = GPIO_NOPULL; g.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(port, &g); } static void uwb_reset_release(GPIO_TypeDef *port, uint16_t pin) { GPIO_InitTypeDef g = {0}; g.Pin = pin; g.Mode = GPIO_MODE_INPUT; /* high-Z release; never force high */ g.Pull = GPIO_NOPULL; HAL_GPIO_Init(port, &g); }
Text
Core/Inc/app_config.h Core/Inc/uwb_radio.h Core/Inc/radar_pipeline.h Core/Inc/host_protocol.h Core/Src/main.c Core/Src/uwb_radio.c Core/Src/dw3xxx_port.c Core/Src/radar_pipeline.c Core/Src/host_protocol.c Middlewares/Qorvo_DW3xxx/ # vendor-supported driver, not generated here
C
typedef enum { RADIO_TX = 0, RADIO_RX = 1 } radio_id_t; typedef struct { SPI_HandleTypeDef *spi; GPIO_TypeDef *cs_port; uint16_t cs_pin; GPIO_TypeDef *rst_port; uint16_t rst_pin; GPIO_TypeDef *wake_port; uint16_t wake_pin; } uwb_bus_t; bool qdw_platform_init(radio_id_t id, const uwb_bus_t *bus); bool qdw_probe_device(radio_id_t id); /* vendor API identity check */ bool qdw_configure_channel5(radio_id_t id); /* documented vendor config */ bool qdw_start_tx_probe(radio_id_t id, uint32_t sequence); bool qdw_arm_rx(radio_id_t id); bool qdw_irq_service(radio_id_t id, uint32_t *events); bool qdw_read_packet_metadata(radio_id_t id, void *dst, size_t len); bool qdw_read_cir_window(radio_id_t id, int32_t *iq_interleaved, size_t complex_samples);
dw3xxx_port.c owns CS assertion/deassertion, HAL SPI/DMA transfers, reset/wake timing hooks, critical sections, and delays. The vendor driver owns all device register definitions and documented initialization/configuration sequences.C
int main(void) { HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); /* CS high, WAKE low, HOST_IRQ low */ MX_DMA_Init(); MX_SPI1_Init(); MX_SPI2_Init(); MX_USART1_UART_Init(); MX_USART3_UART_Init(); /* MX_SPI3_Init(); optional, enable only when host contract is fixed */ radar_pipeline_init(); app_radios_init(); for (;;) { app_service_radio_events(); radar_pipeline_process_ready_frames(); host_service_tx(); host_service_rx(); app_watchdog_service(); } }
C
static volatile bool tx_irq_pending, rx_irq_pending; void HAL_GPIO_EXTI_Callback(uint16_t pin) { if (pin == TX_UWB_IRQ_Pin) tx_irq_pending = true; if (pin == RX_UWB_IRQ_Pin) rx_irq_pending = true; } void app_service_radio_events(void) { uint32_t events; if (tx_irq_pending) { tx_irq_pending = false; if (!qdw_irq_service(RADIO_TX, &events)) fault_set(FAULT_TX_RADIO); } if (rx_irq_pending) { rx_irq_pending = false; if (!qdw_irq_service(RADIO_RX, &events)) fault_set(FAULT_RX_RADIO); /* On a documented RX-good/packet event, queue metadata + CIR read. */ } }
qdw_read_cir_window() is implemented against the chosen Qorvo API.C
#define CIR_BINS 256u #define AVG_FRAMES 16u #define BG_ALPHA_Q15 512u /* provisional algorithm parameter; tune experimentally */ typedef struct { uint32_t sequence; uint32_t timestamp_us; int32_t iq[2u * CIR_BINS]; } cir_frame_t; typedef struct { int64_t sum_i[CIR_BINS], sum_q[CIR_BINS]; int32_t background[CIR_BINS]; uint16_t count; } radar_state_t; static radar_state_t radar; bool capture_packet_cir(uint32_t seq, cir_frame_t *f) { f->sequence = seq; f->timestamp_us = app_time_us(); return qdw_read_packet_metadata(RADIO_RX, &f->sequence, sizeof(f->sequence)) && qdw_read_cir_window(RADIO_RX, f->iq, CIR_BINS); } void radar_accumulate(const cir_frame_t *f) { for (size_t k = 0; k < CIR_BINS; ++k) { radar.sum_i[k] += f->iq[2u*k]; radar.sum_q[k] += f->iq[2u*k + 1u]; } radar.count++; } typedef struct { uint32_t sequence; uint32_t timestamp_us; uint16_t dominant_bin; uint16_t confidence_q15; uint32_t motion_energy; uint32_t fault_flags; } processed_result_t; bool radar_finish_average(uint32_t seq, uint32_t ts, processed_result_t *out) { if (radar.count < AVG_FRAMES) return false; uint64_t best = 0, total = 0; uint16_t best_bin = 0; for (size_t k = 0; k < CIR_BINS; ++k) { int32_t ai = (int32_t)(radar.sum_i[k] / radar.count); int32_t aq = (int32_t)(radar.sum_q[k] / radar.count); uint32_t mag = (uint32_t)((int64_t)ai*ai + (int64_t)aq*aq); int32_t residual = (int32_t)mag - radar.background[k]; uint32_t energy = (uint32_t)(residual < 0 ? -residual : residual); radar.background[k] += (int32_t)(((int64_t)BG_ALPHA_Q15 * residual) >> 15); total += energy; if (energy > best) { best = energy; best_bin = (uint16_t)k; } radar.sum_i[k] = radar.sum_q[k] = 0; } radar.count = 0; out->sequence = seq; out->timestamp_us = ts; out->dominant_bin = best_bin; out->motion_energy = (uint32_t)(total > UINT32_MAX ? UINT32_MAX : total); out->confidence_q15 = total ? (uint16_t)((best << 15) / total) : 0; out->fault_flags = fault_get(); return true; }
C
#define RESULT_MAGIC 0x5257u /* 'WR' little-endian on wire */ typedef struct __attribute__((packed)) { uint16_t magic; uint8_t version; uint8_t length; processed_result_t result; uint16_t crc16; } host_result_frame_t;
Scope and Source of Truth
Toolchain
Actual MCU Pin Map
Connector Maps
CubeMX Configuration
Reset Control Requirement
Suggested Source Tree
Qorvo Driver Integration Boundary
HAL Initialization Structure
IRQ and DMA Pattern
Frame and Processing Pipeline Skeleton
Processed Host Result Message
Startup Sequence
Boot and Recovery
Open Firmware Items