Page 1 of 1

[HELP] Looking for help with challenging ESP32 + LINAK CBD6S LIN bus project - would appreciate any assistance!

Posted: Fri Jul 11, 2025 7:03 pm
by 123jadel
Hi everyone! If anyone has some time on their hands and enjoys solving challenging hardware/protocol problems, I could really use some help. I've been working on this for weeks and feel like I've exhausted all my ideas.

Project Goal
Building ESP32-based replacement for LINAK handset to control CBD6S linear actuator controller via LIN bus protocol. I've already successfully controlled it via Bluetooth (which was pretty easy), but the real challenge is getting the wired LIN communication working.

Resources & Documentation
Protocol Documentation & Datasheets: https://drive.google.com/drive/folders/ ... sp=sharing (Contains LINAK protocol docs and CBD6S datasheet - may be outdated/old protocol)

My Component List: https://docs.google.com/spreadsheets/d/ ... sp=sharing

Working Examples (different setups):

https://github.com/stevew817/linak_desk

https://github.com/Ordspilleren/esp32-l ... /tree/main

Logic Analyzer Results: [check google drive folder above. captured with PulseView from original LINAK handset during UP/DOWN movements]

Hardware Setup
Components:

ESP32 development board with CP2102 (38-pin, WROOM module)

TJA1020 LIN transceiver module

CBD6S actuator controller

RJ45 breakout, 1kΩ resistor, decoupling caps

Pinout:

ESP32 GPIO 17 (TX) → TJA1020 RX
ESP32 GPIO 16 (RX) ← TJA1020 TX
ESP32 3.3V → TJA1020 VCC
ESP32 GND → TJA1020 GND
LIN Bus (RJ45):

Pin 1: GND → Common ground
Pin 6: LIN → TJA1020 LIN pin
Pin 8: 12V → TJA1020 VIN + 1kΩ resistor to Pin 6 (pull-up)
Power Status: ✅ ESP32 blue LED active, TJA1020 green LED solid

Critical Requirements (Note: Info not 100% confirmed)
HB04 Wake-Up:

Pin: RJ45 Pin 8

Method: Pull to GND through 1kΩ resistor

MANDATORY: Without this, CBD6S acknowledges but won't move

Current: Minimum 250µA (1kΩ provides 12mA - sufficient)

Initialization:

Mode setting: Required before movement

"Move End" command: Value 32769 for initialization

Safety:

PRBS sequence: Required for motor activation

ID 39: Safety commands

Protocol Research (Analysis not 100% confirmed)
Logic Analyzer Results (PulseView):

Real handset communication: 3092 break fields, 2978 sync fields

Most frequent PIDs: 0x0C (82x), 0x1C (67x), 0x02 (106x)

Common data: 0x180 (456x), 0x18 (145x)

Movement PID: 0x25 (ID 37)

Note: A lot of the captured data appears corrupted/bad - unsure why

Timing Analysis:

~93ms between break conditions

~120ms main cycle timing

Consistent ~500ms major cycles

Suggests scheduled polling system

Master/Slave Confusion: I can't determine who is master/slave from the logic analyzer data. The data was captured from the real LINAK handset, but I can't differentiate between handset→CBD6S vs CBD6S→handset communication.

Protocol Observations:

ID39 authentication: multi-byte (0x18, 0x1B7, 0xDF), not single PRBS

Dynamic authentication values changing between frames

Movement patterns: ID17 (0xE1, 0x180), ID37 (0x38, 0x1AE)

System deviates from standard LINAK documentation

Command Format: ❓ Unclear - could be function codes OR position targets

Position targets: UP=0x00,0x80 DOWN=0xFF,0x7F

Function codes: UP=11,0 DOWN=10,0

The Problem
Current Issue: CBD6S completely silent - zero LIN frames detected over 60+ seconds

Tests Performed:

Pure listener mode: 0 frames captured

UART self-test: ✅ ESP32 receiving works perfectly

Hardware verification: GPIO 16 reads constant 1, Serial2 available=0

