gis_logo.png

Datasheet for the SWIM_2 GIS Soft IP Embedded Logic

Register Definitions

Offset in core for bus CSR : 0x00002000

swim_2 This block is the SWIM interface
Register Name Byte Addr Offset Field Bits Type subtype Reset Description
CSR_SWIM_2_IP_ID 0x0 32 Unique ID for this IP block
IP_NUMBER 7:0 c 0x0a IP identifier number
MFR_NUMBER 15:8 c 0xff Manufacturer number
RESERVED 31:16 rsv 0 Reserved bits
CSR_SWIM_2_IP_VER 0x4 32 Bits[7:0] = Minor version number, Bits[15:8] = Major version number, etc.
MINOR_NUMBER 7:0 c 0x04 Minor number
MAJOR_NUMBER 15:8 c 0x02 Major number
RESERVED 31:16 rsv 0 Reserved bits
CSR_SWIM_2_STATUS 0x8 7 Status of interface
RXBUSY 0 r 0 Receiver busy
TXBUSY 1 r 0 Transmitter busy (writing or sending entry sequence)
RX_READY 2 r 0 A receive byte is ready for reading in rx_byte
TX_ERROR 3 r 0 Attempt to send WOTF or SRST when interface is busy or timed out on retries or TX NAK error
RX_ERROR 4 r 0 Attempt to send ROTF when interface is busy, or RX parity error
TX_NAK_ERROR 5 r 0 Failed to get an ACK or NAK in TX ACK slot
ENTRY_SEQ_SENT 6 r 0 Entry sequence has been sent.
CSR_SWIM_2_CONTROL 0xc 14 Control of interface
SEND_ENTRY_SEQ 0 w0 0 Instigate the sending of an entry sequence
HIGH_SPEED 1 w 0 Set high speed
CLR_RX 2 w0 0 Clear the read byte
SEND_SRST 3 w0 0 Instigate the sending of a SRST
TX_RETRY_TIMEOUT 11:4 w 10 Maximum retries on TX (0 is infinite)
CLEAR_ERRORS 12 w0 0 Clear Tx and Rx errors
RESET_STATE 13 w0 0 Reset the interface's state
CSR_SWIM_2_TX_BYTE 0x10 32 Write byte
BYTE 7:0 wp 0 Write byte value
WADDR 31:8 wp 0 Write address
CSR_SWIM_2_RX_BYTE 0x14 32 Read byte
BYTE 7:0 wp 0 Read byte value. Don't care on write, valid value on read if rx_ready = 1
RADDR 31:8 wp 0 Read address
CSR_SWIM_2_TX_BLOCK 0x18 32 Instigate the transmission of a block of data (128 bytes), to destination location, starting at given address
RESERVED 7:0 rsv 0 reserved
WADDR 31:8 wp 0 Destination start address
CSR_SWIM_2_PUSH_BYTE 0x1c 8 wp 0 Push next byte on block write. No effect if BLK_REMAINING register 0.
CSR_SWIM_2_BLK_REMAINING 0x20 8 r 0 Remaining bytes left in block transfer. Stable if TXBUSY bit in STATUS reg is 0.

Register/field type key:

TypeDescription
cConstant, with value defined by "reset" attribute
rsvSame as constant, except no reset value and always 0. Can be mixed with write types.
wWrite register (and read—no write only type). Register defined in register block and reset to "reset" attribute value. Split into fields (if applicable) for signalling and output, where attribute associated with fields, not register.
wpWrite with pulse. Register is not declared in block, but write bus split into fields as output port signals, and a pulse generated on write to register address. Register reads back 0. The "reset" attribute is for documentation only, as set externally.
w0Same as w, but auto-clears to 0 (and thus always reads as 0). At output port, signal will go high for one cycle when bit is written with a 1 (no effect if written to a 0). No "reset" attribute, as must always be 0.
rRead only value. Input ports generated for each field (where applicable), and concatenated on returned read data bus.
rpSimilar to r, but a pulse generated on a read access to the register address to allow peripheral logic to update value. The "reset" attribute is for documentation only, as set externally.
rwpSimilar to wp, but also generates a (separate) pulse on a read access to the register
bitdefDefines the bits used in the read, set, clear registers
  
