|
| 1 | +/* |
| 2 | + * RadioMaster Nexus (Original) - iNAV target |
| 3 | + * |
| 4 | + * Based on the NEXUSX target by functionpointer, adapted for the |
| 5 | + * original (discontinued) Nexus hardware. |
| 6 | + * |
| 7 | + * Key differences from Nexus-X/XR: |
| 8 | + * - IMU EXTI on PA15 (X/XR uses PB8) |
| 9 | + * - IMU alignment CW180 (Rotorflight uses CW90 with a different |
| 10 | + * board orientation reference; iNAV uses the arrow on the case) |
| 11 | + * - Flash is W25N01G 128MB (X/XR uses W25N02K 256MB) |
| 12 | + * - No internal ELRS receiver (X/XR has RP4TD-M on UART5) |
| 13 | + * - No PINIO1 receiver power gate |
| 14 | + * - Voltage input 5-12.6V (X/XR supports 3.6-70V) |
| 15 | + * - 5 servo/motor outputs vs 7-9 on X/XR |
| 16 | + * - Baro on I2C1 (PB8/PB9), not I2C2 |
| 17 | + * - UART1 on PA9/PA10, not PB6/PB7 |
| 18 | + * |
| 19 | + * Pin mapping derived from: |
| 20 | + * - Rotorflight NEXUS_F7 target (authoritative) |
| 21 | + * - groundflight project (joshperry/groundflight) |
| 22 | + * - RadioMaster documentation |
| 23 | + */ |
| 24 | + |
| 25 | +#pragma once |
| 26 | + |
| 27 | +#define TARGET_BOARD_IDENTIFIER "NEXS" |
| 28 | +#define USBD_PRODUCT_STRING "RadioMaster Nexus" |
| 29 | + |
| 30 | +/* ---- LEDs ---- */ |
| 31 | +#define LED0 PC14 // active low |
| 32 | +#define LED1 PC15 // active low |
| 33 | + |
| 34 | +/* ---- Beeper ---- */ |
| 35 | +// No dedicated beeper pin on Nexus hardware |
| 36 | + |
| 37 | +/* ---- SPI ---- */ |
| 38 | +#define USE_SPI |
| 39 | +#define USE_SPI_DEVICE_1 |
| 40 | +#define SPI1_SCK_PIN PA5 |
| 41 | +#define SPI1_MISO_PIN PA6 |
| 42 | +#define SPI1_MOSI_PIN PA7 |
| 43 | + |
| 44 | +#define USE_SPI_DEVICE_2 |
| 45 | +#define SPI2_SCK_PIN PB13 |
| 46 | +#define SPI2_MISO_PIN PB14 |
| 47 | +#define SPI2_MOSI_PIN PB15 |
| 48 | + |
| 49 | +/* ---- IMU: ICM-42688-P ---- */ |
| 50 | +// iNAV uses ICM42605 driver which is register-compatible with ICM42688P |
| 51 | +#define USE_IMU_ICM42605 |
| 52 | +#define IMU_ICM42605_ALIGN CW180_DEG |
| 53 | +#define ICM42605_CS_PIN PA4 |
| 54 | +#define ICM42605_SPI_BUS BUS_SPI1 |
| 55 | +#define ICM42605_EXTI_PIN PA15 |
| 56 | + |
| 57 | +/* ---- I2C ---- */ |
| 58 | +// I2C1: PB8/PB9 - internal, used for barometer |
| 59 | +#define USE_I2C |
| 60 | +#define USE_I2C_DEVICE_1 |
| 61 | +#define I2C1_SCL PB8 |
| 62 | +#define I2C1_SDA PB9 |
| 63 | + |
| 64 | +// I2C2: PB10/PB11 - external via Port C connector (shared with UART3) |
| 65 | +// Available for external sensors (magnetometer, rangefinder, etc.) |
| 66 | +#define USE_I2C_DEVICE_2 |
| 67 | +#define I2C2_SCL PB10 |
| 68 | +#define I2C2_SDA PB11 |
| 69 | +#define I2C_DEVICE_2_SHARES_UART3 |
| 70 | + |
| 71 | +/* ---- Barometer: SPL06-001 ---- */ |
| 72 | +// Confirmed on I2C1 per Rotorflight NEXUS_F7 dump |
| 73 | +#define USE_BARO |
| 74 | +#define USE_BARO_SPL06 |
| 75 | +#define BARO_I2C_BUS BUS_I2C1 |
| 76 | + |
| 77 | +/* ---- Magnetometer (external, optional via Port C / I2C2) ---- */ |
| 78 | +#define USE_MAG |
| 79 | +#define USE_MAG_ALL |
| 80 | +#define MAG_I2C_BUS BUS_I2C2 |
| 81 | + |
| 82 | +/* ---- Flash: W25N01G (128MB) ---- */ |
| 83 | +#define USE_FLASHFS |
| 84 | +#define USE_FLASH_W25N01G |
| 85 | +#define W25N01G_SPI_BUS BUS_SPI2 |
| 86 | +#define W25N01G_CS_PIN PB12 |
| 87 | +#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT |
| 88 | + |
| 89 | +/* ---- UARTs ---- */ |
| 90 | +// OG Nexus UART layout (confirmed from Rotorflight NEXUS_F7 dump): |
| 91 | +// UART1 [DSM port] : PA9 (TX) / PA10 (RX) |
| 92 | +// UART2 [SBUS/FREQ] : PA2 (TX) / PA3 (RX) - shared with RPM/TLM pins |
| 93 | +// UART3 [Port C] : PB11 (TX) / PB10 (RX) - shared with I2C2 |
| 94 | +// UART4 [Port A] : PA1 (TX) / PA0 (RX) - primary CRSF receiver |
| 95 | +// UART6 [Port B] : PC7 (TX) / PC6 (RX) |
| 96 | +// |
| 97 | +// NOTE: No UART5 on OG Nexus (X/XR uses UART5 for internal ELRS) |
| 98 | + |
| 99 | +#define USE_VCP |
| 100 | +#define USE_USB_DETECT |
| 101 | +#define USB_DETECT_PIN NONE |
| 102 | + |
| 103 | +#define USE_UART1 |
| 104 | +#define UART1_TX_PIN PA9 |
| 105 | +#define UART1_RX_PIN PA10 |
| 106 | + |
| 107 | +#define USE_UART2 |
| 108 | +#define UART2_TX_PIN PA2 |
| 109 | +#define UART2_RX_PIN PA3 |
| 110 | + |
| 111 | +#define USE_UART3 |
| 112 | +#define UART3_TX_PIN PB11 |
| 113 | +#define UART3_RX_PIN PB10 |
| 114 | + |
| 115 | +#define USE_UART4 |
| 116 | +#define USE_UART4_SWAP |
| 117 | +#define UART4_TX_PIN PA1 |
| 118 | +#define UART4_RX_PIN PA0 |
| 119 | + |
| 120 | +#define USE_UART6 |
| 121 | +#define UART6_TX_PIN PC7 |
| 122 | +#define UART6_RX_PIN PC6 |
| 123 | + |
| 124 | +#define SERIAL_PORT_COUNT 6 // VCP + UART1-4 + UART6 |
| 125 | + |
| 126 | +/* ---- Default serial receiver ---- */ |
| 127 | +#define DEFAULT_RX_TYPE RX_TYPE_SERIAL |
| 128 | +#define SERIALRX_PROVIDER SERIALRX_CRSF |
| 129 | +#define SERIALRX_UART SERIAL_PORT_USART4 |
| 130 | + |
| 131 | + |
| 132 | +/* ---- ADC ---- */ |
| 133 | +// OG Nexus has no EXT-V input (unlike X/XR which has a dedicated |
| 134 | +// high-voltage sense on PC0). Only two ADC channels: |
| 135 | +// ADC_BUS = PC2, divider 320 (Vin rail, 5-12.6V) |
| 136 | +// ADC_BEC = PC1, divider 160 (BEC 5V rail) |
| 137 | +// Map Vin as VBAT since it's the primary power input |
| 138 | +#define USE_ADC |
| 139 | +#define ADC_INSTANCE ADC1 |
| 140 | +#define ADC_CHANNEL_1_PIN PC2 // Vin (input power rail) |
| 141 | +#define VBAT_ADC_CHANNEL ADC_CHN_1 |
| 142 | +#define ADC_CHANNEL_2_PIN PC1 // BEC 5V rail |
| 143 | +// VBAT scale: hardware-verified value (divider ratio ~320) |
| 144 | +#define VBAT_SCALE_DEFAULT 320 |
| 145 | + |
| 146 | +/* ---- Sensors ---- */ |
| 147 | +#define SENSORS_SET (SENSOR_ACC | SENSOR_BARO) |
| 148 | + |
| 149 | +/* ---- PWM / Servo / Motor outputs ---- */ |
| 150 | +// OG Nexus outputs (from Rotorflight dump): |
| 151 | +// S1: PB4 (TIM3_CH1) - Servo header |
| 152 | +// S2: PB5 (TIM3_CH2) - Servo header |
| 153 | +// S3: PB0 (TIM3_CH3) - Servo header |
| 154 | +// S4: PB3 (TIM2_CH2) - Servo header (Tail) |
| 155 | +// M1: PB6 (TIM4_CH1) - ESC header (motor only, NOT UART1) |
| 156 | +// |
| 157 | +// Pin multiplexing when UARTs freed: |
| 158 | +// PA2 (TIM5_CH3) - shared with UART2 TX / FREQ input |
| 159 | +// PA3 (TIM9_CH2) - shared with UART2 RX / PPM input |
| 160 | + |
| 161 | +#define MAX_PWM_OUTPUT_PORTS 7 |
| 162 | + |
| 163 | +/* ---- No internal receiver ---- */ |
| 164 | +// OG Nexus has no internal ELRS receiver. |
| 165 | +// No UART5, no PINIO1 power gate. |
| 166 | + |
| 167 | +/* ---- Platform ---- */ |
| 168 | +#define USE_SERIAL_4WAY_BLHELI_INTERFACE |
| 169 | +#define TARGET_IO_PORTA 0xffff |
| 170 | +#define TARGET_IO_PORTB 0xffff |
| 171 | +#define TARGET_IO_PORTC 0xffff |
| 172 | + |
| 173 | +#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX) |
0 commit comments