UART vs USB on MKL27Z

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

UART vs USB on MKL27Z

850 Views
joeygouly
Contributor IV

Hi,

Is there any issues to be aware of when trying to run USB and UART at the same time?

I used to have this working, but now I've come back to my code and I'm getting garbage output on UART.

If I remove my usb_init() function, the UART output is fine.

I can configure the LPUART to use either the LIRC or the IRC48 clock, while USB is running, right?

Could I need to disable/enable interrupts inside my uart_putc function? I didn't do that before..

Any other tips on what might be going wrong.

Thanks,

Joey

Labels (2)
0 Kudos
4 Replies

657 Views
joeygouly
Contributor IV

I think it was because I didn't have GND connected in my UART. I had the USB connected to one computer, and UART connected to another computer.

It's working now!

0 Kudos

657 Views
isaacavila
NXP Employee
NXP Employee

Hello Joey,

There should be no problem when using both peripherals. As previously suggested, you can analyze how these modules are being configurated and if sharing same clock source is the problem.

There are some examples for USB that use UART for their debug console, you can give a look to any example at KSDK 2.0 package for KL27 and corroborate if this same issue is shown in these examples codes: Software Development Kit for Kinetis MCUs|NXP .

I hope this can help you!

Regards,

Isaac

0 Kudos

657 Views
bobpaddock
Senior Contributor III

Is USB Clock Recovery enabled?  Does UART work differently if USB is connected or not?

Does UART work correctly at lower Baud?

0 Kudos

657 Views
mjbcswitzerland
Specialist V

Hi

There are no issues using USB and UARTS/LPUARTS at the same time.

See the following for references that do this:
- http://www.utasker.com/kinetis/FRDM-KL27Z.html
- http://www.utasker.com/kinetis/Capuccino-KL27.html

The only thing to possibly be aware of is if you use the IRC48M as clock source it will be drifting a little when USB is not connected but become locked to 48M form the host when it is (and USB crystal-less mode is in operation).
This could slighty change the UART speed in the two states but it shouldn't be noticeable in normal cases.

If you prefer an industrial quality out-of-the-box solution for the KL27 (with various proven USB classes: CDC, HID, MSD, Audio, RNDIS and optimised UART/LPUART with DMA support) for KDS, CW, IAR, Keil, Green Hills, Crossworks, CooCox, GCC, or VisualStudio Kinetis simulation you can get it from the links.

Regards

Mark

Kinetis for professionals: http://http://www.utasker.com/kinetis.html

0 Kudos