SubypeDescription
unsignedRegister/field is specified as an unsigned value.
signedRegister/field is specified as a signed value.
<blank>Register/field sign status is not explicitly defined and defaults to unsigned.

Usage Notes

Usage of the interface to communicate with a slave device consists of sending an entry sequence (if none sent before) and then writing a byte to the SWIM_CSR register (at 0x7f80) to set the SWIM_DM bit and enable access to the slave's other registers etc. To send an entry sequence a write to the SWIM interface's CSR_SWIM_CONTROL register, setting SEND_ENTRY_SEQ bit, will instigate the operation. The TXBUSY bit of the CSR_SWIM_STATUS register will then go high until the operation has finished, or an error occurred. The TX_ERROR bit will be set if there was an error. Once an entry sequence has been sent, the ENTRY_SEQ_SENT bit of the CSR_SWIM_STATUS register will be set, and remain set until a hard reset. To send a byte to a given SWIM address, a write to the CSR_SWIM_TX_BYTE register, with the BYTE field set to the byte data, and the WADDR field set to the destination address. This will instigate a write over the SWIM and the TX_BUSY status will be set until the operation is complete or an error occurred. Any errors can be cleared by writing to the CSR_SWIM_CONTROL register wit the CLEAR_ERRORS bit set.

To read from a location of the slave's memory space, a write to the CSR_SWIM_RX_BYTE register, setting the WADDR field to be the location for the read, will instigate the read operation. Both the RXBUSY and TXBUSY status bit of the CSR_SWIM_STATUS register will initially go busy (as the read command is transmitted). When both statuses are clear, the operation completed, possibly with errors, as indicated by the TX_ERROR and RX_ERROR status bits. If the read was successful, the RX_READY bit will indicate the availability of a read byte. Reading the BYTE field of the CSR_SWIM_RX_BYTE register gives the value of the read operation. Note that reading the value does not clear the status. To clear the ready signal a write to the CSW_SWIM_CONTROL register with the CLR_RX bit set, will clear this state. All state can be cleared by writing to the CSR_SWIM_CONTROL register, with the RESET_STATE bit set.

An SRST command can be sent over the interface by writing to the CSR_SWIM_CONTROL register, with the SEND_SRST bit set. Whether the slave responds to this command is a matter of internal configuration of the slave. By default the interface is in low speed mode. It can be put into high speed mode by setting the HIGH_SPEED bit in the control register. THe slave interface also needs to be configured for the mode before entering the mode locally. NOTE: HIGH SPEED IS NOT YET FULLY SUPPORTED due to slew issues on the SOM board and work arounds in the embedded logic.

The interface supports the writing of 128 byte blocks for configuring flash on an STM8 MCU. The MCU must be unlocked and configured for flash writes using byte write accesses. Once done, a block is written by writing to the CSR_SWIM_TX_BLOCK register with the start address of the block write set in the WADDR field. The TXBUSY status will go busy until the command has been sent (or an error). At this point, the CSR_SWIM_BLK_REMAINING register indicates that 128 bytes are still to be transmitted. The bytes are transmitted byte writing each byte to the CSR_SWIM_PUSH_BYTE register. At each byte, the TXBUSY goes high until done (or error), and the CSR_SWIM_BLK_REMAINING register is decremented. Register writes that instigate a SWIM interface communication will be ignored if the busy statuses are set, and so these must be checked before each write.

More details on the SWIM interface protocol are at this link, and the STM8 MCU register map is defined in the STM8 datasheet at this link

 


Copyright © 2024 Global Inkjet Systems. Generated by gen_htm.py —2024-10-30 09:43