Skip to content

Commit

Permalink
docs: add status request documentation
Browse files Browse the repository at this point in the history
Signed-off-by:  Eric Callahan <[email protected]>
  • Loading branch information
Arksine committed Oct 23, 2024
1 parent 402e441 commit ac9edd6
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 2 deletions.
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ options:
Path to Klipper firmware file
-u <uuid>, --uuid <uuid>
Can device uuid
-q, --query Query Bootloader Device IDs
-q, --query Query Bootloader Device IDs (CANBus only)
-v, --verbose Enable verbose responses
-r, --request-bootloader
Requests the bootloader and exits
-s, --status Connect to bootloader and print status
```

### Can Programming
Expand Down Expand Up @@ -205,7 +206,8 @@ and if detected it will begin writing. If a `status led` is configured it
will blink rapidly during the programming procedure. After successful completion
Katapult will rename the firmware file's extension to `.cur`, reset the MCU,
and jump to the application. If Katapult encounters an error during programming
it will exit and attempt to rename the firmware file with a `.err` extension.
it will attempt to rename the firmware file with a `.err` extension, then drop
to command mode.

If the `firmware file` does not exist or if there is an error initializing the
SD Card, Katapult will enter command mode. In this mode the `status led`
Expand Down Expand Up @@ -240,6 +242,35 @@ is `CANBus` and `Long File Name Support` is enabled. This will result in a bina
larger than 16 KiB. It should be noted that `Klipper` currently only supports a
16 KiB bootloader offset for the `RP2040`.

### Troubleshooting

As mentioned above, Katapult will enter command mode if it encounters an error
during initialization or programming. When in command mode it is possible
to use the flashtool's `-s` option to query Katapult's status which includes
SD Card status:

```
./scripts/flashtool.py -s -u aabbccddeeff
Connecting to CAN UUID aabbccddeeff on interface can0
Resetting all bootloader node IDs...
Detected Klipper binary version v0.12.0-302-g87ac69363, MCU: stm32f103xe
Attempting to connect to bootloader
Katapult Connected
Software Version: v0.0.1-95-g2d7bd0c
Protocol Version: 1.1.0
Block Size: 64 bytes
Application Start: 0x8004000
MCU type: stm32f103xe
Verifying canbus connection
*** SD Card Status ***
Detected SD Card Interface: HARDWARE_SPI
Last SD Flash State: NO_DISK
SD Flags: DEINITIALIZED
Last Error: NO_IDLE_STATE
Status Request Complete
```


## Katapult Deployer

Expand Down
55 changes: 55 additions & 0 deletions protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,61 @@ payload in the following format:
<4 byte orig_command><6 byte UUID><0x00><0x00>
```

#### Get SD Card Status: `0x17`

Returns SD Card information. Only available when SD Card programming is enabled.

```
<0x01><0x88><0x17><0x00><CRC><0x99><0x03>
```

Responds with [acknowledged](#acknowledged-0xa0) containing a 8 byte
payload in the following format:

```
<4 byte orig_command><1 byte SD Card Interface><1 byte SD Card State><1 byte SD Card Flags><1 byte SD Card Error>
```

- `SD Card Interface`: An enumeration detailing the configured SD Card interface.
Can be one of the following values:
- `HARDWARE_SPI = 0`
- `SOFTWARE_SPI = 1`
- `SDIO = 2`
- `SD Card State`: An enumeration detailing the last SD Card Programming state.
Can be one of the following values:
- `DISABLED = 0`
- `PENDING TRANSFER = 1`
- `UPLOADING = 2`
- `VERIFYING = 3`
- `FINISHED = 4`
- `ERROR = 5`
- `NO FILE FOUND = 6`
- `NO DISK FOUND = 7`
- `SD Card Flags`: A flag containing specific state detected during the
SD Card operation. Can be a bitwise OR of any of the following:
- `INITIALIZED = 1`
- `TRANSFER MODE = 2`
- `HIGH CAPACITY = 4`
- `WRITE PROTECTION ENABLED = 8`
- `CARD DETECT PULLUP DISABLED = 16`
- `DEINITIALIZED = 32`
- `SD Card Error`: An enumeration containing the last error detected. Can be one
of the following values:
- `NO ERROR = 0`
- `RESET ERROR (NO IDLE STATE) = 1`
- `SEND IF COND ERROR = 2`
- `SEND OP COND ERROR = 3`
- `READ OCR ERROR = 4`
- `READ BLOCK ERROR = 5`
- `WRITE BLOCK ERROR = 6`
- `SEND CID ERROR = 7`
- `SEND REL ADDR ERROR = 8`
- `SEND CSD ERROR = 9`
- `SEL DESEL ERROR = 10`
- `SET CARD DETECT ERROR = 11`
- `SET BLOCKLEN ERROR = 12`
- `CRC ON/OFF ERROR = 13`

### Responses

#### Acknowledged: `0xa0`
Expand Down

0 comments on commit ac9edd6

Please sign in to comment.