
Single Wire Protocol Master Interface (SWPMI)
RM0351
1496/1830
DocID024597 Rev 5
44.3.6
SWPMI frame handling
The SWP frame is composed of a Start of frame (SOF), a Payload from 1 to 30 bytes, a 16-
bit CRC and an End of frame (EOF) (Refer to
Figure 479: SWP frame structure
).
Figure 479. SWP frame structure
The SWPMI embeds one 32-bit data register for transmission (SWPMI_TDR), and one 32-
bit data register for reception (SWPMI_RDR).
In transmission, the SOF insertion, the CRC calculation and insertion, and the EOF insertion
are managed automatically by the SWPMI. The user only has to provide the Payload
content and size. A frame transmission starts as soon as data is written into the
SWPMI_TDR register. Dedicated flags indicate an empty transmit data register and a
complete frame transmission event.
In reception, the SOF deletion, the CRC calculation and checking, and the EOF deletion are
managed automatically by the SWPMI. The user only has to read the Payload content and
size. Dedicated flags indicate a full receive data register, a complete frame reception and
possibly CRC error events.
The stuffing bits insertion (in transmission) and stuffing bits deletion (in reception) are
managed automatically by the SWPMI core. These operations are transparent for the user.
44.3.7 Transmission
procedure
Before starting any frame transmission, the user must activate the SWP. Refer to
Section 44.3.2: SWP initialization and activation
There are several possible software implementations for a frame transmission: No software
buffer mode, Single software buffer mode, and Multi software buffer mode.
The software buffer usage requires the use of a DMA channel to transfer data from the
software buffer in the RAM memory to the transmit data register in the SWPMI peripheral.
No software buffer mode
This mode does not require the use of DMA. The SWP frame transmission handling is done
by polling status flags in the main loop or inside the SWPMI interrupt routine. There is a 32-
bit transmit data register (SWPMI_TDR) in the SWPMI, thus writing to this register will
trigger the transmission of up to 4 bytes.
The No software buffer mode is selected by clearing TXDMA bit in the SWPMI_CR register.
The frame transmission is started by the first write to the SWPMI_TDR register. The low
significant byte of the first 32-bit word (bits [7:0]) written into the SWPMI_TDR register)
indicates the number of data bytes in the payload, and the 3 other bytes of this word must
069
62)
(2)
&5&E\WHV
3$</2$'XSWRE\WHV
62) (K E
(2) )K E
'
'
'
͘͘͘