Single Wire Protocol Master Interface (SWPMI) RM0351
1374/1685 DocID024597 Rev 3
Single software buffer mode
This mode allows to receive a complete SWP frame without any CPU intervention using the
DMA. The DMA transfers received data from the 32-bit SWPMI_RDR register to the RAM
memory, and the software can poll the end of the frame reception using the SWPMI_RBFF
flag.
The Single software buffer mode is selected by setting RXDMA bit and clearing RXMODE
bit in the SWPMI_CR register.
The DMA must be configured as follows:
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 disabled,
• data transfer direction set to read from peripheral,
• the number of words to be transfered must be set to 8,
• the source address is the SWPMI_RDR register,
• the destination address is the SWP frame buffer in RAM.
Then the user must:
1. Set RXDMA bit in the SWPMI_CR register
2. Set RXBFIE bit in the SWPMI_IER register
3. Enable stream or channel in DMA module.
A DMA request is issued by SWPMI when RXNE flag is set in SWPMI_ISR. The RXNE flag
is cleared automatically when the DMA is reading the SWPMI_RDR register.
In the SWPMI interrupt routine, the user must check RXBFF bit in the SWPMI_ISR register.
If it is set, the user must:
1. Disable stream or channel in DMA module
2. Read the number of bytes in the received frame payload in the SWPMI_RFL register
3. Read the frame payload in the RAM buffer
4. Enable stream or channel in DMA module
5. Set CRXBFF bit in the SWPMI_ICR register to clear RXBFF flag (refer to Figure 461:
SWPMI single software buffer mode reception).