1 1
jimg

how to enable UART on Nano Pi K2?

Recommended Posts

How do you enable the UART GPIO serial port (i.e., the one on pins 8 & 10) on a Nano Pi K2? The only active serial port I see from `dmesg | grep serial` is ttyAML0, which I'm assuming is the serial port on the debugging pins.  FWIW,  I'm using the 4.14.69-meson64 kernel on a Nano Pi K2.

Share this post


Link to post
Share on other sites

Basically the UART needs enabled in the device tree.  I haven't checked it, but

 

image.png.d9b32157513fc55f4271384dd5113617.png

 

UART C, it looks like.  Since this is a Pi-factor board, I'll look into enabling that.

 

[edit] I also see the bluetooth uart is disabled, it's in the device tree but not enabled by default.  :huh:

Share this post


Link to post
Share on other sites

Thanks!  Would it have been possible to resolve this as a DT overlay?  I found an overlay that enabled UART_C on the nano pi k2, so I tried:

armbian-add-overlay uart_c_on.dts

I first got the error"Overlays are supported only on A10, A20, H3, H5 and A64 based boards", so I commented out the test for the sunxi boards in the scirpt.

I then got the error "Overlays are supported only on mainline kernel based images".  I thought I had a mainline kernel, so I commenented that test out, too.

The final error was "Error: dtc does not support compiling overlays".  I don't know how to get an overlay-compatible device tree compiler, so I gave up.:(

Share this post


Link to post
Share on other sites

Overlays are not on enabled on these boards yet, it's quite a bit of work that I haven't gotten into. 

 

I have tried to enable it (and the bluetooth uart) the most straightforward way on a  fresh build, however it only added an error about the bluetooth uart, it is not working yet.  I'm not deep enough to see what's going on, so the probing failed, but nothing else showed up.  I don't know if @Neil Armstrong has any input on why the uart C isn't coming up, in the meantime I'll take another look.

 

 

 

Share this post


Link to post
Share on other sites

Thanks for all your work.  I really appreciate it.  FWIW, I need uart C more than I need BT.  

 

I don't suppose using the newer 4.17 kernel instead of 4.14 would help, would it?

 

I'm currently using the UART on an Odroid C2 (different board but same SoC), but that's using the legacy kernel.  I really like the features and performance (and cost!) of the Nano Pi K2 better.

Share this post


Link to post
Share on other sites

@TonyMac32 If you remember, I was working on UARTC overlay 2 days ago, I figured out why the overlay wasn't loading : simply that Main DT didn't have an alias predefined for it.

But, although the overlay was then loading fine, the UART loopback test didn't work ... :( Trying to dig the issue, I've discovered this thread ...

 

@Neil Armstrong Seeing this patch, I gave it a try, it worked ! :rolleyes:

Do you know why this patch isn't in Mainline yet, although this patch exist since June, and those previous faulty pins exist since more than 2 years ?

 

@jimg If you build you own image for DEV NanoPi-K2, you will get it working ... Otherwise, wait any offical DEV build.

Share this post


Link to post
Share on other sites
Just now, martinayotte said:

Especially when driving ... :lol:

 

:lol: I get yelled at by my wife because I don't answer the phone when driving unless my car is sync'd over Bluetooth...  In reality though I should set up some kind of task list, @jimg isn't the first person who's issue went unresolved for way longer than it should have...

Share this post


Link to post
Share on other sites

Thanks for following up on this!  Glad to hear it's finally going to be fixed. :)  I'm excited to see work going forward on the 4.19 kernel, too. 

Share this post


Link to post
Share on other sites

Thanks, everyone, for all your work.  I installed the 4.19 Beta image, added the following line to /boot/armbianEnv.txt:

 

overlays=uartC

rebooted, and now the UART works!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1