English
Language : 

PIC18F44J50-I Datasheet, PDF (281/562 Pages) Microchip Technology – 28/44-Pin, Low-Power, High-Performance USB Microcontrollers
19.4.4.1 DMACON1
The DMACON1 register is used to select the main oper-
ating mode of the SPI DMA module. The SSCON1 and
SSCON0 bits are used to control the slave select pin.
When MSSP2 is used in SPI Master mode with the SPI
DMA module, SSDMA can be controlled by the DMA
module as an output pin. If MSSP2 will be used to com-
municate with an SPI slave device that needs the SSx
pin to be toggled periodically, the SPI DMA hardware
can automatically be used to deassert SSx between
each byte, every two bytes or every four bytes.
Alternatively, user firmware can manually generate
slave select signals with normal general purpose I/O
pins, if required by the slave device(s).
When the TXINC bit is set, the TXADDR register will
automatically increment after each transmitted byte.
Automatic transmit address increment can be disabled
by clearing the TXINC bit. If the automatic transmit
address increment is disabled, each byte, which is out-
put on SDO2, will be the same (the contents of the
SRAM pointed to by the TXADDR register) for the
entire DMA transaction.
When the RXINC bit is set, the RXADDR register will
automatically increment after each received byte.
Automatic receive address increment can be disabled
by clearing the RXINC bit. If RXINC is disabled in
Full-Duplex or Half-Duplex Receive modes, all incom-
ing data bytes on SDI2 will overwrite the same memory
location pointed to by the RXADDR register. After the
SPI DMA transaction has completed, the last received
byte will reside in the memory location pointed to by the
RXADDR register.
The SPI DMA module can be used for either half-duplex
receive only communication, half-duplex transmit only
communication or full-duplex simultaneous transmit and
receive operations. All modes are available for both SPI
master and SPI slave configurations. The DUPLEX0
and DUPLEX1 bits can be used to select the desired
operating mode.
The behavior of the DLYINTEN bit varies greatly
depending on the SPI operating mode. For example
behavior for each of the modes, see Figure 19-3
through Figure 19-6.
SPI Slave mode, DLYINTEN = 1: In this mode, an
SSP2IF interrupt will be generated during a transfer if
the time between successful byte transmission events is
longer than the value set by the DLYCYC<3:0> bits in
the DMACON2 register. This interrupt allows slave
firmware to know that the master device is taking an
unusually large amount of time between byte transmis-
sions. For example, this information may be useful for
implementing application-defined communication proto-
cols, involving time-outs if the bus remains Idle for too
long. When DLYINTEN = 1, the DLYLVL<3:0> interrupts
occur normally according to the selected setting.
PIC18F46J50 FAMILY
SPI Slave mode, DLYINTEN = 0: In this mode, the
time-out-based interrupt is disabled. No additional
SSP2IF interrupt events will be generated by the SPI
DMA module, other than those indicated by the
INTLVL<3:0> bits in the DMACON2 register. In this
mode, always set DLYCYC<3:0> = 0000.
SPI Master mode, DLYINTEN = 0: The DLYCYC<3:0>
bits in the DMACON2 register determine the amount of
additional inter-byte delay, which is added by the SPI
DMA module during a transfer. The Master mode SS2
output feature may be used.
SPI Master mode, DLYINTEN = 1: The amount of
hardware overhead is slightly reduced in this mode,
and the minimum inter-byte delay is 8 TCY for FOSC/4,
9 TCY for FOSC/16 and 15 TCY for FOSC/64. This mode
can potentially be used to obtain slightly higher effec-
tive SPI bandwidth. In this mode, the SS2 control
feature cannot be used, and should always be disabled
(DMACON1<7:6> = 00). Additionally, the interrupt
generating hardware (used in Slave mode) remains
active. To avoid extraneous SSP2IF interrupt events,
set the DMACON2 delay bits, DLYCYC<3:0> = 1111,
and ensure that the SPI serial clock rate is no slower
than FOSC/64.
In SPI Master modes, the DMAEN bit is used to enable
the SPI DMA module and to initiate an SPI DMA trans-
action. After user firmware sets the DMAEN bit, the
DMA hardware will begin transmitting and/or receiving
data bytes according to the configuration used. In SPI
Slave modes, setting the DMAEN bit will finish the
initialization steps needed to prepare the SPI DMA
module for communication (which must still be initiated
by the master device).
To avoid possible data corruption, once the DMAEN bit
is set, user firmware should not attempt to modify any
of the MSSP2 or SPI DMA related registers, with the
exception of the INTLVL bits in the DMACON2 register.
If user firmware wants to halt an ongoing DMA transac-
tion, the DMAEN bit can be manually cleared by the
firmware. Clearing the DMAEN bit while a byte is
currently being transmitted will not immediately halt the
byte in progress. Instead, any byte currently in
progress will be completed before the MSSP2 and SPI
DMA modules go back to their Idle conditions. If user
firmware clears the DMAEN bit, the TXADDR,
RXADDR and DMABC registers will no longer update,
and the DMA module will no longer make any
additional read or writes to SRAM; therefore, state
information can be lost.
 2011 Microchip Technology Inc.
DS39931D-page 281