Skip to content
 
 

Repository files navigation

c2tool

c2tool is a linux userspace application meant to enable in-system programming on low pin-count Silicon Labs devices using the Silicon Labs 2-Wire Interface (C2).

Existing kernel driver

There is a linux kernel driver (drivers/misc/c2port) for this, but

  • hardware support is quite limited
  • sysfs interface is not very intuitive
  • local_irq_disable() affects real time performance
  • GPIOs can be easily accessed from userspace

Challenge

The C2 Clock signal is shared with an active-low reset signal on the target device. Any clock pulse taking longer than 20us is interpreted as a reset signal. The kernel driver is driving the clock line with local_irq_disable() pulled to make sure the timing is valid. But this degrades system performance.

c2tool depends on hardware support for generating clock pulses that are in the range from 20ns to 5000ns. In our reference application there is an FPGA but a discrete monoflop should also do.

Install

Dependencies:

  • libpigpio

Prerequisites

Two gpios have to be supplied to c2tool:

  • c2d: Read/write access to the C2 Data pin
  • c2ck: Write access to the C2 Clock pin

Usage

Usage:  c2tool <gpio c2d> <gpio c2ck>  command
Commands:
        version       
                Show SW version.

        info
                Show information about connected device.

        dump [offset] [len] <file>
                Dump flash memory of connected device to HEX file.

        flash <file>
                Write HEX file to flash memory of connected device.

        erase
                Erase flash memory of connected device.

        verify <file>
                Verify HEX file to flash memory of connected device.

        reset
                Reset connected device.

C2 Documentation

About

c2tool is meant to enable in-system programming on low pin-count Silicon Labs devices using the Silicon Labs 2-Wire Interface (C2).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages