Using ISP port as 2nd serial port

13 views
Skip to first unread message

Emo

unread,
Feb 26, 2010, 12:22:42 PM2/26/10
to MeggyDev
Wow! First post? Is this thing on? tap...tap...tap Might as well
break the ice and give this a try.

Question: Can the Meggy's ISP programming port be used as a second
serial port? I was thinking of using this to connect to another Meggy
unit (or, actually, daisy-chaining several together). Would there be
any hardware changes necessary to do so, or a radical software change,
such as altering the library's code?

Thanks!


Josh Brandt

unread,
Feb 26, 2010, 1:06:28 PM2/26/10
to megg...@googlegroups.com

No, I don't think so, since it uses the same pins as the STP16DP05 LED
controllers and row 8 of the LED matrix.

Looking at the schematic, I don't think there are any spare pins that could
be repurposed... You might be able to set up something else with multiple
serial ports to act as a hub, but I don't think Meggy Jr can do multiple
serial ports on its own.

Josh

--
J. Brandt / m...@solipsism.net / mu...@sidehack.gweep.net / AIM: solipsismnet

Leander Harding

unread,
Feb 26, 2010, 1:38:49 PM2/26/10
to megg...@googlegroups.com

Josh is right. That said, you might be able to do something with the exisiting serial port by wiring up a ring configuration - make the tx line go 'downstream' and the rx line come from 'upstream', and then each meggy passes data on to the next one, around and around.
Also, I don't have the schematic on me, but I seem to recall there being solder pads on the board that give you access to the pins used by the buttons, so you could sacrifice a coulpe of buttons easily.

Hope this helps.

-Leander

On Feb 26, 2010 10:06 AM, "Josh Brandt" <mu...@sidehack.gweep.net> wrote:


On Fri, Feb 26, 2010 at 09:22:42AM -0800, Emo wrote:

> Wow! First post? Is this thing on? tap......

No, I don't think so, since it uses the same pins as the STP16DP05 LED
controllers and row 8 of the LED matrix.

Looking at the schematic, I don't think there are any spare pins that could
be repurposed... You might be able to set up something else with multiple
serial ports to act as a hub, but I don't think Meggy Jr can do multiple
serial ports on its own.

Josh

--
 J. Brandt / m...@solipsism.net / mu...@sidehack.gweep.net / AIM: solipsismnet


--
You received this message because you are subscribed to the Google Groups "MeggyDev" group.
To ...

Windell H. Oskay

unread,
Feb 26, 2010, 1:46:13 PM2/26/10
to megg...@googlegroups.com
>> Wow! First post? Is this thing on? tap...tap...tap Might as well
>> break the ice and give this a try.

Thanks! We've been shy. ;)

>> Question: Can the Meggy's ISP programming port be used as a second
>> serial port? I was thinking of using this to connect to another Meggy
>> unit (or, actually, daisy-chaining several together). Would there be
>> any hardware changes necessary to do so, or a radical software change,
>> such as altering the library's code?
>
> No, I don't think so, since it uses the same pins as the STP16DP05 LED
> controllers and row 8 of the LED matrix.

Yes, the ISP/SPI interface is used for (1) programming the chip through
ISP and (2) sending data to the LED driver chips.

You could modify the code to allow this interface to send data out, but
because the SPI input line is shared with that matrix row, it can't be
used for bidirectional communication.

> Looking at the schematic, I don't think there are any spare pins that
> could
> be repurposed... You might be able to set up something else with multiple
> serial ports to act as a hub, but I don't think Meggy Jr can do multiple
> serial ports on its own.

If you just want to connect two Meggy Jr RGB units together and
communicate over the serial port, that's actually straightforward:
http://www.evilmadscientist.com/go/meggycable
(And, if you want to reprogram them while they're connected by that serial
port, you could do so through the ISP port.)

As Josh says, you could hook up several through a hub. An Arduino Mega
with four serial ports might be a good way to do this.

Another way would be to hook up each Meggy serial port to a serial to
RS-485 converter chip, (e.g., DS485 or SN75176B) and hook them up as a
RS485 network.

