Author Topic: Using Raspberry Pi to read Evalboard  (Read 166 times)

0 Members and 1 Guest are viewing this topic.

Offline generic_username

  • Regular Contributor
  • *
  • Posts: 56
  • Country: at
Using Raspberry Pi to read Evalboard
« on: June 29, 2020, 11:58:08 am »
Hello,

I'm new to Raspberry PI and Linux.

I have a Microchip Xplained Board with a SAMD20 and a USB to Serial converter built in.
baud = 115200 /no parity

All I want to see is if I'm sending something to the device , I'll get a response.
The device is connected via USB.
Using Putty under windows for reading the serial, itworks as intended.

So I tried searching the web for 2 hours now to no success so far.
My guess it's a really noobish Mistake I'm making.

using
lsusb

I get Bus 001 Device 006: ID 03eb:2111 Atmel Corp

great so I know the device recongnizes the Evalboard so, at least to my understanding I don't need to find a driver for that to work.

Anyhow I'm a little lost how to connect to the device via serial, as I tried using putty and typed in instead of
/dev/ttyS0
/dev/ttyUSB6
that was a total failure. (guess I was naive thinking it would work that way)

I tried various other things I found on forums but with no succes.
All I could find so far were some python and shell scripts which I tried but nothing worked.

Can anyone give me a tip to solve this issue?

cheers

 
I always need 3 attempts to plug in a USB connector
 

Offline Twoflower

  • Frequent Contributor
  • **
  • Posts: 547
  • Country: de
Re: Using Raspberry Pi to read Evalboard
« Reply #1 on: June 29, 2020, 12:48:54 pm »
If you use the USB to UART circuit you probably need to figure out the right UART number. The lsusb tells you that the Atmel is actually connected as USB device number 6. This has nothing to do with the UART number. So try

dmesg | grep tty

You'll probably see some /dev/ttyAMA0 and another ttyAMA<x> message. The ttyAMA0 is the build in so ignore that and use the other. If not, you probably need a driver for the Atmel chip first. Not sure here, but eventually a lsmod might show the loaded drivers.

If you found the tty-port you're good for a quick check if you can send and receive something over the UART. In a bash-shell a simple (replace the 0 of the ttyAMA0 to the matching number)

stty -F /dev/ttyAMA0 115200 cs8 -cstopb -ixon -ixoff -crtscts -hup -parenb -echo
echo -ne "message to TTY\r" > /dev/ttyAMA0
cat /dev/ttyAMA0


should do the trick for a basic test. The first line set the UART config, the second sends a message and the third listen to any incoming data. If you have a scope you might check for any action to see if you're talking to the correct UART. Using the ttyAMA0 is the build in UART of the RasPi. If you want to use that one you'll see lots of action going on there as normally the kernel prints out the dmesg messages there. To silence that is a bit tricky (at least on ArchLinux).
 
The following users thanked this post: generic_username

Offline generic_username

  • Regular Contributor
  • *
  • Posts: 56
  • Country: at
Re: Using Raspberry Pi to read Evalboard
« Reply #2 on: June 30, 2020, 12:24:51 pm »
Hi,

thx for the answer, I tried using the
dmesg | grep tty but couldn't see anymore devices than ttyAMA0

with lsmod i can see some drivers but no atmel or EDBG driver (which is the onboard chip)
For now I didn't have much luck with the driver so
now I'm using the PI's Serial as I have access to the serial port on the Evalboard.

If I can make it work I'll update this post how I did it.

I always need 3 attempts to plug in a USB connector
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1148
  • Country: fi
Re: Using Raspberry Pi to read Evalboard
« Reply #3 on: June 30, 2020, 02:24:40 pm »
Is the board's serial port class-compliant?

Edit: "sudo lsusb -vvv" will print much more info about the connected USB devices, and should tell you what device type Linux thinks it is.
« Last Edit: June 30, 2020, 09:05:46 pm by andersm »
 

Offline generic_username

  • Regular Contributor
  • *
  • Posts: 56
  • Country: at
Re: Using Raspberry Pi to read Evalboard
« Reply #4 on: Yesterday at 05:50:50 am »
Thanks everyone for the answers.

It turned out to be really simple.

I tried putty with ttyACM0 as my serial
and had to enable flow control RTS and CTS

As a beginner with unix this helped me unterstanding a little bit
https://rfc1149.net/blog/2013/03/05/what-is-the-difference-between-devttyusbx-and-devttyacmx/




 
I always need 3 attempts to plug in a USB connector
 

Offline Twoflower

  • Frequent Contributor
  • **
  • Posts: 547
  • Country: de
Re: Using Raspberry Pi to read Evalboard
« Reply #5 on: Yesterday at 10:25:20 am »
Nice you got that working :-)

One note to the ttyAMA0. I mentioned earlier that you might see some additional traffic there. At least on ArchLinux that UART is used to dump out the dmesg log. Pretty annoying and it took me some time to a) figure out what's going on (for me it confirmed the UART decoder in my Rigol Scope works) and b) to silence that.

For me two things helped:
1. Get rid of the boot-messages by edit the cmdline.txt in /boot/ . Change the  console=tty0 to  console=tty1. Note: Removing the part from the command-line didn't work for me.
2. There is a getty service running (could be an ArchLinux thing) which took me quite some time to really get rid of it as the service got restarted all the time. So in the end I edited the file /usr/lib/systemd/system/getty@.service to use tty1 instead tty0 as well.


Some more infos that might be useful:
You should first check which /dev/tty* devices are actually there by use ls /dev/tty* (and not all of them are physical devices). On my RasPi3 with ArchLinux I only see tty, tty0...63, ttyprintk (all of them are virtual devices) and ttyAMA0. So no ttyUSB (obviously no USB-UART connected) and also no ttyACM. After connecting an USB-UART (SiLabs CP210x) I also got the device /dev/ttyusb0 (lsusb shows in my case the USB device 4 is used). And the dmesg log had the entry
usb 1-1.2: cp210x converter now attached to ttyUSB0
So maybe you should re-try using the USB part to see if it appears magically.

You can check the 'usable' tty device classes by
sudo cat /proc/tty/drivers

The first column shows the driver, the second the 'class' like /ttyAMA or /tty/USB (no numbers), the third one the class number according to the Kernel Doc. Any used drivers can be found in the /proc/tty/drivers/ subdirectory. You can read them (sudo cat /proc/tty/driver/usbserial). But how much of use that brings  :-//
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf