diff --git a/hardware/sb-lora/REV2.md b/hardware/sb-lora/REV2.md index 27a03b5..235dd5a 100644 --- a/hardware/sb-lora/REV2.md +++ b/hardware/sb-lora/REV2.md @@ -26,7 +26,7 @@ The XIAO nRF52840 and the Wio-SX1262 board keep their roles but sit flat on the | D8 / D9 / D10 | SCK / MISO / MOSI | Wio | | D6 / D7 | UART TX / RX | Visor bridge (as rev 1), not the Wio | | 3V3, GND | power | Wio and the XIAO-side level translators | - | D0 | free | | + | D0 | VISOR_PRESENT | slot power sensed through a translator, as rev 1 | - The antenna is the Wio's existing flexible stick-on antenna on its u.FL. It goes inside the module case. @@ -36,7 +36,7 @@ A 16-bit-wide 3.3 V NOR flash at the start of csSlot0 (CS0*), as the Springboard - Candidates: Infineon S29AL016J or SST39VF1601C (2 MB, x16, 70 ns, TSOP-48, 1.2 mm), whichever the Flash Manager drivers handle. Room for the app and the Map basemap. - WE* is wired so the app can rewrite the flash itself: HotSync a new .prc to RAM, then update the module from the app. -- A write-protect jumper. +- A write-protect jumper: JP2 in the WE# line, bridged by default, cut to protect. - Software: only the app's own code and resources are read-only when it runs from the module. Checked: all of its data (channels, contacts, messages, beam inbox, screenshots, map) is in RAM databases on card 0, and it never writes to its own database, so nothing changes. To keep the Map basemap in flash too, `map_form.c` must also look on card 1. The alarms (`bgcheck.c`, `sb_spi.c`) point at the app's database, and they go away with the module, which is fine because the radio does too. - Getting the app onto the flash, all from the Visor, with no chip programmer: 1. `make rom` on the Mac builds a module image with VisorMesh in it, following Handspring's MakeROM (its source is in `Handspring_SDK.zip`: `Handspring Tools/MakeROM/Src`). @@ -45,7 +45,7 @@ A 16-bit-wide 3.3 V NOR flash at the start of csSlot0 (CS0*), as the Springboard - A blank or bad image has no valid header, so the module looks like rev 1 (hardware present, nothing mounted) and the updater can still write it. The first programming works the same way. - Handspring's Flash Manager source (same zip, `FlashManager Resources`) has drivers for AMD-style (29LV160 family) and SST 4 KB-sector parts. Pick a chip it supports, or add its ID to the table. Infineon S29AL016J is the in-production 29LV160 equivalent. - To check: what the launcher does when VisorMesh is in both RAM and the module during development. -- Alternative: a small Welcome app on the flash that copies VisorMesh into RAM when it's missing or older, so the app runs from RAM exactly as it does now. +- **Decided: the flash holds a small installer, and VisorMesh runs from RAM.** The Dev Guide (§1.5) says a module whose code installs interrupt handlers needs a Setup app, or the Visor soft-resets when the module is pulled, because the handler's code goes with it. VisorMesh's SB-LoRa transport installs one. So the flash's Welcome app copies VisorMesh into RAM when it's missing or older, and launches it; the app then runs exactly as it does now. This also settles the RAM-and-module question above. This takes CS0*, so the radio link moves to csSlot1 (CS1*). The flash needs about 20 address lines and all 16 data lines, so rev 2 is expected to be a 4-layer board. @@ -53,9 +53,9 @@ This takes CS0*, so the radio link moves to csSlot1 (CS1*). The flash needs abou A 16550-style UART on csSlot1 replaces rev 1's SC16IS740 SPI bridge and its latch logic (U1-U3). The flash already needs the full address and data bus, so the UART costs little routing, and each register access is one bus cycle instead of several per SPI bit. -- Part: NXP SC16C550B, SC16C650B or SC16C750B (16, 32 or 64-byte FIFOs, 3.3 V). Prefer the biggest FIFO that JLC stocks: at 115200 baud a 16-byte FIFO fills in 1.4 ms. +- Part: NXP SC16C650BIBS (32-byte FIFOs, HVQFN32, LCSC C729132). The SC16C750BIBS (64-byte) has the same HVQFN32 pinout and fits the footprint; the SC16C550B doesn't. At 115200 baud a 32-byte FIFO fills in 2.8 ms. - Wiring: - - CS* from CS1*, RD* from OE*, WR* from WE*. + - Strobes: the slot may assert OE*/WE* at the same moment as CS1* (Dev Guide table 6-2), but the UART wants IOR/IOW 10 ns after its CS. So the UART's CS is tied active and a 74LVC2G32 makes IOR = OE* OR CS1* and IOW = WE* OR CS1*. Nothing else on the bus is affected: the UART only drives the data bus while IOR is low. - Register select A0-A2 of the UART from A1-A3 of the slot, so the registers sit at word addresses. - UART D0-D7 on slot D0-D7. The driver uses 16-bit reads and writes and keeps the low byte (a 68k byte access at an even address uses D8-D15). - The UART's INT and RESET are active high and the slot's IRQ* and RESET* are active low, so a 74LVC2G04 inverts both. @@ -70,7 +70,19 @@ A 16550-style UART on csSlot1 replaces rev 1's SC16IS740 SPI bridge and its latc - **Connector: waiting on the Hirose IC1HA order.** If it ships, rev 2 keeps rev 1's straddle footprint. If it's cancelled, switch to a single-sided SMT PC Card receptacle (both rows of tails on the top side), harvested or stocked (TE 5535657-2 and Amphenol 1C1K are candidates; check they're the card-side receptacle). The Springboard uses the same 68-pin PCMCIA contacts (Dev Guide §5, §7.1), and the keying is in the module's plastic case, not the connector. Needed from a sample: markings, tail pitch, row spacing, tail distance from the mating face, and board surface height relative to the contact centre line. - **Case.** The keying is in the module case, so rev 2 needs a case (printed, or a harvested Springboard shell) whose key and latch match the slot, with the board held at the connector's height. Dry-fit a bare harvested connector in the slot to check the contacts seat fully. - **Board thickness.** The straddle connector forces 1.6 mm; a top-mount one may allow 0.8-1.0 mm. -- **LiPo size** for the bump, about 3-4 mm thick. +- **LiPo size.** The aim is at least a few days per charge. Estimate, to be replaced by a measurement: + - The XIAO and SX1262 listen all the time (MeshCore companion doesn't sleep the radio): roughly 5-6 mA for the SX1262 in receive with boosted gain, plus 1-3 mA for the nRF52840 with the UART open. Transmits at 22 dBm draw about 120 mA but are short at SF10/BW500 and rare for a companion. Call it 7-10 mA on average. + - 3 days at 10 mA is 720 mAh; with margin for usable capacity and ageing, about 1000 mAh. 500 mAh gives about 2 days. + - Flat pouches of that size: about 5 x 30 x 50 mm for 1000 mAh, 4 x 25 x 50 mm for 500-600 mAh. The extension is 50.4 x 24.6 mm, so a 50 mm cell fits across it, under or beside the boards. + - To measure: current into BAT+ with a meter in series, USB unplugged, over a few minutes of idle listening and one message sent. + +## Netlist + +`rev2/netlist.py`, same shape as rev 1's `source/netlist.py` (rev 1 stays as built under `hw-v0.1`). Not laid out yet. Before layout: +- Check the flash's TSOP-48 pin table against the Infineon S29AL016J datasheet (it's written from the standard 29LV160 pinout, which Handspring's flash driver supports). +- Look up LCSC numbers for the flash, 74LVC2G32, 74LVC2G04 and SN74LVC2T45. +- Make footprints for the XIAO (castellated edge plus plated holes under its bottom pads, from Seeed's footprint) and the Wio (14 plated holes). +- J1 stays rev 1's straddle footprint until the connector order is settled. ## Carried over from rev 1 diff --git a/hardware/sb-lora/rev2/netlist.py b/hardware/sb-lora/rev2/netlist.py new file mode 100644 index 0000000..e86836d --- /dev/null +++ b/hardware/sb-lora/rev2/netlist.py @@ -0,0 +1,175 @@ +""" +VisorMesh Springboard module, rev 2: parts and connectivity. Draft: not laid out or built. +Same shape as ../source/netlist.py (rev 1, hw-v0.1), so its board and schematic scripts can be adapted. +See ../REV2.md for the reasons behind each choice. + +Power domains + VSB : Springboard VCC (3.0-3.6 V, 100 mA max), present only while the Visor powers the slot. + 3V3X : XIAO nRF52840 3V3 output, always on (XIAO runs from its own LiPo). +Every signal that crosses VSB <-> 3V3X goes through an SN74LVC1T45/2T45 (Ioff on both ports), +so neither domain can back-power the other. + +Bus (Springboard A[23:0] are byte addresses; every access is 16 bits wide, so A0 is unused) + csSlot0: U1 S29AL016J NOR flash, 1M x 16. Holds the module image (header + installer + app). + Flash A0-A19 = slot A1-A20. WE# goes through JP2 (cut to write-protect). + csSlot1: U2 SC16C650B UART, registers at word addresses (UART A0-A2 = slot A1-A3), data on D0-D7. + The slot allows OE*/WE* at the same moment as CS1* (Dev Guide table 6-2), but the UART + wants its strobe 10 ns after CS. So the UART's CS is tied active and U3 makes the strobes: + IOR = OE* OR CS1*, IOW = WE* OR CS1*. + U4 inverts the UART's active-high INT and RESET against the slot's IRQ* and RESET*. + +Pin tables that still need checking against a datasheet are marked VERIFY. +""" + +# ref: (value, footprint_lib, footprint_name, lcsc, description, dnp) +# An empty LCSC number is still to be looked up. +PARTS = { + "J1": ("Springboard 68p straddle", None, "SPRINGBOARD_68", "", + "Hirose IC1HA-68RD-1.27SH(51); pending the order (REV2.md). Hand-solder", True), + "U1": ("S29AL016J70TFI020", "Package_SO", "TSOP-I-48_18.4x12mm_P0.5mm", "", + "2 MB NOR flash, x16, 70 ns, csSlot0", False), + "U2": ("SC16C650BIBS", "Package_DFN_QFN", "HVQFN-32-1EP_5x5mm_P0.5mm_EP3.45x3.45mm", "C729132", + "UART, 32-byte FIFOs, csSlot1 (SC16C750BIBS fits the same footprint)", False), + "U3": ("74LVC2G32DC", "Package_SO", "VSSOP-8_2.3x2mm_P0.5mm", "", "OR: UART read/write strobes", False), + "U4": ("74LVC2G04GW", "Package_TO_SOT_SMD", "SOT-363_SC-70-6", "", "Inverters: INT -> IRQ*, RESET* -> RESET", False), + "U5": ("SN74LVC2T45DCUR", "Package_SO", "VSSOP-8_2.3x2mm_P0.5mm", "", + "Ioff xlate: UART TX -> XIAO D7, Visor-present -> XIAO D0", False), + "U6": ("SN74LVC1T45DCKR", "Package_TO_SOT_SMD", "SOT-363_SC-70-6", "C9382", "Ioff xlate: XIAO D6 -> UART RX", False), + "Y1": ("14.7456MHz 20pF", "Crystal", "Crystal_SMD_3225-4Pin_3.2x2.5mm", "C2901666", "SX3B14.7456F2010F30", False), + "C1": ("1uF", "Capacitor_SMD", "C_0603_1608Metric", "C15849", "VSB bulk", False), + "C2": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U1 decoupling", False), + "C3": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U2 decoupling", False), + "C4": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U3 decoupling", False), + "C5": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U4 decoupling", False), + "C6": ("22pF C0G", "Capacitor_SMD", "C_0805_2012Metric", "C24658", "Y1 load (FH 0805CG220J500NT)", False), + "C7": ("22pF C0G", "Capacitor_SMD", "C_0805_2012Metric", "C24658", "Y1 load (FH 0805CG220J500NT)", False), + "C8": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U5 VCCA", False), + "C9": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U5 VCCB", False), + "C10": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U6 VCCA", False), + "C11": ("100nF", "Capacitor_SMD", "C_0603_1608Metric", "C14663", "U6 VCCB", False), + "C12": ("1uF", "Capacitor_SMD", "C_0603_1608Metric", "C15849", "3V3X bulk", False), + "R1": ("100k", "Resistor_SMD", "R_0603_1608Metric", "C25803", "XIAO RX idle-high pull-up", False), + "R2": ("100k", "Resistor_SMD", "R_0603_1608Metric", "C25803", "UART RX idle-high pull-up", False), + "R3": ("100k", "Resistor_SMD", "R_0603_1608Metric", "C25803", "Visor-present pull-down", False), + "R4": ("10k", "Resistor_SMD", "R_0603_1608Metric", "C25804", "Flash WE# pull-up (write-protect with JP2 cut)", False), + "D1": ("B5819W", "Diode_SMD", "D_SOD-123", "C8598", "VDOCK -> XIAO VBUS (only if JP1 bridged)", False), + "JP1": ("VDOCK EN", "Jumper", "SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mm", "", "Open by default", False), + "JP2": ("FLASH WE", "Jumper", "SolderJumper-2_P1.3mm_Bridged_RoundedPad1.0x1.5mm", "", + "Bridged by default; cut to write-protect the flash", False), + "X1": ("XIAO nRF52840", None, "XIAO_SMD", "", + "Soldered flat by its castellated pads; bottom pads reached through solder-filled plated holes", True), + "X2": ("Wio-SX1262 for XIAO", None, "WIO_PTH", "", + "Male pins through the carrier, spacer off, cut flush; top socket removed", True), + "BT1": ("LiPo", None, "BAT_PADS", "", "Flat pouch LiPo, solder pads (size in REV2.md)", True), + "TP1": ("SWDIO", "TestPoint", "TestPoint_Pad_D1.0mm", "", "XIAO SWD", True), + "TP2": ("SWCLK", "TestPoint", "TestPoint_Pad_D1.0mm", "", "XIAO SWD", True), + "TP3": ("NRST", "TestPoint", "TestPoint_Pad_D1.0mm", "", "XIAO reset", True), + "TP4": ("GND", "TestPoint", "TestPoint_Pad_D1.0mm", "", "Probe ground", True), +} + +SB_NAMES = { # Table 5-1 of the Springboard Development Guide + 1: "GND", 2: "D3", 3: "D4", 4: "D5", 5: "D6", 6: "D7", 7: "CS0*", 8: "A10", 9: "OE*", 10: "A11", 11: "A9", + 12: "A8", 13: "A13", 14: "A14", 15: "WE*", 16: "IRQ*", 17: "VCC", 18: "VDOCK", 19: "A16", 20: "A15", + 21: "A12", 22: "A7", 23: "A6", 24: "A5", 25: "A4", 26: "A3", 27: "A2", 28: "A1", 29: "A0", 30: "D0", + 31: "D1", 32: "D2", 33: "RSVD", 34: "GND", 35: "GND", 36: "CD1*", 37: "D11", 38: "D12", 39: "D13", + 40: "D14", 41: "D15", 42: "CS1*", 43: "RSVD", 44: "RSVD", 45: "RSVD", 46: "A17", 47: "A18", 48: "A19", + 49: "A20", 50: "A21", 51: "VCC", 52: "VDOCK", 53: "A22", 54: "A23", 55: "RSVD", 56: "RSVD", 57: "RSVD", + 58: "RESET*", 59: "RSVD", 60: "MIC-", 61: "MIC+", 62: "RSVD", 63: "LOWBAT*", 64: "D8", 65: "D9", + 66: "D10", 67: "CD2*", 68: "GND", +} + +# Springboard pin -> net. CD1*/CD2* tied to GND per spec; A0, A21-A23, LOWBAT*, MIC and RSVD unused. +SB = {} +for p, name in SB_NAMES.items(): + if name in ("GND", "CD1*", "CD2*"): + SB[p] = "GND" + elif name == "VCC": + SB[p] = "VSB" + elif name in ("VDOCK",): + SB[p] = name + elif name[0] == "D" and name[1:].isdigit(): + SB[p] = name + elif name[0] == "A" and name[1:].isdigit() and 1 <= int(name[1:]) <= 20: + SB[p] = name + elif name in ("CS0*", "CS1*", "OE*", "WE*", "IRQ*", "RESET*"): + SB[p] = name[:-1] + "_N" + +# (ref, pad) -> net +CONN = {} +for p, n in SB.items(): + CONN[("J1", str(p))] = n + +def c(ref, pad, net): + CONN[(ref, str(pad))] = net + +# U1 S29AL016J, 48-pin TSOP standard pinout (JEDEC 29LV160 layout). VERIFY against the Infineon datasheet. +FLASH_A = {25: 0, 24: 1, 23: 2, 22: 3, 21: 4, 20: 5, 19: 6, 18: 7, 8: 8, 7: 9, 6: 10, 5: 11, 4: 12, + 3: 13, 2: 14, 1: 15, 48: 16, 17: 17, 16: 18, 9: 19} +for pad, bit in FLASH_A.items(): + c("U1", pad, "A%d" % (bit + 1)) # word address: flash A0 = slot A1 +FLASH_DQ = {29: 0, 31: 1, 33: 2, 35: 3, 38: 4, 40: 5, 42: 6, 44: 7, + 30: 8, 32: 9, 34: 10, 36: 11, 39: 12, 41: 13, 43: 14, 45: 15} +for pad, bit in FLASH_DQ.items(): + c("U1", pad, "D%d" % bit) +for pad, net in {11: "WE_FL_N", 12: "RESET_N", 26: "CS0_N", 27: "GND", 28: "OE_N", + 37: "VSB", 46: "GND", 47: "VSB"}.items(): + c("U1", pad, net) # 47 BYTE# high = word mode; 15 RY/BY# open (status is polled); 10, 13, 14 NC +c("JP2", 1, "WE_N"); c("JP2", 2, "WE_FL_N") +c("R4", 1, "VSB"); c("R4", 2, "WE_FL_N") + +# U2 SC16C650B HVQFN32 (NXP datasheet table 2; the SC16C750B matches, the SC16C550B does not). +# CS, IOR, IOW are the active-low inputs in this package. The exposed pad is ground. +for pad, net in {1: "D5", 2: "D6", 3: "D7", 4: "UART_BAUD", 5: "UART_RX", 6: "UART_TX", 7: "GND", + 8: "UART_BAUD", 9: "XTAL1", 10: "XTAL2", 11: "UART_IOW_N", 13: "GND", 14: "UART_IOR_N", + 16: "A3", 17: "A2", 18: "A1", 20: "UART_INT", 24: "UART_RESET", 25: "GND", 26: "GND", + 27: "VSB", 28: "D0", 29: "D1", 30: "D2", 31: "D3", 32: "D4", "EP": "GND"}.items(): + c("U2", pad, net) # 4 RCLK = 8 BAUDOUT; 25 CTS / 26 DSR held asserted; 12 n.c.; 15, 19, 21-23 outputs unused +# Y1 3225 4-pad: 1/3 crystal, 2/4 case +c("Y1", 1, "XTAL1"); c("Y1", 3, "XTAL2"); c("Y1", 2, "GND"); c("Y1", 4, "GND") +c("C6", 1, "XTAL1"); c("C6", 2, "GND"); c("C7", 1, "XTAL2"); c("C7", 2, "GND") +# U3 74LVC2G32 (8-pin): 1 1A, 2 1B, 3 2Y, 4 GND, 5 2A, 6 2B, 7 1Y, 8 VCC +for pad, net in {1: "OE_N", 2: "CS1_N", 7: "UART_IOR_N", 5: "WE_N", 6: "CS1_N", 3: "UART_IOW_N", + 4: "GND", 8: "VSB"}.items(): + c("U3", pad, net) +# U4 74LVC2G04 (SC-70-6): 1 1A, 2 GND, 3 2A, 4 2Y, 5 VCC, 6 1Y +for pad, net in {1: "UART_INT", 6: "IRQ_N", 3: "RESET_N", 4: "UART_RESET", 2: "GND", 5: "VSB"}.items(): + c("U4", pad, net) +# U5 SN74LVC2T45 (VSSOP-8): 1 VCCA, 2 A1, 3 A2, 4 GND, 5 DIR, 6 B2, 7 B1, 8 VCCB. DIR high = A->B +for pad, net in {1: "VSB", 2: "UART_TX", 3: "VSB", 4: "GND", 5: "VSB", 6: "VISOR_PRESENT", 7: "XIAO_RX", + 8: "3V3X"}.items(): + c("U5", pad, net) +# U6 SN74LVC1T45 (SC-70-6): 1 VCCA, 2 GND, 3 A, 4 B, 5 DIR, 6 VCCB. DIR low = B->A +for pad, net in {1: "VSB", 2: "GND", 3: "UART_RX", 4: "XIAO_TX", 5: "GND", 6: "3V3X"}.items(): + c("U6", pad, net) +c("R1", 1, "3V3X"); c("R1", 2, "XIAO_RX") +c("R2", 1, "VSB"); c("R2", 2, "UART_RX") +c("R3", 1, "VISOR_PRESENT"); c("R3", 2, "GND") +# Decoupling +for ref, net in (("C1", "VSB"), ("C2", "VSB"), ("C3", "VSB"), ("C4", "VSB"), ("C5", "VSB"), + ("C8", "VSB"), ("C10", "VSB"), ("C9", "3V3X"), ("C11", "3V3X"), ("C12", "3V3X")): + c(ref, 1, net); c(ref, 2, "GND") +# VDOCK charging path (optional) +c("D1", 2, "VDOCK"); c("D1", 1, "VDOCK_D") # SOD-123 pad 1 = cathode +c("JP1", 1, "VDOCK_D"); c("JP1", 2, "XIAO_VBUS") + +# X1 XIAO nRF52840 edge pads (top view, USB-C toward the outer edge) and bottom pads. +# Radio pins from MeshCore's xiao_nrf52 variant; D6/D7 is the companion UART (firmware/ patch). +XIAO_NAMES = {1: "D0", 2: "D1", 3: "D2", 4: "D3", 5: "D4", 6: "D5", 7: "D6", 8: "D7", 9: "D8", + 10: "D9", 11: "D10", 12: "3V3", 13: "GND", 14: "5V"} +XIAO = {1: "VISOR_PRESENT", 2: "LORA_DIO1", 3: "LORA_RESET", 4: "LORA_BUSY", 5: "LORA_NSS", + 6: "LORA_RXEN", 7: "XIAO_TX", 8: "XIAO_RX", 9: "LORA_SCK", 10: "LORA_MISO", 11: "LORA_MOSI", + 12: "3V3X", 13: "GND", 14: "XIAO_VBUS"} +for k, n in XIAO.items(): + c("X1", k, n) +# Bottom pads: names as on Seeed's footprint. VERIFY names and positions against a real board. +for pad, net in {"BAT+": "VBAT", "BAT-": "GND", "SWDIO": "SWDIO", "SWCLK": "SWCLK", "RST": "NRST"}.items(): + c("X1", pad, net) +c("BT1", 1, "VBAT"); c("BT1", 2, "GND") +c("TP1", 1, "SWDIO"); c("TP2", 1, "SWCLK"); c("TP3", 1, "NRST"); c("TP4", 1, "GND") + +# X2 Wio-SX1262: pin k is the pin that took XIAO pin k when stacked. Only the radio nets join; +# its D0, D6, D7 and 5V pins stay unconnected so the UART and Visor-present lines see only the XIAO. +for k in (2, 3, 4, 5, 6, 9, 10, 11, 12, 13): + c("X2", k, XIAO[k]) + +NETS = sorted(set(CONN.values()))