• Announcements

    • 1. Check power supply, check SD card and check other people experiences

      Power supply issues are one of the three biggest issues you'll face when starting with Single Board Computers (SBCs). SD card issues, whether fake or faulty, are another and issues resulting from poor board design is the other common issues you can encounter.   Power supply issues can be tricky. You might have a noisy power supply that works with one board because it has extra filtering, but won't work with another. Or you're using that cheap phone charger because your board has a microUSB connector, and it is either erratic, or doesn't start up, or even becomes the cause of some SD card issues.    Some tips to avoid the most common causes of problems reported:   Don't power via micro USB  - unless you have optimised your setup for low power requirements. Micro USB is great for mobile phones because they are simply charging a battery. It's bad for SBCs. Yes, it does work for a lot of people, but it also causes more problems and headaches over time than it is worth, unless you know exactly what you are doing. If you have a barrel jack power connector on your SBC, use it instead! If there is an option for powering via header connections, use that option!
        Don't use mobile phone chargers. They might be convenient and cheap, but this is because they are meant for charging phones, not powering your SBC which has particular power requirements.
        When you are evaluating a power supply, make sure you run some stress tests on your system to ensure that it will not cause issues down the path.   (Micro) SD card issues can be sneaky. They might appear right at the start causing strange boot and login errors, or they might cause problems over time. It is best to run a test on any new SD card you use, to ensure that it really is what it is, and to ensure that isn't faulty. Armbian provides you a simple way to do this   --   armbianmonitor -c /path/to/device/to/test  
    • 2. Make sure to collect and provide all necessary information

      We can only help if you provide quality information for us to work with. All stable images from the download section are tested, most stable upgrades are tested and we have tens of thousands of users. Even with regular and extensive testings, bugs sometimes do slip through. This is a voluntary support service and is unrelated to board makers, and is not obligated to provide you any answers. Repeated asking the same questions because you're not happy with the answers will result in you being ignored.

      Before you post a question, use the forum search as someone else might have already had the same problem and resolved it. And make sure you've read the Armbian documentation. If you still haven't found an answer, make sure you include the following in your post:   1. Logs when you can boot the board: armbianmonitor -u (paste URL to your forum post)   2. If your board does not boot, provide a log from serial console or at least make a picture, where it stops.   3. Describe the problem the best you can and provide all necessary info that we can reproduce the problem. We are not clairvoyant or mind readers. Please describe your setup as best as possible so we know what your operating environment is like.     We will not help in cases you are not using stable official Armbian builds, you have a problem with 3rd party hardware or reported problem would not be able to reproduced.

Detecting serial (uart) ports with Java
0

16 posts in this topic

Recommended Posts

Hi,

 

In my project I want to use UART on GPIO pin (8,10). I wrote a simple Java app to decet serial ports on my orange PC but it return only /dev/ttyS0 - Serial

 

Here is simple java code using rxtxlibrary..


package org.mbp;

import gnu.io.CommPortIdentifier;

/**
 *
 * @author Peter
 */
public class TestCom {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        System.out.println("-------------------------------");
        System.out.println(System.getProperty("java.version"));
        System.out.println(System.getProperty("os.name"));

        java.util.Enumeration<CommPortIdentifier> portEnum = CommPortIdentifier.getPortIdentifiers();
        while (portEnum.hasMoreElements()) {
            CommPortIdentifier portIdentifier = portEnum.nextElement();
            System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType()));
        }

    }

    static String getPortTypeName(int portType) {
        switch (portType) {
            case CommPortIdentifier.PORT_I2C:
                return "I2C";
            case CommPortIdentifier.PORT_PARALLEL:
                return "Parallel";
            case CommPortIdentifier.PORT_RAW:
                return "Raw";
            case CommPortIdentifier.PORT_RS485:
                return "RS485";
            case CommPortIdentifier.PORT_SERIAL:
                return "Serial";
            default:
                return "unknown type";
        }
    }

}

Whe I run the code on orangepiPC I get only one UART which is /dev/ttyS0

 

-------------------------------
1.7.0_121
Linux
/dev/ttyS0 - Serial
 
 
 
Is there some configuration file to enable / disable UARTS? 
 
 
thank you.

Share this post


Link to post
Share on other sites

Other UARTs are not enabled by default.

For Legacy, you need to edit the FEX.

For Mainline, where we have now overlays, you need to add them in the /boot/armbianEnv.txt :

overlays=sun8i-h3-uart1 sun8i-h3-uart2 sun8i-h3-uart3

Share this post


Link to post
Share on other sites

Ok!

 

will this be fine? will try.. thank you

verbosity=7
console=both
machid=1029
bootm_boot_mode=sec
rootdev=UUID=74434014-190f-406c-9b73-2c99c49383ba
rootfstype=ext4
overlays=sun8i-h3-uart1 sun8i-h3-uart2 sun8i-h3-uart3

Share this post


Link to post
Share on other sites

Hmm.. tryed but still get only one serial

cmd : cd '/home/projekt/NetBeansProjects//TestCom'; '/usr/bin/java'  -Dfile.encoding=UTF-8   -jar /home/projekt/NetBeansProjects//TestCom/dist/TestCom.jar 
-------------------------------
1.7.0_121
Linux
/dev/ttyS0 - Serial

Share this post


Link to post
Share on other sites

Are you sure you are using latest Mainline ?

Please, provide output of "uname -a" and "ls -l /boot/dtb/overlay" and "dmesg | grep serial" and "cat /proc/device-tree/soc/serial@01c28400/status"

Share this post


Link to post
Share on other sites

Thank you for your help!

 

here is

screenshot_193.jpg

 

for: ls -l /boot/dtb/overlay  

I don't have subdirectory dtb

screenshot_193.jpg

 

dmesg | grep serial

screenshot_193.jpg

 

 

cat /proc/device-..... (I don't have this folder)

screenshot_193.jpg

 

 

thank you for your help. I don't have much experience in linux but must do a project for thesis ;) ;(

Share this post


Link to post
Share on other sites

 

Other UARTs are not enabled by default.

For Legacy, you need to edit the FEX.

For Mainline, where we have now overlays, you need to add them in the /boot/armbianEnv.txt :

Hi

Does this means that it could be possible to change the use of the GPIO pins "on the fly"

I mean without rebooting.

Share this post


Link to post
Share on other sites

Hi

Does this means that it could be possible to change the use of the GPIO pins "on the fly"

I mean without rebooting.

 

Sure.  Just write a driver module that manipulates the proper bits in the setup registers, read the data sheet for your CPU and the kernel source code.  The "confidential" H3 data sheet is on the sunxi web site.  Apparently the H2 used on the opi zero is very close, but I have not found it's data sheet.  This is not something I would recommend for beginner programmers.

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

0

  • Support the project

    We need your help to stay focused on the project.

    Choose the amount and currency you would like to donate in below.