[dorkbotpdx-blabber] skip dorkboard serial delay?
Paul Stoffregen
paul at pjrc.com
Sun Feb 15 13:28:43 EST 2009
You could just disconnect the DTR-to-reset signal between your benito
and the dorkboard, maybe with a switch or jumper to reconnect it when
you want to reprogram the chip again.
If you're using windows, it is possible before opening the serial port
to configure DTR not to raise on open. The only way I know is using the
ugly win32 api, specifically you call SetDefaultCommConfig with a
COMMCONFIG struct where you've set the fDtrControl member to
DTR_CONTROL_DISABLE. Then when you call CreateFile to actually open the
port, DTR doesn't raise and your dorkboard won't go into the bootloader
for 5 seconds.
On linux, there is no api, but you could edit the driver to not touch
DTR (issue a request that becomes a USB control transfer), recompile the
module, and use insmod to install you modified driver. It seems
impossible on MacOS.
You could pre-open the port, perhaps by just changing your ruby
application to remain running? Or you could write a daemon that keeps
the serial port open and accepts connections from your application and
relays the communication via the serial port that's already been open
for at least 5 seconds.
If you wanted to get into hacking the benito code, a really nice
solution might be to buffer and parse the data stream, looking for the
'0' and possible other bytes avrdude sends immediately after opening the
port, and delay the DTR pulse until the buffer is confirmed to contain
an avrdude-like message.
Making the benito behavior dependent on the baud rate would be easier,
though the sad news is not all operating systems support all the
not-as-standard baud rates. The Macintosh driver is particularly
disappointing in that respect, where the both OS-X termios api and the
CDC protocol provide an arbitrary 32 bit integer for the baud rate, but
the OS-X driver rejects all but a narrow subset of very standard baud
rates. Linux is also picky at the termios api level. The Windows API
claims to support arbitrary baud rates (as does OS-X) but I haven't
tested if it actually works or is limited like OS-X.
(warning, shameless plug) You could also try using a Teensy board, which
uses a completely different bootloader approach that doesn't have this 5
second delay.
-Paul
Greg Borenstein wrote:
> Is there anyway to prevent the delay in serial communication that
> happens with the Arduino or the Dorkboard? When you first open a
> serial connection from the big computer, they go deaf to serial
> messages for awhile (the dorkboard for about 5 secs, the arduino for
> about 10). It's because they're listening for a new program to be
> uploaded, right? Is there anyway to flip a switch or something to tell
> them not to listen for that so that they'll just listen for straight
> serial messages?
>
> I'm wondering because I'm making things like this:
> http://www.urbanhonking.com/ideasfordozens/2009/02/the_git_bell_postcommit_ruby_a.html
>
>
> Thanks,
>
> Greg
> _______________________________________________
> dorkbotpdx-blabber mailing list
> dorkbotpdx-blabber at dorkbot.org
> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber
>
>
More information about the dorkbotpdx-blabber
mailing list