# SPI Command Opcode

A SPI transaction starts with a command opcode. SPI slave disregards commands different than opcodes defined in the Table xx-yy.

## **Table - SPI Command Opcodes**

<table data-header-hidden><thead><tr><th width="111.66668701171875" valign="top"></th><th width="120.66668701171875" valign="top"></th><th width="128.66668701171875" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Command</td><td valign="top">Opcode 1st Byte</td><td valign="top">Opcode 2nd Byte</td><td valign="top">Description</td></tr><tr><td valign="top">RREG</td><td valign="top">0000_0000b</td><td valign="top">xxxx_xxxxb</td><td valign="top">Read the register at address xxxx_xxxxb</td></tr><tr><td valign="top">WREG</td><td valign="top">0010_0000b</td><td valign="top">yyyy_yyyyb</td><td valign="top">Write the register at address yyyy_yyyyb. The data is the 16-bit that follows the command.</td></tr><tr><td valign="top">RTKABCQT</td><td valign="top">0100_0000b</td><td valign="top">0000_0000b</td><td valign="top">Read Track A, Track B, Track C and Qwantum Token in burst mode.</td></tr><tr><td valign="top">RTKBQT</td><td valign="top">0110_0000b</td><td valign="top">0000_0000b</td><td valign="top">Read Track B and Qwantum Token in burst mode.</td></tr><tr><td valign="top">RTKA</td><td valign="top">1000_0000b</td><td valign="top">0000_0000b</td><td valign="top">Read Track A data in burst mode.</td></tr><tr><td valign="top">RTKC</td><td valign="top">1010_0000b</td><td valign="top">0000_0000b</td><td valign="top">Read Track C data in burst mode.</td></tr><tr><td valign="top">RST</td><td valign="top">1101_1111b</td><td valign="top">1111_1111b</td><td valign="top">Reset all device but SPI slave interface.</td></tr></tbody></table>

## Read Register Command - RREG <a href="#bookmark24" id="bookmark24"></a>

Read register command (RREG) is used to read register values defined in the register map. The Opcode 1st byte is 0000\_0000b. The Opcode 2nd byte “xxxx\_xxxxb” defines the register address to be read. The SPI chip select should be SSELn=0 for the duration of the command.

Note: The auto-increment address feature has been removed since the register map has just a few registers and there is no real advantage in using the auto-increment address feature.

<figure><img src="/files/XRwbOsxF51BVTnrbSSUA" alt=""><figcaption></figcaption></figure>

<p align="center"><strong>Read Register Command - RREG</strong></p>

## Write Register Command - WREG <a href="#bookmark25" id="bookmark25"></a>

Write register command (WREG) is used to write registers defined in the register map. The Opcode 1st byte is 0010\_0000b. The write data is 16 bits in width and is provided by the SPI master at the end of the 16 bit Command Opcode. The Opcode 2nd byte “yyyy\_yyyyb” defines the register address to be written. The SPI chip select should be SSELn=0 for the duration of the command.

Note: The auto-increment address feature has been removed since the register map has just a few registers and there is no real advantage in using the auto-increment address feature.

<figure><img src="/files/tkTCZ3Yt14QNAB7d23nd" alt=""><figcaption></figcaption></figure>

<p align="center"><strong>Write Register Command - WREG</strong></p>

## Read Track A, Track B, Track C Data and Qwantum Token - RTKABCQT <a href="#bookmark26" id="bookmark26"></a>

Read Track A and Track B and Track C and Qwantum Token (RTKABCQT) is used to read, in burst mode, Track A, Track B, Track C and Qwantum Token stored in the RAM. The SPI chip select should be SSELn=0 for the duration of the command. If SSELn goes to 1 before the end of the burst read, then a new RTKABCQT command will re-start the burst mode from the first address of the memory and not from the last memory address read from the previous RTKABCQT command. The SPI slave transfers

(1+44+44+44+24)=157 words (Nb=2512 bits) if Qwantum Token Extended mode is disabled or (1+44+44+44+96)=229 words (Nb=3664 bits) if the Qwantum Token Extended mode is enabled. The transfer takes place if SSELn=0 and if SCLK is provided by the SPI master for Nb periods. If the SPI master does not stop SCLK after the last read word, then the SPI slave sets MISO=0.

