MKE06 Uart halt?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,416件の閲覧回数
thaophan
Contributor II

Hi everyone

I have a struggle problem when using uart module in MKe06(I use codewarrior and processor expert)

My kit is slaver which connects with a master via uart/rs485( modbus RTU). The rs485 network consists of 8 slaver and 1 master. The network is good for several days but then my kit can not receive any byte from RX/Uart. the UART does not work  until i reset power of the kit. I haved cleared RX buffer frequently to avoid overload, however uart still halts again.

How could i solve this problem?

Thank you

ラベル(1)
1 解決策
1,254件の閲覧回数
mjbcswitzerland
Specialist V

Hi Thao

Check that you are handling Rx overruns since they will stop the Rx from operating until cleared.
Eg. (in Rx interrupt handler):

            ucState = UART0_S1;                                          //{92} update the status register
            if ((ucState & UART_S1_OR) != 0) {                           // if the overrun flag is set at this point it means that an overrun took place between reading the status register on entry to the interrupt and reading the data register
                (void)UART0_D;                                           // read the data register in order to clear the overrun flag and allow the receiver to continue operating
            }

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
KE06: http://www.utasker.com/kinetis/FRDM-KE06Z.html
UART: http://www.utasker.com/docs/uTasker/uTaskerUART.PDF
For the ultimate Modbus solution for all Kinetis parts: http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF

元の投稿で解決策を見る

3 返答(返信)
1,255件の閲覧回数
mjbcswitzerland
Specialist V

Hi Thao

Check that you are handling Rx overruns since they will stop the Rx from operating until cleared.
Eg. (in Rx interrupt handler):

            ucState = UART0_S1;                                          //{92} update the status register
            if ((ucState & UART_S1_OR) != 0) {                           // if the overrun flag is set at this point it means that an overrun took place between reading the status register on entry to the interrupt and reading the data register
                (void)UART0_D;                                           // read the data register in order to clear the overrun flag and allow the receiver to continue operating
            }

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
KE06: http://www.utasker.com/kinetis/FRDM-KE06Z.html
UART: http://www.utasker.com/docs/uTasker/uTaskerUART.PDF
For the ultimate Modbus solution for all Kinetis parts: http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF

1,254件の閲覧回数
thaophan
Contributor II

Hi Mark Butcher

My network has been good since i followed your guide. It is 2 weeks. That's wonderful.

Thank you very much.

0 件の賞賛
返信
1,254件の閲覧回数
thaophan
Contributor II

Hi Mark Butcher

Thank you for your respond.

When the communication fail I use geterror function. I see that Overrun counter count.

I have added the code to handler RX Overrun.

It takes several day to see what happens.

Hope it work.

I will update the result.

Thank you very much.

Best Regards 

Phan Thi Bich Thao

0 件の賞賛
返信