MicroWire Interface
7-45
MPU Public Peripherals
7.4.6
Example of Autotransmit Mode With DMA Support
The autotransmit mode and DMA mode are controlled by the setup 5 register
(SR5). The following example configures
µ
Wire for a 16-bit write access on
CS1 with serial clock out not inverted, CS auto toggle enabled, DMA request
enabled, and interrupt disabled:
1) Set up and enable the DMA channel.
2) Program the configuration registers SR1, SR3, and SR4.
3) Check CSRB status to ensure that the peripheral is ready to receive (low).
4) Program the control and status register (CSR) as follows:
J
NB_BITS_RD = 0
J
NB_BITS_WR = 16
J
INDEX = 00
J
CS_CMD: = 1
J
START = 0
5) Write to the setup register (SR5) to configure and initiate the transfer:
J
DMA_TX_EN = 1
J
IT_EN = 0
J
AUTO_TX_EN = 1
J
CS_TOGGLE_TX_EN = 1 (In AUTO TX mode, setting the
DMA_TX_EN bit to 1 starts the transfer)
6) When the DMA transfer is complete, check the status of CSRB to find
whether
µ
Wire has finished the serial data transfer.
7) Write to the setup register (SR5) to disable DMA and AUTO TX mode:
J
DMA_TX_EN = 0
J
IT_EN = 0
J
AUTO_TX_EN = 0
J
CS_TOGGLE_TX_EN = 0
Using Autostart and Autotoggle CS Mode
You must wait for a minimum of 2 x F_INT clock cycles after the end
of transfer (transition 1 to 0 detected on CSRB) before setting the
SR3 register to turn off the internal clock.