The RTKABCQT command is valid only when the FSM is in the EXTRACT state. If the SPI master sends the RTKABCQT command when the FSM is not in EXTRACT state, then the SPI slave will disregard the command.

<figure><img src="/files/5yGWLuBFyEy6NhBvUsLK" alt=""><figcaption></figcaption></figure>

<p align="center"><strong>Read Track A, Track B, Track C and Qwantum Token Command - RTKABCQT</strong></p>

## Read Track B Data and Qwantum Token - RTKBQT <a href="#bookmark27" id="bookmark27"></a>

Read Track B and Qwantum Token (RTKBQT) is used to read, in burst mode, Track B and Qwantum Token stored in the RAM. The SPI chip select should be SSELn=0 for the duration of the command. If SSELn goes to 1 before the end of the burst read, then a new RTKBQT command will re-start the burst mode from the first address of the memory and not from the last memory address read from the previous RTKBQT command. The SPI slave transfers (1+44+24)=69 words (Nb=1104 bits) if Qwantum Token Extended mode is disabled or (1+44+96)=141 words (Nb=2256 bits) if the Qwantum Token Extended mode is enabled. The transfer takes place if SSELn=0 and if SCLK is provided by the SPI master for Nb bits. If the SPI master does not stop SCLK after the last read word, then the SPI slave sets MISO=0.

The RTKBQT command is valid only when the FSM is in the EXTRACT state. If the SPI master sends the RTKBQT command when the FSM is not in EXTRACT state, then the SPI slave will disregard the command.

<figure><img src="/files/HPE4HGUeQw4iFWY03UrZ" alt=""><figcaption></figcaption></figure>

<p align="center"><strong>Read Track B and Qwantum Token - RTKBQT</strong></p>

## Read Track A Data - RTKA <a href="#bookmark28" id="bookmark28"></a>

Read Track A Data (RTKA) is used to read, in burst mode, Track A data stored in the RAM. The SPI chip select should be SSELn=0 for the duration of the command. If SSELn goes to 1 before the end of the burst read, then a new RTKA command will re-start the burst mode from the first address of the memory and not from the last memory address read from the previous RTKA command. The SPI slave transfers (1+44)=45 words (Nb=720 bits) if SSELn=0 and if SCLK is provided by the SPI master for Nb periods.

If the SPI master does not stop SCLK after the last read word, then the SPI slave sets MISO=0.

The RTKA command is valid only when the FSM is in the EXTRACT state. If the SPI master sends the RTKA command when the FSM is not in EXTRACT state, then the SPI slave will disregard the command.

<figure><img src="/files/k1eaPw7Mg0TrmLk4hq7g" alt=""><figcaption></figcaption></figure>

<p align="center"><strong>Read Track A Command – RTKA</strong></p>

## Read Track C Data - RTKC <a href="#bookmark29" id="bookmark29"></a>

Read Track C Data (RTKC) is used to read, in burst mode, Track C data stored in the RAM. The SPI chip select should be SSELn=0 for the duration of the command. If SSELn goes to 1 before the end of the burst read, then a new RTKC command will re-start the burst mode from the first address of the memory and not from the last memory address read from the previous RTKC command. The SPI slave transfers (1+44)=45 words (Nb=720 bits) if SSELn=0 and if SCLK is provided by the SPI master for Nb periods. If the SPI master does not stop SCLK after the last read word, then the SPI slave sets MISO=0.

The RTKC command is valid only when the FSM is in the EXTRACT state. If the SPI master sends the RTKC command when the FSM is not in EXTRACT state, then the SPI slave will disregard the command.

<figure><img src="/files/DUfRC1yXTr7UXFemupDA" alt=""><figcaption></figcaption></figure>

<p align="center"><strong>Read Track C Command - RTKC</strong></p>

## Reset - RST <a href="#bookmark30" id="bookmark30"></a>

Reset (RST) is used to reset all components in the ASIC but SPI slave interface. The SPI slave interface is under reset when SSELn=0.

<figure><img src="/files/rr7L46GgiTelqdPVDjDO" alt=""><figcaption></figcaption></figure>

<p align="center"><strong>Reset Command - RST</strong></p>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.magtek.com/qwantum-services/qwantum-asic/draft-versions/draft-of-msr-chip-spi-firmware-implementation-guide/qwantum-asic-spi-communication-interface/spi-command-opcode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
