Skip to content

add RS485SocketTool ESP32 hardware testing guide - #6

Merged
aphelps-claude-bot merged 3 commits into
mainfrom
rs485-esp32-testing-guide
Aug 20, 2026
Merged

aphelps-claude-bot merged 3 commits into
mainfrom
rs485-esp32-testing-guide

Conversation

@aphelps-claude-bot

Copy link
Copy Markdown
Collaborator

Summary

A self-serve TESTING.md for bringing up the RS485SocketTool example on an ESP32, co-located with the sketch at RS485Utils/examples/RS485SocketTool/. It carries the deferred hardware Testing Required step from the RS485-on-ESP32 example work (#4) — Adam can now validate on real hardware when the parts arrive, without needing anyone in the loop.

Contents

  • Parts list (3.3 V MAX3485 recommended; MAX485 + level-shifter caveat).
  • Wiring table: ESP32 GPIO16/17/18 ↔ transceiver RO/DI/RE+DE, A/B bus, power/ground — pins and flags match platformio/RS485SocketTool/platformio.ini (esp32 env, Serial2).
  • Build/flash (pio run -e esp32 --target upload; monitor at 115200).
  • Single-node smoke test + two-node send/receive test, quoting the sketch's exact strings (*** RS485SocketTool initialized ***, * Sending N, * Received data <len>: <hex>).
  • Level-shifting, termination, and mixed-voltage notes; a troubleshooting table.

Test plan

Docs-only; verified against the sketch source and the example's platformio.ini:

  • File non-empty (104 lines); all six section headings present.
  • Pin/env/baud tokens (16/17/18/esp32/115200) present (word-boundary check).
  • Exact init string present; markdown code fences balanced.

No automated build in this PR. Actually flashing hardware is the eventual real-world confirmation — that IS the purpose of this guide, tracked separately.

🤖 Generated with Claude Code

Self-serve TESTING.md for bringing up the RS485SocketTool example on an
ESP32: parts list, ESP32<->transceiver<->bus wiring (pins/flags matching the
esp32 platformio env), build/flash steps, single-node smoke test and two-node
send/receive test with the exact serial strings the sketch emits, plus a
troubleshooting table. Carries the deferred hardware Testing Required from
the RS485-on-ESP32 example work (ArduinoLibs #4).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@aphelps-claude-bot aphelps-claude-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review of the RS485SocketTool hardware TESTING.md (docs-only). Verified every technical claim against RS485Utils/examples/RS485SocketTool/RS485SocketTool.ino and platformio/RS485SocketTool/platformio.ini: pins RECV=16/XMIT=17/ENABLED=18, RS485_HARDWARE_SERIAL=2, 115200 monitor baud, nano env exists, default ADDRESS 128, broadcast via sendMsgTo(SOCKET_ADDR_ANY, ...), non-interactive (no Serial.read), 2-byte payload 'T' + count, and the exact strings *** RS485SocketTool initialized *** / * Sending N (every SEND_PERIOD = 1000 ms) / * Received data <len>:. All match.

One substantive inaccuracy found (inline, §5 expected output): the documented hex payload bytes will not actually print at the env's -DDEBUG_LEVEL=1, because print_hex_buffer emits via DEBUG4_HEXVAL which is compiled out below DEBUG_LEVEL=4. Two minor clarifications also inline. No architectural or cross-file issues.

Self-review finding: the guide showed '* Received data 2: 54 01', but
print_hex_buffer emits the bytes via DEBUG4_HEXVAL, which compiles out below
DEBUG_LEVEL=4; both envs build at level 1, so the real line is
'* Received data 2:' with no hex. Correct the expected output (a tester would
otherwise think reception failed), note how to see the hex (-DDEBUG_LEVEL=4)
and the count-lag, and spell out the nano env's default AVR pins (7/4/2).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@aphelps-claude-bot aphelps-claude-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of 6086dd0 (fix RS485 guide: received payload hex is hidden at DEBUG_LEVEL=1) — incremental diff over d11dabb only.

  • Prior finding 1 (hex payload not printed at -DDEBUG_LEVEL=1) — addressed. §5 now shows * Received data 2: with no hex, explains the print_hex_buffer → DEBUG4_HEXVAL gating, and gives the -DDEBUG_LEVEL=4 rebuild path. Verified against Debug/Debug.h (DEBUG4_HEXVAL maps to DEBUG1_HEXVAL only at DEBUG_LEVEL >= 4, empty otherwise) and Debug/Debug.cpp:50-54.
  • Prior finding 2 (counter off-by-one between payload and * Sending N) — addressed. The lag-by-one note matches the sketch (send_buffer[1] = count++; then DEBUG1_VALUELN("* Sending ", count)).
  • Prior finding 3 (nano env pin defaults unspecified) — addressed. §5 now states RECV=7/XMIT=4/ENABLED=2; verified the nano env in platformio/RS485SocketTool/platformio.ini passes no pin flags, so the sketch defaults at RS485SocketTool.ino:22-26 apply.
  • One new minor issue (inline, §5): the illustrative DEBUG_LEVEL=4 output formatting doesn't match what the code actually prints. Cosmetic, suggestion attached.

No other issues introduced by this commit.

Re-review nit: the illustrative '* Received data 2:  54  02' didn't match
Arduino HEX formatting (no zero-pad, per-byte leading space). Describe the
DEBUG_LEVEL=4 payload as space-separated hex ('T'=54 then the counter) and
note the no-zero-pad quirk, rather than showing a wrong literal.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

@aphelps-claude-bot aphelps-claude-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review of 6f0d6e3 (rs485 guide: drop the fabricated debug-level-4 hex example) — incremental diff over 6086dd0 only.

  • Prior finding (illustrative DEBUG_LEVEL=4 output didn't match actual formatting) — addressed. The fabricated literal * Received data 2: 54 02 is removed; §5 now describes the payload generically as space-separated hex after the colon ('T' = 54, then the sender's counter) and notes the no-zero-pad and counter-lag quirks. Verified against the code: print_hex_buffer loops DEBUG4_HEXVAL(" ", buff[b]) → Serial.print(F(" ")); Serial.print(y, HEX) (one space per byte, Arduino HEX unpadded), and the sketch stores send_buffer[1] = count++ before printing * Sending N, so the lag-by-one note is correct.

No new issues introduced by this commit. All prior findings resolved.

@aphelps aphelps left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit dated now but lets clear it out

@aphelps-claude-bot
aphelps-claude-bot merged commit a62c389 into main Aug 20, 2026
@aphelps-claude-bot
aphelps-claude-bot deleted the rs485-esp32-testing-guide branch August 20, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants