Repository navigation
Wire: probe an address without data on the GPIOs; GRTC sleep TIMEOUT to 6 - #17
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
TWIM's DMA.TX.MAXCNT is defined for 1..0xFFFF only. endTransmission() with nothing written, which is how I2C scanners probe an address, started a zero-byte transfer and stopped it at once; that never reliably puts the address on the bus, and an idle TWIM does not raise STOPPED for a STOP task, so the result did not reflect the target. An address-only write is now clocked out on the GPIOs at up to 100 kHz with TWIM disabled: START, address and write bit, ACK, STOP. It returns 0 on ACK, 2 on NACK and 4 for a busy or stuck bus. Transfers with data still go through TWIM.
The datasheet requires TIMEOUT > WAKETIME + guard, with a guard of at least one LFCLK cycle. NRFX_GRTC_SLEEP_DEFAULT_CONFIG gives TIMEOUT 5 and WAKETIME 4, one cycle short. WAKETIME and AUTOEN stay at the nrfx values.
b4b35de to
7e129d7
Compare
|
Tested master ( GRTC. Wire. The board has an INA3221 at 0x42 and an SHT40 at 0x44 on the same bus. Meshtastic's scan ( Not covered: the scanner object is freed after setup and the console on this board is silent, so I didn't see the raw 0/2 codes for each address. I also didn't test a stuck bus (code 4), and the bus only ran at 100 kHz. #15 on the shutdown path. I triggered a shutdown by writing The rest of master looked fine in the same run: the TRNG produced its conditioning key, the phone reconnected with its stored bond (LESC, MTU 247, 2M PHY), and the flash showed no errors. The board stays on this image, so I'll report back if the soak turns anything up. |
Two fixes found while comparing against lolren/nrf54-arduino-core (d9699836, 2d7476a3, 256af4f4) and checked against the nRF54L15 datasheet.
Wire: address-only probe
TWIM
DMA.TX.MAXCNTis defined for[1..0xFFFF](datasheet).endTransmission()with nothing written, which is how I2C scanners probe (beginTransmission(addr); endTransmission(), also Meshtastic's sensor detection), started a zero-byte transfer and stopped it at once. That does not reliably put the address on the bus, and an idle TWIM does not raise STOPPED for a STOP task, so the result did not reflect the target.With nothing to write, the address is now clocked out on the GPIOs at up to 100 kHz with TWIM disabled: START, address + write bit, ACK, STOP, with clock stretching honoured. It returns 0 on ACK, 2 on NACK and 4 for a busy or stuck bus. The pins are restored to the configuration
begin()sets before TWIM is re-enabled. Transfers with data are unchanged.GRTC sleep TIMEOUT
The datasheet requires TIMEOUT > WAKETIME + guard, with a guard of at least one LFCLK cycle (GRTC, SYSCOUNTER sleep mode).
NRFX_GRTC_SLEEP_DEFAULT_CONFIG(TIMEOUT 5, WAKETIME 4), applied since #1, is one cycle short. TIMEOUT is now 6; WAKETIME and AUTOEN stay at the nrfx values.Testing
Not run on hardware.
tests/blinkthe GRTC change,tests/libraries(tests: build the bundled libraries in CI, and fix Wire on the nRF54L10/L05 DKs #16)Wire_nRF52.cpp, without warnings.GRTC->TIMEOUTshould read 6 afterBluefruit.begin(), to confirm the SoftDevice does not reprogram it.Summary by CodeRabbit