SWIM communication

We need to use the knowledge of the whole project, including: dma reception, capture timer, serial communication

Enter timing

Here Insert Picture Description
The whole process can be seen from the figure is divided into eight processes. I will be in front of the (1) (2), called into the timing of this process is to send a pulse to a specific SWIM pin. After this success into the timing of the transmission, the slave (slave) will return a response (ack).
(1) above the SWIM pin low 16us, SWIM activated state.
(2) send the following pulse.
Here Insert Picture Description
(3) After receiving a reply. We need to give him a certain time delay, the delay of this action is to give a stable HSI time to start.
(4) transmits the synchronization frames (128 * SWIM_CLK) Here, at least greater than 64 are counted as successful synchronization frames (SWIM_CLK = 1/2 HSI) .
(5) the release of SWIM has been prepared to ensure good communication.
(6) Configuration Register SWIM-CSR (write 0xA0)
(. 7) and wait for 1ms synchronization reset release.
After the above steps have been successfully entered SWIM mode, and can be completed ROTF, WOTF two underlying function mode after entering the SWIM.
Note: After entering the SWIM "1" and "0" is not our traditional format of. Here there is a defined bit format. Default is a low-speed bit format
Here Insert Picture Description
0:20 pulses is 0, 1 pulse is
1:20 pulses is 0 is 1, 2 pulses.

Communication format

Here Insert Picture Description
Here Insert Picture Description

ROTF

Here Insert Picture Description
Note: N is the number of read maximum bit 255
@ E @ H @ L: 24-bit address
read out is the data bit format here, we need to determine the length is determined by a low level is 0 or 1.
Here are recommended hardware capture. Software difficult to achieve a successful capture.

WOTF

Here Insert Picture Description
Note: N is the number of read maximum bit 255
@ E @ H @ L: 24-bit addresses
need to be set to position slave resources after SWIM_DM bit before writing here, or can only access SWIM_CSR register.

Guess you like

Origin blog.csdn.net/qq_43448742/article/details/89635379