MCF5213 multidrop mode, how to transmit 9 bit

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCF5213 multidrop mode, how to transmit 9 bit

Jump to solution
1,379 Views
mstone59
Contributor II

Hello,

I am trying to implement a 9-bit protocol on the 5213. I have the receiver working fine, but the transmitter I can't get to add the 9th bit, 1 for first char of msg, 0 for the rest of msg. I'm setting the PM & PT bits in the mode register to address for the first char, then data for the rest, but the bit won't change. Does anyone have an example or know how to do this?

Thank You,

Mike

Labels (1)
0 Kudos
1 Solution
360 Views
mjbcswitzerland
Specialist V

Hi Mike

 

To do this you need to allow the first byte (with settings PM=11 and PT=1) to be transmitted.

When this has completd (eg. its interrupt arrives) you can change the setting and send the next byte. It does say in the manual that the change must be performed before the transmitter is enabled and before the next byte has been copied, but it works the same disabling the transmitter or not.

 

To change the mode, you have to be careful with the UMR1 register since it has to be selected before access. It is often easiest to keep a backup of the register content since any read/write will cause the internal pointer to increment to UMR2, thus making changes like UMR1 |= 0x01; impossible.

 

The sequence is

 

*UCR_X = UART_RESET_CMD_PTR;      // reset the internal pointer to UMR1 (rather than URM2)

*UMR1_2_X = (UART_NO_PARITY | UART_MULTIDROP | UART_8_BIT); // value eg. 0x1b for data mode

Then send the next character as normal.

 

To set the address mode back

*UCR_X = UART_RESET_CMD_PTR;     // reset the internal pointer to UMR1 (rather than URM2)

*UMR1_2_X = (UART_NO_PARITY | UART_MULTIDROP | UART_8_BIT | ADD_CHAR); // value eg. 0x1f for address mode

Then send the address character.

 

This mode is not suitable for DMA transmission since the change needs to be made actively in code between characters.

 

Good luck

 

Regards

 

Mark

 

www.uTasker.com

 

 

 

 

View solution in original post

0 Kudos
2 Replies
361 Views
mjbcswitzerland
Specialist V

Hi Mike

 

To do this you need to allow the first byte (with settings PM=11 and PT=1) to be transmitted.

When this has completd (eg. its interrupt arrives) you can change the setting and send the next byte. It does say in the manual that the change must be performed before the transmitter is enabled and before the next byte has been copied, but it works the same disabling the transmitter or not.

 

To change the mode, you have to be careful with the UMR1 register since it has to be selected before access. It is often easiest to keep a backup of the register content since any read/write will cause the internal pointer to increment to UMR2, thus making changes like UMR1 |= 0x01; impossible.

 

The sequence is

 

*UCR_X = UART_RESET_CMD_PTR;      // reset the internal pointer to UMR1 (rather than URM2)

*UMR1_2_X = (UART_NO_PARITY | UART_MULTIDROP | UART_8_BIT); // value eg. 0x1b for data mode

Then send the next character as normal.

 

To set the address mode back

*UCR_X = UART_RESET_CMD_PTR;     // reset the internal pointer to UMR1 (rather than URM2)

*UMR1_2_X = (UART_NO_PARITY | UART_MULTIDROP | UART_8_BIT | ADD_CHAR); // value eg. 0x1f for address mode

Then send the address character.

 

This mode is not suitable for DMA transmission since the change needs to be made actively in code between characters.

 

Good luck

 

Regards

 

Mark

 

www.uTasker.com

 

 

 

 

0 Kudos
360 Views
mstone59
Contributor II

Mark,

 

That did it! I forgot to reset the mode register pointer. Thank you very much!

 

Kind Regards,

Mike Stone

0 Kudos