Upboard UART : Error initializing UART

kevinkkevink New Member Posts: 7

I am currently trying to set up my upboard to send and receive UART with a micro-controller and I am struggling to initialize the UART correctly.

I tried to run the commands given here: https://wiki.up-community.org/Pinout#GPIO_Example_.231
and received the error: stty: /dev/ttyS1: Input/output error

I then thought, "Oh well maybe mraa could figure this out," and the sample mraa uart code returned: ValueError: Error initializing UART

I am running ubuntu 16.04 and I've already tried reinstalling the upboard kernel following the instructions here: https://wiki.up-community.org/Ubuntu#Install_Ubuntu_for_UP.2C_UP2.2C_UP_Core_and_UP_Core_Plus_2

I've been searching the forums for solutions and have come up empty. Has anyone else had this experience? Could there be a step that I am missing? Thanks.

Comments

  • waynepiekarskiwaynepiekarski New Member Posts: 12

    I just received my Up Board and am having the same problem as well. /dev/ttyS1 returns "Input/output error" no matter what I do.

    In the BIOS settings, it looks like the pins are allocated to UART1. I am using Ubuntu 18.04, and the problem happens with a default install, as well as following the extra kernel installation instructions at https://wiki.up-community.org/Ubuntu#Ubuntu_18.04_installation_and_configuration

    I made a post in the Up Board Linux category in the hope that someone can provide guidance on this: https://forum.up-community.org/discussion/3649/input-output-error-accessing-dev-ttys1-on-ubuntu-18-04#latest

  • kevinkkevink New Member Posts: 7
    edited April 14

    Ok I finally fixed it. The UART appears to actually be running through /dev/ttyS4. The commands I linked above still don't appear to work. However, I am able to send and receive serial messages using the pyserial api.

    Try running this code with the UART tx and rx wired together with a jumper:

    import serial
    ser = serial.Serial('/dev/ttyS4')  # open serial port
    print(ser.name)         # check which port was really used
    
    ser.write('hello')      # write a string
    
    mes = ser.read(5)   # read that string 
    print(mes)
    
    ser.close()             # close port
    
  • waynepiekarskiwaynepiekarski New Member Posts: 12

    Ah yes, you are right, it is /dev/ttyS4. I used the following command with a wire connected from pin 8 to 10:

    picocom -b 115200 /dev/ttyS4

    If you can type and see the characters, it is working. I can now hook my GPS up and see the output too.

Sign In or Register to comment.