Skip to content

YuriCable Pro Max (SWD/DCSD-Cable App implemented for the Flipper Zero) Currently DCSD Support

License

Notifications You must be signed in to change notification settings

arag0re/fz-yuricable-pro-max

Repository files navigation

Build and Release FAP GitHub Release GPLv3 License GitHub Repo stars GitHub watchers X (formerly Twitter) Follow

YuriCable Pro Max

Implementation to use a Flipper-Zero as SWD/DCSD-Cable for iPhones just like known Kanzi/Kong/Tamarin Cables

Star History

Star History Chart

Tested iPhones:

iPhone DCSD Reset DFU JTAG
14 Pro Max ✅ ✅ ✅ ❌
14 Pro ✅ ✅ ✅ ❌
SE (2022) ✅ ✅ ✅ ❌
XS ❌ ❌ ❌ ❌

Thanks

SDQ

Here some specs about the protocol used:

Credits for SDQ reverse engineering to @nyansatan

Tamarin Cable Implementation

Credits to @stacksmashing for an example pi pico implementation and his defcon talk on this subject. ( watch here)

Project Setup

Install Build-Tool

python -m pip install --upgrade ufbt

Update Firmware to latest firmware if already installed

  • Download Update
ufbt update --channel=release

Build App and flash firmware including the app to the flipper

  • Flash Firmware to the Flipper
ufbt flash_usb
  • VSCode setup and build
ufbt faps vscode_dist
  • if it doesnt work, use only setup-command:
ufbt vscode_dist
  • then build it using the commands in section Build FAP

Build FAP

NAviagte to the root-folder of this project and execute the following command to build the app from src:

ufbt

The .fap-File is located in ./dist-Folder after successful build

Build FAP, upload to Flipper & launch

ufbt launch

Pinout Flipper / Lightning Breakout

Cable Flipper
Yellow (ID0) PA7 (PIN 2)
Blue (ID1) PA6 (PIN 3)
Black (GND) GND (PIN 8)
Purple (L1n) TX (PIN 13)
Orange (L1p) RX (PIN 14)

Open in CLion

Open the Project in CLion

Flipper Docs

Flipper Docs

Pinout Flipper Zero

Pinout Lightning

Breakout Color Coding

Female Port Pinout

USB UART Pinout

Debug

ST-Link

JLink

Install JLINK Software

Download latest JLINK Software

Then update the Firmware of the JLink.

Pinout

  • Pinoout of the Segger J-Link

JLINK

Pin Mapping

Mapping Table:

Flipper GPIO |  JLINK GPIO
__________________________
12 (SIO)     |  7 (TMS)
11 (GND)     |  8 (GND)
10 (SWC)     |  9 (TCK)
09 (3v3)     |  1 (VTref)

FlipperJLINK

or buy a JTAG Adapter for Flipper Zero by @jrozner on Tindie and extend the GPIO-Pins

FlipperJLINKAdapter

Docs

UFBT

ARM Stuff

Class Diagramm

@startuml

skinparam linetype polyline
skinparam linetype ortho

class SDQDevice {
    + const GpioPin* gpio_pin
    + const UsbUartBridge* uart_bridge
    + SDQTimings timings
    + SDQDeviceError error
    + SDQDeviceCommand runCommand
    + bool listening
    + bool connected
    + bool resetInProgress
    + SDQDeviceCommandCallback command_callback
    + command_callback_context: void*
    void start()
    void stop()
    bool send(const uint8_t data[], size_t data_size)
    bool receive(uint8_t data[], size_t data_size)
}

enum SDQDeviceError {
    SDQDeviceErrorNone
    SDQDeviceErrorResetInProgress
    SDQDeviceErrorPresenceConflict
    SDQDeviceErrorInvalidCommand
    SDQDeviceErrorBitReadTiming
    SDQDeviceErrorTimeout
}

enum SDQDeviceCommand {
    SDQDeviceCommand_NONE
    SDQDeviceCommand_DCSD
    SDQDeviceCommand_JTAG
    SDQDeviceCommand_DFU
    SDQDeviceCommand_RECOVERY
    SDQDeviceCommand_USB_A_CHARGING_CABLE
}

class SDQTimings {
    + uint32_t BREAK_meaningful_min
    + uint32_t BREAK_meaningful_max
    + uint32_t BREAK_meaningful
    + uint32_t BREAK_recovery
    + uint32_t WAKE_meaningful_min
    + uint32_t WAKE_meaningful_max
    + uint32_t WAKE_meaningful
    + uint32_t WAKE_recovery
    + uint32_t ZERO_meaningful_min
    + uint32_t ZERO_meaningful_max
    + uint32_t ZERO_meaningful
    + uint32_t ZERO_recovery
    + uint32_t ONE_meaningful_min
    + uint32_t ONE_meaningful_max
    + uint32_t ONE_meaningful
    + uint32_t ONE_recovery
    + uint32_t ZERO_STOP_recovery
    + uint32_t ONE_STOP_recovery
}

class TRISTART_RESPONSES {
    DFU: uint8_t[7]
    RESET_DEVICE: uint8_t[7]
    USB_UART_JTAG: uint8_t[7]
    USB_SPAM_JTAG: uint8_t[7]
    USB_UART: uint8_t[7]
    USB_A_CHARGING_CABLE: uint8_t[7]
}

class UsbUartBridge {

}

interface yuricable_pro_max {
    + const GpioPin SDQ_PIN
    {static} void demo_input_callback(InputEvent* input_event, FuriMessageQueue* queue)
    {static} void demo_render_callback(Canvas* canvas, void* ctx)
    int32_t yuricable_pro_max_app(void* p)
}

SDQDevice *-- SDQTimings
SDQDevice *-- TRISTART_RESPONSES
SDQDevice <-left- SDQDeviceError
SDQDevice <-left- SDQDeviceCommand
SDQDevice +-right- yuricable_pro_max
SDQDevice +-right- UsbUartBridge

@enduml

Gantt

@startgantt
Labels on first column
saturday are closed
sunday are closed
project starts 2024-01-10 
[M1] happens D+1
[M2] happens D+6
[Docu] requires 5 day and starts D+1
-- Flipper --
[SDQ Implementation] requires 2 day
[CLI Commands] requires 2 day and starts at [SDQ Implementation]s end
[UART Implementation] requires 1 day and starts at [SDQ Implementation]s end
[SWD Implementation] requires 1 day and starts at [UART Implementation]s end
[JTAG Implementation] requires 1 day and starts at [SWD Implementation]s end
-- Monitor --
[Explor WebSerial] requires 2 day
[Create React App] requires 1 day and starts at [Explor WebSerial]s end
[Implement WebSerial] requires 1 day and starts at [Create React App]s end
[Command Buttons] requires 1 day and starts at [Implement WebSerial]s end
[Device Filter] requires 1 day and starts at [Implement WebSerial]s end
@endgantt