How To RS485 with KSDK component fsl_uart

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

How To RS485 with KSDK component fsl_uart

Jump to solution
1,928 Views
holyhope
Contributor III

Hi to all

I'm doing RS-485 on K60 uP for using KSDK 1.1.0 (working on KDS 2.0.0)

On K20 without KSDK I use LDD uart component where is present TX-Complete-Callback, so here I can set "Receiving" the direction for RS485 converter

In KSDK I use this component: fsl_uart

Now there is not any callback on TX (from KDSK 1.0.0 to KDSK 1.1.0 were available RX callback, very usefull, but nothing about TX callback).

I try to set the  "Install Interrupt" and I see the Interrupt RX and TX but, analyzing inside IRQ, there is only present the call at this HAL:

UART_HAL_IsTxDataRegEmpty

that tell me when tx data register is empty so we can put another byte in the buffer... but what I need is that hal:

UART_HAL_IsTxComplete(baseAddr))

that tell  me WHEN ALL BYTE WERE SEND. this function hal was called only on deinit function.

So I can't wait (I'm using FreeRTOS) in a loop the return of UART_HAL_IsTxComplete set to one... for the same reason I can't do a several of wait of FreeRTOS and check the UART_HAL_IsTxComplete (maybe RX started when i'm still waiting... and direction bit is still on tx)

what I need is ( LIKE THE LDD COMPONENT ) a callback for the interrupt of TX-complete.

Or I need the active interrupt (on IRQ internal handler of processor expert) for TX-complete.

What I can do with processor expert? If is not possible to install this interrupt handler or callback with processor expert, what I can do "manually" ?

Many thanks

0 Kudos
1 Solution
759 Views
vfilip
NXP Employee
NXP Employee

Hi,

installing tx callback will be supported in fsl_uart, fsl_lpuart, fsl_lpsci componnents from 1.2.0 PEx for Kinetis SDK. This release is scheduled on beginning of Q2.

Best regards

Vojtech Filip

View solution in original post

0 Kudos
4 Replies
759 Views
dmarks_ls
Senior Contributor I

Alternately, if the pin is available, you could use the RTS function for the UART to control the DE line of your RS-485 transceiver.  Set bits TXRTSE (assert RTS during transmission) and TXRTSPOL (RTS is active high) in register UARTx_MODEM, and set the appropriate PCS MUX register for the specific GPIO you're using for RTS.  That way, you don't have to enable any special software to get RS-485 driver control.

Unfortunately, in their infinite wisdom, Freescale removed RTS/CTS support from the UART in the Kinetis L series, so for our KL17 project, we'll likely have to wait for KSDK support for the Tx complete callback.  It amazes me it's taking Freescale this long to develop software for their own products.

0 Kudos
759 Views
holyhope
Contributor III

Perfect, many thanks.

Support of uP K20 will be in  KSDK .release 1.2.0?

0 Kudos
759 Views
vfilip
NXP Employee
NXP Employee

Hello,

yes, this family is part of KSDK 1.2.0

Best regards

Vojtech Filip

0 Kudos
760 Views
vfilip
NXP Employee
NXP Employee

Hi,

installing tx callback will be supported in fsl_uart, fsl_lpuart, fsl_lpsci componnents from 1.2.0 PEx for Kinetis SDK. This release is scheduled on beginning of Q2.

Best regards

Vojtech Filip

0 Kudos