Here's an article with the basics of doing that:
http://www.embeddedsys.com/subpages/resources/images/documents/microsys_art_RS485.pdf

A cheaper but more invasive solution would be to use the I2C interface.
I2C (aka TWI) is a multi-point serial protocol built into the AVR. The I2C
pins on the chip are 28 and 27, which are the same pins that normally go
to the "left" and "right" buttons. There are access holes for these two
locations (PC5, PC4) on the PCB, and you can directly wire from one device
to the next. The downside is that you can't press the left or right
buttons while you're trying to communicate over I2C, unless you reroute
the traces that normally go to those two buttons. If you do this, I'd
suggest hooking the buttons up to the TX/RX lines, since it's relatively
easy to avoid pressing either button during programming, and having the
buttons there won't interfere with operation otherwise. Probably a
bigger problem is that there isn't any good interrupt-free I2C
communication example that I can point to; you'll need to work harder at
programming this.

Emo

unread,
Feb 26, 2010, 2:29:21 PM2/26/10
to MeggyDev
Yes - a ring configuration was going to be my fallback plan - sort of
like a token ring network, where each unit has to pass on the packet
in a circular network. Wheee! I'm actually enthused about designing
the software to support this! >:)
-Emo


On Feb 26, 12:38 pm, Leander Harding <lean...@fremde.org> wrote:
> Josh is right. That said, you might be able to do something with the
> exisiting serial port by wiring up a ring configuration - make the tx line
> go 'downstream' and the rx line come from 'upstream', and then each meggy
> passes data on to the next one, around and around.
> Also, I don't have the schematic on me, but I seem to recall there being
> solder pads on the board that give you access to the pins used by the
> buttons, so you could sacrifice a coulpe of buttons easily.
>
> Hope this helps.
>
> -Leander
>

> On Feb 26, 2010 10:06 AM, "Josh Brandt" <m...@sidehack.gweep.net> wrote:
>
> On Fri, Feb 26, 2010 at 09:22:42AM -0800, Emo wrote:
> > Wow! First post? Is this thing on? tap......
>
> No, I don't think so, since it uses the same pins as the STP16DP05 LED
> controllers and row 8 of the LED matrix.
>
> Looking at the schematic, I don't think there are any spare pins that could
> be repurposed... You might be able to set up something else with multiple
> serial ports to act as a hub, but I don't think Meggy Jr can do multiple
> serial ports on its own.
>
> Josh
>
> --

>  J. Brandt / m...@solipsism.net / m...@sidehack.gweep.net / AIM: solipsismnet

Emo

unread,
Feb 26, 2010, 2:36:08 PM2/26/10
to MeggyDev
Interesting - I wonder if it was ever thought of to free up some
"button" pins by using only one of the ADC pins and assigning each
button a specific resistance, creating an analog signal that could
then be interpreted in software? Is that feasible?
-Emo

> Here's an article with the basics of doing that:http://www.embeddedsys.com/subpages/resources/images/documents/micros...

Windell H. Oskay

unread,
Feb 26, 2010, 2:53:05 PM2/26/10
to megg...@googlegroups.com
> Interesting - I wonder if it was ever thought of to free up some
> "button" pins by using only one of the ADC pins and assigning each
> button a specific resistance, creating an analog signal that could
> then be interpreted in software? Is that feasible?
> -Emo

Yes; I've actually done that on another project. The potential
disadvantages are (1) extra parts (resistors and an op amp, usually) and
(2) ADC can take some time to settle. Reading digital button presses can
be much faster.

-Windell

Josh Brandt

unread,
Feb 26, 2010, 3:29:01 PM2/26/10
to megg...@googlegroups.com

On Fri, Feb 26, 2010 at 11:36:08AM -0800, Emo wrote:
> Interesting - I wonder if it was ever thought of to free up some
> "button" pins by using only one of the ADC pins and assigning each
> button a specific resistance, creating an analog signal that could
> then be interpreted in software? Is that feasible?

You're better off adding a multiplexer, I think, which would still need 3 or
4 pins but would free up a couple. There's not much space on the Meggy board
for that, though.

Reply all
Reply to author
Forward
0 new messages