With real handset: Desk moves normally, but ESP32 still sees no traffic

Code Attempts:

✅ Proper break field generation (13-bit dominant + delimiter)

✅ LIN 2.0 parity calculation and checksums

✅ Multiple initialization strategies (frequent PIDs, safety sequences)

✅ Both master and slave approaches tested

✅ Various timing attempts

Why This Is So Challenging
The hardest part is that there are SO many variables that could be wrong - timing, protocol format, initialization sequence, master/slave roles, etc. Since the CBD6S hasn't responded at all, I can't isolate variables to understand what's going wrong. One small mistake can prevent movement entirely.

Maybe the right timing is crucial, or there's a specific initialization handshake I'm missing. I'm just looking for a way to move forward since I feel completely stuck.

LIN Protocol: 19200 baud, modified LIN 2.0, Break+ID+Data+Checksum format

Has anyone successfully interfaced with LINAK controllers or can spot what I might be missing? Any help would be greatly appreciated!

Re: [HELP] Looking for help with challenging ESP32 + LINAK CBD6S LIN bus project - would appreciate any assistance!

Posted: Thu Jul 17, 2025 11:48 am
by Janphr88
Hey!

I'll be trying to do something similar starting next week, once the first CBD6S has arrived. I've already done some research in preparation (i.e. I asked ChatGPT).

The screenshot shows its response to your attempt.

First thing I will try is:
Minimal Working Arduino Sketch
Arduino Mega + TJA1021 (or MCP2004) transceiver, sending both ID10 Up and ID39 safety PRBS, at 10 Hz, no sync byte:

Code: Select all

// Arduino Mega + LIN transceiver (TJA1021)

#define LIN_SERIAL Serial1

const uint8_t ID10 = 0x0A, ID39 = 0x27;
uint8_t prbs[] = {63,223,207,215,195,221,204,85,128};
uint8_t prbs_idx = 0;

void setup() {
  LIN_SERIAL.begin(19200);
  delay(1000);
}

void loop() {
  // 1️⃣ Send Up Command (ID10 -> 0x8000)
  sendLIN(ID10, (uint8_t[]){0x00, 0x80}, 2);
  // 2️⃣ Send Safety Sequence (ID39 with PRBS byte)
  sendLIN(ID39, &prbs[prbs_idx], 1);
  if (++prbs_idx >= sizeof(prbs)) prbs_idx = 0;

  delay(100);
}

void sendLIN(uint8_t id, uint8_t *data, uint8_t len) {
  uint8_t pid = addParity(id);
  // Break generation via baud switch
  LIN_SERIAL.end();
  LIN_SERIAL.begin(9600);
  LIN_SERIAL.write((uint8_t)0x00);
  LIN_SERIAL.flush();
  LIN_SERIAL.end();
  LIN_SERIAL.begin(19200);

  // PID and data
  LIN_SERIAL.write(pid);
  for (uint8_t i=0; i<len; i++) LIN_SERIAL.write(data[i]);

  // Enhanced checksum (ID+data)
  uint16_t sum = pid;
  for (uint8_t i=0; i<len; i++) sum += data[i];
  LIN_SERIAL.write((uint8_t)(0xFF - (sum & 0xFF)));
}

uint8_t addParity(uint8_t id) {
  uint8_t p0 = ((id>>0) ^ (id>>1) ^ (id>>2) ^ (id>>4)) & 0x1;
  uint8_t p1 = (~((id>>1) ^ (id>>3) ^ (id>>4) ^ (id>>5)) ) & 0x1;
  return id | (p0<<6) | (p1<<7);
}
Hope it helps and I'll join testing next week :)

Re: [HELP] Looking for help with challenging ESP32 + LINAK CBD6S LIN bus project - would appreciate any assistance!

Posted: Wed Jul 23, 2025 12:01 pm
by 123jadel
Hey ! Thanks for this. Feel free to reach out via email at jad.elamrani@gmail.com and we can try to work on this together.