MKE06 Uart halt?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MKE06 Uart halt?

跳至解决方案
1,434 次查看
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,272 次查看
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,273 次查看
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,272 次查看
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,272 次查看
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 项奖励
回复