Repository navigation
Conversation
Drive the section 2.2 relay codes as GPIO, sample TX_ISENSE and the CC pins, and hold the PA off until the soft-start gates pass. The sketch adds the SH1106, buttons, SYNC LED, a fixed CLK0 carrier, the MCP4725, and a 24AA64 presence check. Relay PWM stays off; the timer map is the DS40002183E check. Co-authored-by: Jason Milldrum <NT7S@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Milestone M1 for
firmware2on the AVR128DA48. One bring-up sketch: Optiboot/UPDI notes, SH1106 OLED, buttons, SYNC LED, section 2.2 relay codes as GPIO, ADC on TX_ISENSE and CC1/CC2, the 50 ms / 20 ms soft-start gates, Si5351 CLK0 at a fixed in-band carrier, MCP4725 bias, and a 24AA64 presence check. The SAMD21 tree and the license files are untouched. Not merged.Relays are fully on. Nothing in this firmware PWM-holds them, and nothing calls
delay(). PA4 stays low until DSP1, and only after both soft-start gates.K3 — DS40002183E timer check
Checked against Microchip DS40002183E (the E revision of DS40002183), not only the DxCore docs. The record is
firmware2/OpenBeacon2/ob2_pwm.h, and the host test locks it. Shipped firmware does not enable any of these outputs.TCBROUTEA 16.3.8 p.162: TCB0 is PA2/PF4, TCB1 is PA3/PF5, TCB2 is PC0/PB4, TCB3 is PB5/PC1, TCB4 is PG3/PC6. No TCB waveform on PA5, PA6, or PB1.
The spec's three traps match the datasheet:
analogWrite()on PA4–PA7 is not used; DxCore can route that range onto TCD0.TCD.CTRLC (23.5.3 p.321): CMPCSEL resets to 0, so WOC follows PWMA (WOA, which is PA4). The proposed bench allocation (PA5+PA6 on TCD0, PB1 on TCA1 WO1) only works if CMPCSEL is set to PWMB, and then PA5 and PA6 share one duty. FAULTCTRL CMPAEN has to stay off so WOA is not driven. That allocation is not built here.
CI
Green on
12ea8e3e. Both jobs passed.https://github.com/etherkit/OpenBeacon2/actions/runs/40565439892
Build size
From the DxCore job log:
FQBN
DxCore:megaavr:avrdaopti:chip=avr128da48,clock=24internal,millis=tcb2,bootloaderusart=ser0. The only compiler warnings were in Etherkit Si5351 2.4.0 (set_clock_disable, comparison always true). Same size as the local build.Host tests
From the host job log (
ctest --test-dir firmware2/host/build --output-on-failure):ctest does not print doctest's summary on success. The same binary, run directly, reports 18 cases and 771 assertions, all passing. That covers the pin table from M0 plus the four legal relay codes, the four forbidden codes, all 14 bands, the soft-start edges (49 ms, 50 ms without a CC sample, 19 ms / 20 ms of boost), CC thresholds in both orientations, 200 ms CC debounce, isense, and the MCP4725 code.
Bench 1 — Optiboot, for Jason
Programmer is DxCore
serialupdiat 230400 baud on the UPDI dongle at J13. The later upload is the CP2102N at 115200, DTR through C37/R36. Use a dummy load. DSP1 transmits.arduino-cli compile --show-propertieson this FQBN resolves:0x000x000x000xC00x040x000x01Entry condition resolves to
_extr.bootloader.classdoes not resolve, so stockburn-bootloaderlooks for a file named{bootloader.class}_ser0_extr.hex. The image that matches a 128 kB DA, USART0 default pins, and_extrisoptiboot_128dx_ser0_extr.hex.Burn fuse 5 as
0xC8(RSTPINCFG = RESET, EESAVE still clear).0xC0leaves PF6 as GPIO and DTR will not enter Optiboot. EESAVE clear means the chip erase wipes internal EEPROM. The 24AA64 is not part of that erase.$PROGis the SerialUPDI adapter.$APPis the CP2102N. Wiping the bootloader and recovering it is the sameprog.pywrite over J13.Bench 2 — panel and relays
OB2 F2 80/60m,ABC 000,EE okonce the 24AA64 answers, andkey idleafter the 50 ms gate (it can already say that by the time the display comes up). USB serial at 115200 prints oneOB2 M1line.btn UDLRB12appears, and the SYNC LED stays on for the hold. Released, the LED blinks.000,010,100,101only. +5 V relay current should step 0 / 42 / 42 / 84 mA, never more than four coils. PA4 stays low.<100. There is no overcurrent trip in M1.The 500 mV bias is a placeholder, not a calibrated level. CLK0 drive is 8 mA, carried from the old firmware; section 4.4 does not restate drive strength.
Discrepancies
Not silently changed:
documentation/anddocs/have no copy), so these two stale lines are noted here instead of edited. Section 4.5 still says USART3 needs a PB1 pull-up. PB1 is BAND_C with R91, 22 kΩ to ground. A pull-up fights that and can bias Q9 on. This firmware drives PB1 low and does not enable the pull-up. RXEN stays off. Section 2.1 still says Q7 drives K2/K3/K5/K6. Section 2.2 assigns K3/K6 to BAND_C / Q9, and K2/K5 to BAND_B / Q7. The pin header follows section 2.2 and quotes the section 2.1 wording on the BAND_B row.docs/VERIFY.mdhas the same stale Q7 sentence and was left alone.avrdaoptiwrites SYSCFG00xC0for both Reset-pin menu choices (DS40002183E 7.9.2.4: that is PF6 as GPIO). External reset needs0xC8. The bench procedure burns0xC8on purpose.bootloader.classis unset, soarduino-cli burn-bootloaderdoes not name a real hex file. The non-Optiboot DA menu does set the reset bit.clock=24internalstill does not set OSCHF autotune. Section 4.1's crystal-disciplined clock is not this sketch.SPI_INTERFACES_COUNTis 1 even though SPI1 exists. The sketch swaps the single SPI object onto SPI1 ALT1 beforebegin(). SPI0 (PA4–PA7) is never started. The display uses the page buffer, not the 1 KB full buffer.0x50. The four bytesOB21are a presence check, not the config schema.(5000 * 4096) / 5000is 4096, which does not fit in 12 bits.noneand, per section 4.14, is the Default policy case. Power limiting is not in this milestone.isense_k, the overcurrent trip, GPS, and the beacon engine are later milestones.