Go to Post For Pete's sake, don't concentrate on the entry itself... concentrate on what your team is doing to make an impact in your community. - Andy Baker [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-04-2016, 16:58
Matthew Zwinger's Avatar
Matthew Zwinger Matthew Zwinger is offline
Head Of App Development
FRC #2169 (KING TeC)
Team Role: Programmer
 
Join Date: Mar 2016
Rookie Year: 2013
Location: Prior Lake MN
Posts: 2
Matthew Zwinger is an unknown quantity at this point
Serial Port Communication

In java we are using serial port.port.kusb on a 9600 baudrate with a nvidia tegra serial port. When we try testing the tegra serial with an arduino it returns garbage askII characters. eg.(Python)ser.write('hello'.encode('utf-8')). The communication port returns this ░:: and then goes to a newline.

Any help would be very welcome.
Reply With Quote
  #2   Spotlight this post!  
Unread 05-04-2016, 17:56
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,620
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Serial Port Communication

Quote:
Originally Posted by Matthew Zwinger View Post
In java we are using serial port.port.kusb on a 9600 baudrate with a nvidia tegra serial port. When we try testing the tegra serial with an arduino it returns garbage askII characters. eg.(Python)ser.write('hello'.encode('utf-8')). The communication port returns this ░:: and then goes to a newline.

Any help would be very welcome.
Couple of thoughts:

1. Are you able to decode UTF-8 correctly and why not use ASCII?
2. Stop bits? Data bits? Flow control?
3. How are you deriving your clock for the serial on the Arduino?
4. Which equipment is setup for DTE and which DCE?

Know nothing about serial hides the Trellis modems under the couch.

Last edited by techhelpbb : 05-04-2016 at 17:59.
Reply With Quote
  #3   Spotlight this post!  
Unread 05-04-2016, 18:25
Tyguy56 Tyguy56 is offline
Registered User
FTC #3385
 
Join Date: Feb 2013
Location: Minnesota
Posts: 6
Tyguy56 is on a distinguished road
Re: Serial Port Communication

Quote:
Originally Posted by techhelpbb View Post
Couple of thoughts:

1. Are you able to decode UTF-8 correctly and why not use ASCII?
2. Stop bits? Data bits? Flow control?
3. How are you deriving your clock for the serial on the Arduino?
4. Which equipment is setup for DTE and which DCE?

Know nothing about serial hides the Trellis modems under the couch.
1. If we encode it or not it still returns garbage ascii characters
2. stopbits 1
3. The hardware it setup with only Tx, Rx, and Gnd. Does the Rio have the other lines? Do you know if Arduino has the other lines as well?

our setup is the serial port on the tegra into the arduino using the tx rx and gnd from there a usb cable into a computer with putty to monitor the com port

simple serial code (python)

Code:
    import serial
    ser = serial.Serial(
        port='/dev/ttyS0',
        baudrate = 115200,
        parity=serial.PARITY_NONE
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS
        )
    if(ser.isOpen()):
        ser.close()
    ser.open()
    ser.write('hello'.encode('utf-8'))
Reply With Quote
  #4   Spotlight this post!  
Unread 05-04-2016, 18:44
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,620
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Serial Port Communication

Quote:
Originally Posted by Tyguy56 View Post

Code:
    import serial
    ser = serial.Serial(
        port='/dev/ttyS0',
        baudrate = 115200,
        parity=serial.PARITY_NONE
        stopbits=serial.STOPBITS_ONE,
        bytesize=serial.EIGHTBITS
        )
    if(ser.isOpen()):
        ser.close()
    ser.open()
    ser.write('hello'.encode('utf-8'))
Uhm your first post said 9600 baud.
Are you using 115200 to the Arduino but only 9600 between the Arduino and the Tegra?
Reply With Quote
  #5   Spotlight this post!  
Unread 05-04-2016, 18:50
Tyguy56 Tyguy56 is offline
Registered User
FTC #3385
 
Join Date: Feb 2013
Location: Minnesota
Posts: 6
Tyguy56 is on a distinguished road
Re: Serial Port Communication

Quote:
Originally Posted by techhelpbb View Post
Uhm your first post said 9600 baud.
Are you using 115200 to the Arduino but only 9600 between the Arduino and the Tegra?
sorry forgot to update the post, no we are using the same baudrate
Reply With Quote
  #6   Spotlight this post!  
Unread 05-04-2016, 19:04
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Serial Port Communication

Quote:
Originally Posted by Matthew Zwinger View Post
In java we are using serial port.port.kusb on a 9600 baudrate...
Your code says you're transmitting at 115200. That would definitely give you the kind of short garbled results that you describe.

Quote:
When we try testing the tegra serial with an arduino it returns garbage askII characters. eg.(Python)ser.write('hello'.encode('utf-8')). The communication port returns this ░:: and then goes to a newline.
Why are you encoding as UTF-8? It does end up being the same actual byte stream for straight ASCII* characters, but anything outside the ASCII range will be sent as multiple bytes that your terminal might not understand.



* American Standard Code for Information Interchange, pronounced "ask-ee"
Reply With Quote
  #7   Spotlight this post!  
Unread 05-04-2016, 19:28
Tyguy56 Tyguy56 is offline
Registered User
FTC #3385
 
Join Date: Feb 2013
Location: Minnesota
Posts: 6
Tyguy56 is on a distinguished road
Re: Serial Port Communication

Quote:
Originally Posted by Alan Anderson View Post
Your code says you're transmitting at 115200. That would definitely give you the kind of short garbled results that you describe.



Why are you encoding as UTF-8? It does end up being the same actual byte stream for straight ASCII* characters, but anything outside the ASCII range will be sent as multiple bytes that your terminal might not understand.



* American Standard Code for Information Interchange, pronounced "ask-ee"


sorry im new to serial coms would it be better to not encode at all?
if I run at 9600 baudrate and no encoding with the same setup (tegra serial port to arduino and arduino to computer then open com port on putty) it only returns ░:: h̶o̶w̶e̶v̶e̶r̶ ̶a̶f̶t̶e̶r̶ ̶t̶e̶s̶t̶i̶n̶g̶ ̶a̶d̶d̶i̶t̶i̶o̶n̶a̶l̶l̶y̶ ̶w̶h̶e̶n̶ ̶t̶h̶e̶ ̶s̶a̶m̶e̶ ̶s̶e̶t̶u̶p̶ ̶i̶s̶ ̶r̶a̶n̶ ̶o̶n̶ ̶t̶h̶e̶ ̶r̶o̶b̶o̶r̶i̶o̶ ̶i̶t̶ ̶w̶i̶l̶l̶ ̶r̶e̶t̶u̶r̶n̶ ̶w̶h̶a̶t̶ ̶I̶ ̶a̶s̶s̶u̶m̶e̶ ̶i̶s̶ ̶r̶a̶n̶d̶o̶m̶ ̶b̶y̶t̶e̶s̶ ̶e̶g̶.̶ ̶[̶B̶@̶8̶c̶f̶4̶c̶6̶[̶B̶@̶e̶d̶c̶d̶2̶1̶[̶B̶@̶c̶4̶5̶d̶c̶a̶ ̶e̶t̶c̶ ̶e̶t̶c̶ ̶w̶i̶t̶h̶ ̶n̶o̶ ̶p̶a̶t̶t̶e̶r̶n̶ ̶
̶U̶P̶D̶A̶T̶E̶ ̶I̶ ̶a̶l̶s̶o̶ ̶n̶o̶w̶ ̶g̶e̶t̶ ̶e̶r̶r̶o̶r̶s̶ ̶i̶n̶ ̶m̶y̶ ̶r̶i̶o̶l̶o̶g̶ ̶w̶h̶i̶c̶h̶ ̶s̶a̶y̶ ̶W̶A̶R̶N̶I̶N̶G̶:̶ ̶R̶o̶b̶o̶t̶s̶ ̶d̶o̶n̶'̶t̶ ̶q̶u̶i̶t̶

Last edited by Tyguy56 : 05-04-2016 at 19:38.
Reply With Quote
  #8   Spotlight this post!  
Unread 05-04-2016, 19:33
Tyguy56 Tyguy56 is offline
Registered User
FTC #3385
 
Join Date: Feb 2013
Location: Minnesota
Posts: 6
Tyguy56 is on a distinguished road
Re: Serial Port Communication

Okay fixed a couple errors, hooked it up to the roborio and initiated a serial connection there at 9600 baudrate now it prints out to the riolog when I do a system.out.println(serial.readString()) however I am doing no encoding so just ser.write('hello') I am now getting in my riolog ?::
Reply With Quote
  #9   Spotlight this post!  
Unread 05-04-2016, 19:52
orangelight's Avatar
orangelight orangelight is offline
Registered User
AKA: Alex
FRC #0548 (Robostangs)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Northville
Posts: 166
orangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to behold
Re: Serial Port Communication

Quote:
Originally Posted by Tyguy56 View Post
Okay fixed a couple errors, hooked it up to the roborio and initiated a serial connection there at 9600 baudrate now it prints out to the riolog when I do a system.out.println(serial.readString()) however I am doing no encoding so just ser.write('hello') I am now getting in my riolog ?::
This thread might help you
__________________


Reply With Quote
  #10   Spotlight this post!  
Unread 05-04-2016, 20:47
Tyguy56 Tyguy56 is offline
Registered User
FTC #3385
 
Join Date: Feb 2013
Location: Minnesota
Posts: 6
Tyguy56 is on a distinguished road
Re: Serial Port Communication

Thank you everyone, after going to http://www.chiefdelphi.com/forums/sh...d.php?t=132680 (special thanks to orangelight for the link) we learned that another team solved this by using the usb port instead of the serial port and then used a usb prolific rs-232 converter directly into the rio. Thank you all for your help!
Reply With Quote
  #11   Spotlight this post!  
Unread 06-04-2016, 06:54
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,620
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Serial Port Communication

Quote:
Originally Posted by Tyguy56 View Post
Thank you everyone, after going to http://www.chiefdelphi.com/forums/sh...d.php?t=132680 (special thanks to orangelight for the link) we learned that another team solved this by using the usb port instead of the serial port and then used a usb prolific rs-232 converter directly into the rio. Thank you all for your help!
So you worked around it.
It seems like a timing issue.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:42.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi