Datasheet

180
ATtiny828 [DATASHEET]
8371A–AVR–08/12
When using the feature without start interrupt, the start detection logic activates the internal 8 MHz oscillator and the
USART clock while the frame is being received, only. Other clocks remain stopped until the Receive Complete Interrupt
wakes up the MCU.
For more details, see “UCSRD – USART Control and Status Register D” on page 188.
17.9 Multi-processor Communication Mode
Setting the Multi-processor Communication Mode bit (MPCM) enables a filtering function of incoming frames received by
the USART receiver. Frames that do not contain address information will be ignored and not put into the receive buffer. In
a system with multiple MCUs that communicate via the same serial bus this effectively reduces the number of incoming
frames that has to be handled by the CPU. The transmitter is unaffected by the MPCM bit, but has to be used differently
when it is a part of a system utilizing the multi-processor communication mode.
If the receiver is set up to receive frames that contain 5 to 8 data bits, then the first stop bit indicates if the frame contains
data or address information. If the receiver is set up for frames with nine data bits, then the ninth bit (RXB8) is used for
identifying address and data frames. When the frame type bit (the first stop or the ninth bit) is one, the frame contains an
address. When the frame type bit is zero the frame is a data frame.
The multi-processor communication mode enables several slave MCUs to receive data from a master MCU. This is done
by first decoding an address frame to find out which MCU has been addressed. If a particular slave MCU has been
addressed, it will receive the following data frames as normal, while the other slave MCUs will ignore the received frames
until another address frame is received.
17.9.1 Using MPCM
For an MCU to act as a master MCU, it can use a 9-bit character frame format (UCSZ = 7). The ninth bit (TXB8) must be
set when an address frame is transmitted (TXB8 = 1), and cleared when a data frame is transmitted (TXB = 0) . In this
case, the slave MCUs must be set to use a 9-bit character frame format.
The following procedure should be used to exchange data in multi-processor communication mode:
1. All slave MCUs are set to multi-processor communication mode (MPCM = 1)
2. The master MCU sends an address frame, and all slaves receive and read this frame. In the slave MCUs, the RXC
flag is set as normal
3. Each slave MCU reads UDR and determines if it has been selected. If so, it clears the MPCM bit. Else, it waits for
the next address byte and keeps the MPCM setting
4. The addressed MCU will receive all data frames until a new address frame is received. The other slave MCUs,
which still have the MPCM bit set, will ignore the data frames
5. When the last data frame is received by the addressed MCU it sets the MPCM bit and waits for a new address
frame from master. The process then repeats from step 2
It is possible to use any of the 5- to 8-bit character frame formats, but impractical since the receiver must change
between using n and n+1 character frame formats. This makes full-duplex operation difficult since the transmitter and
receiver use the same character size setting. If 5- to 8-bit character frames are used, the transmitter must be set to use
two stop bits (USBS = 1), since the first stop bit is used for indicating the frame type.
Do not use Read-Modify-Write instructions (SBI and CBI) to set or clear the MPCM bit. The MPCM bit shares the same
I/O location as the TXC flag and this might accidentally be cleared when using SBI or CBI instructions.
17.10 Examples of Baud Rate Setting
Commonly used baud rates for asynchronous operation can be generated by using the UBRR settings in Table 63 to
Table 66. UBRR values which yield an actual baud rate differing less than 0.5% from the target baud rate, are shown in
bold. Higher error ratings are acceptable, but the receiver will have less noise resistance when the error ratings are high,