MKE06 Uart halt?

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

MKE06 Uart halt?

Jump to solution
807 Views
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

Labels (1)
1 Solution
645 Views
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

View solution in original post

3 Replies
646 Views
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

645 Views
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 Kudos
645 Views
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 Kudos