MCF5213 multidrop mode, how to transmit 9 bit

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MCF5213 multidrop mode, how to transmit 9 bit

ソリューションへジャンプ
2,292件の閲覧回数
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

ラベル(1)
0 件の賞賛
返信
1 解決策
1,273件の閲覧回数
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 件の賞賛
返信
2 返答(返信)
1,274件の閲覧回数
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 件の賞賛
返信
1,273件の閲覧回数
mstone59
Contributor II

Mark,

 

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

 

Kind Regards,

Mike Stone

0 件の賞賛
返信