Using Raspberry Pi to read Evalboard - Page 1
Forum section: electronics / general

author: generic_username
author_rank: Regular Contributor
timestamp: June 29, 2020, 11:58:08 am
content: 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 parityAll 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.usinglsusbI get Bus 001 Device 006: ID 03eb:2111 Atmel Corpgreat 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/ttyUSB6that 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

author: Twoflower
author_rank: Frequent Contributor
timestamp: June 29, 2020, 12:48:54 pm
content: 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 trydmesg | grep ttyYou'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 -echoecho -ne "message to TTY\r" > /dev/ttyAMA0cat /dev/ttyAMA0should 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).

author: generic_username
author_rank: Regular Contributor
timestamp: June 30, 2020, 12:24:51 pm
content: Hi,thx for the answer, I tried using thedmesg | grep tty but couldn't see anymore devices than ttyAMA0with 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 sonow 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.

author: andersm
author_rank: Super Contributor
timestamp: June 30, 2020, 02:24:40 pm
content: 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.

author: generic_username
author_rank: Regular Contributor
timestamp: July 03, 2020, 05:50:50 am
content: Thanks everyone for the answers.It turned out to be really simple.I tried putty with ttyACM0 as my serialand had to enable flow control RTS and CTSAs a beginner with unix this helped me unterstanding a little bithttps://rfc1149.net/blog/2013/03/05/what-is-the-difference-between-devttyusbx-and-devttyacmx/

author: Twoflower
author_rank: Frequent Contributor
timestamp: July 03, 2020, 10:25:20 am
content: 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 agettyservice 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@.serviceto 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 usels /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 entryusb 1-1.2: cp210x converter now attached to ttyUSB0So maybe you should re-try using the USB part to see if it appears magically.You can check the 'usable' tty device classes bysudo cat /proc/tty/driversThe first column shows the driver, the second the 'class' like /ttyAMA or /tty/USB (no numbers), the third one the class number according to theKernel 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