
Single Wire Protocol Master Interface (SWPMI)
RM0351
1504/1830
DocID024597 Rev 5
In order to work with n reception buffers in RAM, the DMA channel or stream must be
configured in following mode (refer to DMA section):
•
memory to memory mode disabled,
•
memory increment mode enabled,
•
memory size set to 32-bit,
•
peripheral size set to 32-bit,
•
peripheral increment mode disabled,
•
circular mode enabled,
•
data transfer direction set to read from peripheral,
•
the number of words to be transfered must be set to 8 x n (8 words per buffer),
•
the source address is the SWPMI_TDR register,
•
the destination address is the buffer1 address in RAM
Then the user must:
1.
Set RXDMA in the SWPMI_CR register
2. Set RXBFIE in the SWPMI_IER register
3. Enable stream or channel in the DMA module.
In the SWPMI interrupt routine, the user must check RXBFF in the SWPMI_ISR register. If it
is set, the user must set CRXBFF bit in the SWPMI_ICR register to clear RXBFF flag and
the user can read the first frame payload received in the first buffer (at the RAM address set
in DMA2_CMAR1).
The number of data bytes in the payload is available in bits [23:16] of the last 8th word.
In the next SWPMI interrupt routine occurrence, the user will read the second frame
received in the second buffer (address set in DMA2 8), and so on (refer to
Figure 485: SWPMI Multi software buffer mode reception
).
In case the application software cannot ensure to handle the SMPMI interrupt before the
next frame reception, each buffer status is available in the most significant byte of the 8th
buffer word:
•
The CRC error flag (equivalent to RXBERF flag in the SWPMI_ISR register) is
available in bit 24 of the 8th word. Refer to
Section 44.3.9: Error management
for an
CRC error description.
•
The receive overrun flag (equivalent to RXOVRF flag in the SWPMI_ISR register) is
available in bit 25 of the 8th word. Refer to
Section 44.3.9: Error management
for an
overrun error description.
•
The receive buffer full flag (equivalent to RXBFF flag in the SWPMI_ISR register) is
available in bit 26 of the 8th word.
In case of a CRC error, both RXBFF and RXBERF flags are set, thus bit 24 and bit 26 are
set.
In case of an overrun, an overrun flag is set, thus bit 25 is set. The receive buffer full flag is
set only in case of an overrun during the last word reception; then, both bit 25 and bit 26 are
set for the current and the next frame reception.
The software can also read the DMA counter (number of data to transfer) in the DMA
registers in order to retrieve the frame which has already been received and transferred into
the RAM memory through DMA. For example, if the software works with 4 reception buffers,