The folks at CCRMA are maintaining a nice set of pd objects to send/receive OSC messages over serial connections.
Unfortunately the latest available binaries (pd_OSCserial_externs20070810.tar.gz - linked off the AVR wiki page) don't deal very well with sending messages from Pd to an attached microcontroller. I've written some patches - until they are folded into the source, I'll make them available here.
Source: serialIO.c
Mac OS X (intel) binary: serialIO.pd_darwin
Test patch to exchange messages with Arduino_Osc firmware: arduino_osc_pd_0001.zip
(open arduino_osc.pd)
Test patch to exchange messages with Wiring_Osc firmware: wiring_osc_pd_0002.zip
(open wiring_osc.pd)
Change log:
12/2/08: 0002 - made pins 0 & 1 available, fixed slider ranges to use 10bit
Earlier versions: wiring_osc_pd_0001.zip
Notes on adding OSCserial objects into a fresh Pd-extended installation:
- Download Pd-extended.app from SOURCE
- Download pd_OSCserial_externs20070810.tar.gz
- Create Pd-extended.app/Contents/Resources/extra/ccrma-osc and extract extern files into directory
- Start Pd-extended. Go to preferences, make sure that ccrma-osc is on the path.
Notes on compiling serialIO from source on OS X:
Notes on changes to serialIO.c:
- While incoming OSC messages to serialIO are expected to be wrapped with prefix bytes (0xBE, length) and postfix byte (checksum), outgoing
messages from Pd to a microcontroller are *not* wrapped, but sent raw.
This confuses serial OSC parsers on the other end of the connection.
Patch: modified serialIO_FullPacket() to wrap messages.
- The calls to tcflush(x->x_serfd,TCIOFLUSH); in serialIO_byte() and
serialIO_float() lead to dropped bytes in outgoing OSC messages - at
38400 on my Mac, only ~1 in 5 messages made it out unharmed.
Patch: commented out tcflush(); called tcdrain() at end of
serialIO_FullPacket(). Note: not sure if this change interferes with
single-byte or single-float output; needs to be tested (maybe call
tcdrain() inside _byte() and _float()?).
- Noticed some unexpected post() behavior when calling serialIO_byte()
with a char variable local to calling function's scope (got
interpreted as 32-bit value instead of 8-bit); fixed by changing
signature of function to take unsigned char (huh?).
- Improved debug reporting from printing signed decimal values of
outgoing bytes to printing both unsigned decimal and hexadecimal
values.
Comments (0)
You don't have permission to comment on this page.