pmh1d15
Posts: 4
Joined: Thu Dec 07, 2017 4:49 pm

Getting Pure data to work on Raspbian Jessie (giving pure data permission to access device?)

Thu Dec 07, 2017 4:52 pm

Hi,

I’m new to raspberry pi and am trying to run Pure data on it to control a teensy 3.2 using Open Sound Control which in turn controls some stepper motors for a pump just like here https://github.com/DropletKitchen/pumpsn17 (using the teensy code and PD files provided at the end of the page). I’ve finally managed to install PD extended on my raspberry pi 3 (Raspbian Jessie). But I don’t think PD is able to use the USB to communicate with the teensy, since if I try to run the PD file, PD gives me the error “could not open device /dev/ttyS0: failure(13): Permission denied. Could someone help me please to get PD communicating with OSC through my USB?

Also when I open PD I get this message
“/dev/dsp (read/write): No such file or directory
(now will try write-only…)
/dev/dsp (writeonly): No such file or directory
/dev/dsp (read only): No such file or directory”
and
“Audio I/O stuck… closing audio”
Do I need to do some further configuration to get Pure Data running properly?
Like I mentioned I am very new to using the raspberry pi so any help would be appreciated and please so explain as if I were an idiot.
Thank you

User avatar
jonwitts
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 40
Joined: Fri Oct 17, 2014 3:45 pm
Location: Kingston upon Hull
Contact: Website

Re: Getting Pure data to work on Raspbian Jessie (giving pure data permission to access device?)

Sat Dec 09, 2017 4:36 pm

Umm /dev/ttyS0 is the serial device not a USB port... Are you using a Pi 3?

pmh1d15
Posts: 4
Joined: Thu Dec 07, 2017 4:49 pm

Re: Getting Pure data to work on Raspbian Jessie (giving pure data permission to access device?)

Mon Dec 11, 2017 3:15 pm

Thank you Jonwitts for getting back to me. Yes I am using a Pi3..
So the PureData file I am using controls using open sound then via a different PD file (called o.io.slipserial.pd) converts to TTY data to communicate with the teensy, which to me looks to output to “devicename /dev/tty.usbmodem12341, pollintervall 1” (although I am not sure. But if it helps I am following the control setup at: https://github.com/DropletKitchen/pumpsn17 flexible version at the bottom of the page.)
The Teensy is plugged into a USB port. But in the Pure Data control front end (which should feed into the o.io.slipserial.pd file), I can only really choose between /ttyAMA0 /ttyACM0 or /ttyS0.
I understand that the Pi 3 has changed from previous raspberry Pis so /dev/ttyAMA0 is Bluetooth and /dev/ttyS0 is the GPIO serial port. As per discussion here https://spellfoundry.com/2016/05/29/con ... ding-pi-3/
Arduino apparently expects the serial communications to be on /dev/ttyS0 and for me when I plug in my teensy via the USB this seems to work and I can program it using the raspberry pi. But when it comes to controlling the teensy on the raspberry Pi via Pure Data is when I come into problems.
Sorry if this seems very disjointed, I’m trying to learn as I go here, and am likely missing something very obvious. I feel I do need to go back and learn some of the basics, but am stuck for time at the moment so would love to be able to get this working soon. I’m wondering if the problems may be related to differences between Rasberry pi 3 vs 2 and Jessie vs wheezy. Since these Pure data files and the teensy code is apparently tried and tested, and should work as is.
Any light on the matter would be much appreciated.

User avatar
scruss
Posts: 1673
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Getting Pure data to work on Raspbian Jessie (giving pure data permission to access device?)

Mon Dec 11, 2017 3:57 pm

A Teensy plugged into a Raspberry Pi will generally appear as /dev/ttyACM0 - try that option.

References to /dev/dsp don't inspire confidence: it's a very old audio interface that Unix machines had a couple of decades back. You may have some success if you do this:

Code: Select all

sudo apt install alsa-oss
sudo modprobe snd-pcm-oss
which will create a /dev/dsp device. It's unlikely that you application will use it, but since PD is an audio thing, it's expecting it.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

pmh1d15
Posts: 4
Joined: Thu Dec 07, 2017 4:49 pm

Re: Getting Pure data to work on Raspbian Jessie (giving pure data permission to access device?)

Thu Dec 14, 2017 3:31 pm

Thank you for this tip. The command gets rid of that error in Pd extended, but not in PdL2Ork (I have both versions installed). I've changed it to ACM0 but to no avail. My main Pd file can find the ACM0 and I have changed the output to ACM0 in the helper file that should communicate with the teensy, but it still doesn't respond. BTW I am looking for two way communication, since if the teensy receives the info it should send it back too, which should be mirrored in the Pure data front end. Also, just to check, if my teensy is at ACM0 but it is attached via a USB will communication directed through ACM0 still go through the USB to the teensy? .. Anyway, looking at the errors on Pd i'm thinking it may be a problem with the different .pd files communicating with each other. when opening the files Pd gives a number of errors:
UnpackOSC
… couldn’t create
routeOSC /derection
… couldn’t create
And then a bunch of other could not create warnings for all the OSC parameters. PD L2Ork also identifies that the helper file o.io.slipserial.pd 5 0 4 0 (bng->loadbang) connection failed, Suggesting the communication between the “loadbang” control in the PD file and the helper file that send to the teensy isn't. I’m trying to get in touch with the creators and other PD users. But if anyone here has any helpful suggestions it would be very much appreciated.

User avatar
scruss
Posts: 1673
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Getting Pure data to work on Raspbian Jessie (giving pure data permission to access device?)

Sat Dec 16, 2017 7:13 pm

yes, /dev/ACM0 is your serial device via USB.

Can't help with the rest of the PD stuff. It looks a very complex way to do something that would be much easier in almost any other programming language. There are also relatively few PD programmers
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

pmh1d15
Posts: 4
Joined: Thu Dec 07, 2017 4:49 pm

Re: Getting Pure data to work on Raspbian Jessie (giving pure data permission to access device?)

Tue Jan 02, 2018 12:28 pm

Thanks for everyone’s help here. It’s great how much help you can get from others on this forum. I after a bit of a learning curve I ended up solving this problem with help from David “whale-av” at PDpatchrepro forum: https://forum.pdpatchrepo.info/topic/11 ... ess-device
It turned out the files provided for the open sound control on Pure data were missing one small piece of code. This is because the object [import mrpeach] needs to be referenced in all the PD files that are provided to enable OSC to communicate with the Teensy. To solve this I added an object to the file Flexible3or4PumpsGOP and inserted the command “[import mrpeach]”, I also did this to the front end file to make sure, although I’m not sure it is necessary. It should already be referenced in o.io.slipserial.pd. Once this is done it should work. It seems that just this one command was missing from the files provided. The raspberry pi now talks to the teensy via ttyACM0. So glad to get this working, and thanks for the help along the way.

Return to “Troubleshooting”

Who is online

Users browsing this forum: No registered users and 31 guests