MPCM slave sample code?

Go To Last Post
2 posts / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does anyone have a fragment of Xmega MPCM slave sample code?

20.13.1 Using multiprocessor communication mode
The following procedure should be used to exchange data in multiprocessor communication mode (MPCM):
1. All slave MCUs are in multiprocessor communication mode.
2. The master MCU sends an address frame, and all slaves receive and read this frame.
3. Each slave MCU determines if it has been selected.
4. The addressed MCU will disable MPCM and receive all data frames. The other slave MCUs will ignore the data
5. When the addressed MCU has received the last data frame, it must enable MPCM again and wait for a new
address frame from the master.
The process then repeats from step 2.
Using any of the 5-bit to 8-bit character frame formats is impractical, as the receiver must change between using n and
n+1 character frame formats. This makes full-duplex operation difficult, since the transmitter and receiver must use the
same character size setting.


...and I understand that.  I have an AVR8 system with RS485 9-bit master, and many types of MPCM  slaves.  The above description from Xmega series manual follows that for AVR8.  Is it as simple as turning off USART_MPCM_bm in .CTRLB?


Here is my AVR8 fragment:


// UART Receiver interrupt service routine
interrupt [VECT_RXC] void 	uart_rx_isr			(void)
unsigned char status, control, data;

status = URA;
control = URB;
data = URD;
	//  Use MPCM to check to see if our address
if (status & MPCM_MODE)
	// Expecting an address frame
	if ((data & rx_address_mask) == rx_address)
		// Correct address seen.  Fall through to save the byte
		// Clear the MPCM bit to receive data characters
		URA &= ~(MPCM_MODE);
		// Not for us--ignore and continue in MPCM mode

... with rest of ISR to store the character into ring buffer and etc.

Then when the response packet from the slave to the master is fully transmitted, "URA |= MPCM_MODE;".


Identical procedure for Xmega?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0



I've just made MPCM work between two XMEGA256A4s yesterday. I used ASF though.


Here is my post about it (with source):