Closing an eTPU UART port

Discussion to talk about software related topics only.
Post Reply
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Closing an eTPU UART port

Post by v8dave »

How do I close an eTPU UART once it has been opened?

I need to open it at 9600 bps, reconfigure the device to talk at 115200, close the port and reopen at 115200.

I use the following to open the port.

eTPUFDUartOpen(RXD4, TXD4, 9600, 8, FS_ETPU_UART_NO_PARITY, FS_ETPU_PRIORITY_MIDDLE);

RXD4 and TXD4 being the eTPU ports I am using.

I tried calling eTPUCloseChannel(RXD4); to close the port but it fails then when I try to re-open the port with the following:

eTPUFDUartOpen(RXD4, TXD4, 115200, 8, FS_ETPU_UART_NO_PARITY, FS_ETPU_PRIORITY_MIDDLE);

Calling eTPUCloseChannel(TXD4); hangs the software also.

Dave...
v8dave
Posts: 333
Joined: Thu Dec 31, 2009 8:31 pm

Re: Closing an eTPU UART port

Post by v8dave »

In answer to my own post and for others, it seems the closing order is important.

eTPUCloseChannel(TXD4);
eTPUCloseChannel(RXD4);
//
// Open the port with the new baud rate
//
USBfd = eTPUFDUartOpen(RXD4, TXD4, 115200, 8, FS_ETPU_UART_NO_PARITY, FS_ETPU_PRIORITY_MIDDLE);

Trying to close the RXD port first then TXD crashes the software. The above now works.

Dave...
Post Reply