Arduino Forum

Development => Other Hardware Development => Topic started by: leen15 on Feb 21, 2015, 08:45 pm

Title: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 21, 2015, 08:45 pm
Hi to all, for my home automation project i would like to use lots of MCP23017 expander for increase digital I/O pins of arduino (in my case Yun).
As i wrote in this discussion http://forum.arduino.cc/index.php?topic=301266.0 (http://forum.arduino.cc/index.php?topic=301266.0) i bought a centipede shield clone (only one available in europe) but, as you can read in topic pcb was wrong because chip3 had the same address of chip0.
So now, i would like to build a new shield (only for digital I/O, no Analog I/O) that can be like for some things better than this bad copy and (i hope) a little better than centipede (http://macetech.com/store/index.php?main_page=product_info&cPath=4&products_id=23 (http://macetech.com/store/index.php?main_page=product_info&cPath=4&products_id=23)), that can be use it only until 128 I/O (2 boards).

With this new shield, you can use until 16 boards, for a total of 1024 I/O !  :smiley-twist:

With the big big help of "ShapeShifter", this is where we are until now.  :P


There is three things that i would like to say:
- First one, components are fit for don't stay above RJ45 and USB of Arduino Yun
- Pin out schema of every MCP23017 has VCC and GND at bottom
- I would like to use SMD only for MCP23017 and 74*85, because i want that solder components will be easy

Nothing to say more, if not that I accept every type of comment, suggestion or criticism (only if for improve).
I'm not an expert! I think that there is always to learn, from everyone, so i hope that many of you can help me to build a shield that, first of all, will work!  :smiley-yell:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 23, 2015, 08:47 am
Topic read 50 times, nobody answers.. maybe i wrong the section?  :smiley-confuse:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 23, 2015, 01:51 pm
Curious... I figured it would get good exposure here.  :smiley-neutral:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 23, 2015, 03:22 pm
Me too...  :smiley-roll:

so.. Do we consider the schematic as right?  :smiley-razz:

I'll try to build the layout..
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 23, 2015, 03:28 pm
I think you may have trouble getting the board routed with that placement - you  have a lot of signals to drop from the chips down to the connectors. You may have to lengthen the board left-to-right to make room.  Or try rotating the chips 90 degrees.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 23, 2015, 03:44 pm
Thanks for your suggestion, i'll give it a try!  ;)

Some comments about schematic?
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 23, 2015, 04:20 pm
I don't see anything needing changes.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 23, 2015, 04:22 pm
I don't see anything needing changes.
Thanks!
So now layout time!  :smiley-grin:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 24, 2015, 12:06 am
I think you may have trouble getting the board routed with that placement - you  have a lot of signals to drop from the chips down to the connectors.
Yes, it's tight, but I think it can be done. I've just done up a quick proof of concept, and I think it will work. See the attached.

I was originally having trouble with the capacitor, so I moved it. Then I ran into an impasse where the control bus signals couldn't be routed through the data lines because there were already top and bottom traces.

So I spun the chips 180 degrees, and the connectors 180 degrees. The data lines fit, and don't interfere with the control bus. I now see there is room for the bypass cap in the original place, but I didn't bother updating the drawing.

It will take some care, but I think it will fit.

I don't see anything needing changes.
I've made all my comments in that other thread, so I have nothing further.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 24, 2015, 08:55 am
Yes, it's tight, but I think it can be done. I've just done up a quick proof of concept, and I think it will work. See the attached.

I was originally having trouble with the capacitor, so I moved it. Then I ran into an impasse where the control bus signals couldn't be routed through the data lines because there were already top and bottom traces.

So I spun the chips 180 degrees, and the connectors 180 degrees. The data lines fit, and don't interfere with the control bus. I now see there is room for the bypass cap in the original place, but I didn't bother updating the drawing.

It will take some care, but I think it will fit.
I've made all my comments in that other thread, so I have nothing further.
Can you tell me widths of wire and via that you use?  :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 24, 2015, 01:19 pm
This is what I've done until now.
I didn't use autoroute, i prefered to do it manually. 

The problem is that DRC tells me that i've too little space between wires, too little width of wires and too little drill size.  :smiley-cry:

Some help?

What is the min size of wires and vias for no DRC errors?
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 24, 2015, 01:54 pm
10 mil (0.010 inch) traces on 25 mil (0.025 inch) centers with 13 mil (0.013 inch ) vias. (I'll leave it to you to figure the metric equivalents.)

Well within the abilities of a board house like OSHpark without hitting the limits (except for vias which are right at the limit - I prefer vias a little bigger at 20 mil, but they take up more room and don't fit between 25 mil trace spacing.)

You will, of course, need to use minimum sizes that correlate to your board house's abilities, but there is at least one house out there that can handle it.

This is what I've done until now.
A good start! I like how you used the heavy traces for power. But you need to keep them heavy between the connectors as well. Also, use heavier traces to power the chips, especially between the bypass caps and the chips. It's going to be tough to get power and ground to the connector power pins, because those parallel top and bottom traces act as impenetrable barriers (unless you go to four layers and add power and ground planes.) it would be better to put the power pins on the other end of the connectors, that way you can run a heavy bus right down the row.

Sometimes, you can't do the perfect pin ordering on connectors, and sometimes you could but it's not worth the effort. If you put the power pins on the opposite end, it may not line up directly with a relay board: bit 0 goes to 7, 1 to 6, 2 to 5, and so on. Not ideal, but you can work around that in software with a pin translation lookup table. (Or just put stickers on the relay board with the correct logical PIN number!)

Another thing to watch out for are "acid traps" which is where a trace intersection forms a tight acute angle. Take a look at how the SCL trace leaves the header pad. It forms a tight narrow corner that can trap acid during the etching process and eat away too much of the trace (or something like that, I don't know the details, just that it's a bad idea.) compare it to the SDA trace, and toy can see where that little bit of vertical offset has it leaving the pad almost perpendicularly. Oval pads can make soldering easier, especially on long leads, but I prefer round or octagonal pads because you don't have to worry about departure angle so much.

Quote
I didn't use autoroute, i prefered to do it manually.  
Autoroute is horrible, you are wise to stay away from it. I clicked it once to see what it would do with a simple layout, and it was really ugly. I'm sure it won't handle this board, it would just lay out a bunch of meandering random traces, and then give up, leaving you no room to do the rest.

Besides, I like manually routing: I find it relaxing and a fun puzzle to solve.

Quote
The problem is that DRC tells me that i've too little space between wires, too little width of wires and too little drill size.  :smiley-cry:
Are you using the default DRC rules? The minimum sizes and spaces they use are pretty big. You need to choose the board house that will make the boards, and get the minimum parameters from them. Things like minimum trace width, trace spacing, via sizes, clearances, etc. Many board houses will have Eagle rules files you can download and load directly, others you will have to enter manually (and if that's the case, make sure to save then to a settings file for later use.)

Quote
What is the min size of wires and vias for no DRC errors?
It depends. The better the board house and the processes they use, the finer work they can do, and the smaller values you can use. Go cheap, and their limits will often be bigger. If you plan on etching the board yourself, then you probably want to increase the size of the default limits. (This board is complex enough that I don't think home etching is going to be practical.)

This is already too much typing to do on a tablet. I'll take another look at this when I get to my computer and see if I see anything else.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 03:09 pm
I use the DRC and CAM files from iteadstudio.
Signal traces: 10 mil wide, 10 mil clearance, 12 mil drills.
Set the routing grid to 2 or 1 mil.
I have no issues with the Eagle autorouter in general. It does a decent job, and if it's struggling that's  a good sign your placement needs work. You'll have to go thru and clean up right angles and do some trace placement adjusting to get some of the grounds connected sometimes.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 03:15 pm
Select Edit:Net Classes to define the signal widths.
You could set Default as noted:  10 mil wide, 10 mil clearance, 12 mil drills
And then add Power with the width you used, 10 mil clearance, and width +2 or +4 for drills.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 03:18 pm
Could also go SMD for the other caps, the resistors, the diode, and use DPAK regulator package. Select one with IN-GND-OUT for leads so the tab can be soldered to the ground plane for cooling.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 24, 2015, 03:18 pm
I just redraw the board and used 8mil for clearance and 0.254 for wire width.. should i use 10mil for clearance? i have to increase a lot the width of entire board for use 10mil of clearance..  :smiley-confuse:

I would like to use no SMD components for what i can.. only chips in smd.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 03:24 pm
You're already SMD for the chips and some caps, so you're going to need a stencil no matter what - bit the bullet and place a few more SMD components and have most of the board all done in one reflow pass.  I use stencils from pololu.com.  Select 3 mil mylar so the chips don't get too much paste.

8 mil clearance should be fine with those few parts.  Be sure to have solder mask applied or bridging could be an issue with the chip legs.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 24, 2015, 03:36 pm
I never solder SMD components, but as i saw here at minute 18:20:

https://www.youtube.com/watch?v=z7Tu8NXu5UA&feature=youtu.be

i can use soldering flux that is available in europe and it's easy to use for what i can see.

For now i used only SMD for chips. Caps and other components are normal :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 24, 2015, 03:40 pm
I'm back... Bringing up the layout on a larger screen lets me see more details. A couple more observations...

I see you're running a ground bus. Usually, I ignore the ground signals while routing, and then at the end I use a pour to fill in all of the empty space with copper, and name them as GND, top and bottom. This acts as a giant ground plane, and usually makes the routing easier. You can type in the "ratsnest ! gnd" command to turn off the ground airwires so they don't get in your way. Or you can get the properties of one of the ground signals in the board layout and check the "Airwires Hidden" check box at the bottom of the dialog.

Looking at ground, you've got a nice thick trace all the way to the first IO connector. Then it becomes a thin trace that snakes through the grounded pins on the chips, and cascading through to all of the other chips and connectors. There are thick traces between the ground pins on the connectors, but that isn't accomplishing much. Any current drawn by the board plugged into the last IO connector will need to draw through all of those skinny traces, and will affect the ground reference for every chip and IO connector leading up to it. This can cause noise and unwanted operation.

A large ground plane can help with that. But with such a crowded layout, you have to make sure it isn't breaking up the ground plane too much and there are still places for the current to flow. Often times, it necessary to scatter vias around that have no traces on them, but which stitch the upper and lower ground planes together That can help the current flow past a long trace bisecting the board, or give it a path to an island that would otherwise be isolated. Having the power pins at the bottom of the IO connectors will help in that regard, since the heaviest draws (the connectors) will have a short almost direct connection to the shield ground pin. Of course, the same thing can be said about power -- keep those thick through the whole run. As it is now, it has the same limitations as ground.

I try to keep traces as straight as possible. It's mostly cosmetic, but it doesn't hurt to minimize the trace length, especially on higher current traces. Take the power line fro your 3 pin select jumper. It goes over to the resistors, then up to the connector. On the way to the connector it makes a 90 degree bend and a couple 45 degree bends. If you got rid of the 90, and extended that short angled section towards the resistors, it would shorten the trace. But, if instead you jogged over a little from the select jumper, and brought it straight up the side of the connector, it would be even shorter. Then, you could run a trace through the DIP switch pins and go straight horizontally to the thick trace. That can be a skinny trace, as that part of the circuit will draw a maximum of 2 mA with all switches on (and none with them all off.)

I see you have plenty of acid traps, for example on the outside of IC5 pin 4, the bottom of pin 8, and the Y connection on the inside of pin 3.

You've got some long runs of address lines between the IO pins and the decoder on the far left, and they are running through prime real estate. You could shorten those lines considerably by putting the address logic in the middle of the board, and shoving IC3 and 4 over to the left. (Oh, wait... that will make them interfere with the Ethernet and USB ports on a Yun, won't it?)

These are just some comments and observations, but I am in no way an expert. It would be nice to get some feedback from some who are more experienced in good board layout.

From earlier comments, I get the idea that you are pretty new to this. Well, if that's the case, it doesn't show. It looks pretty good! MUCH better than the layout of that kickstarter board you began with.

As for stencils, it does make life easier. But for limited runs, hand soldering a few chips is not a show stopper, especially the "bigger" chips like these. But you definitely do want soldermask! Where I work, we do all of the prototype boards by hand, even the big boards and the really tiny parts. About the only parts that get sent out to a fabricator for assembly are BGA chips, and then we do the rest of the board when it comes back. (The setup costs for sending the whole prototype board out for assembly are too high when you're talking just 3 to 6 boards.)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 24, 2015, 04:44 pm
https://www.youtube.com/watch?v=z7Tu8NXu5UA&feature=youtu.be
That's a good informative video. He makes it look so easy! Of course, it's a lot of practice to get to that point.  :smiley-twist: One of these days I hope to be able to solder that well.

I then looked at the video he links to, where Mike is showing some parts placement tips. Man, he talks so fast and jitters his hands so fast, I have a headache after watching it.  :smiley-confuse:

In my last post, I mentioned how it would be nice to have more feedback from people. I don't know how, but I completely missed all of the great posts and tips from Crossroads, all I saw when I made my last post was his last one about stencils. I'm sorry if my comment made it sound like I was ignoring or dismissing those posts, it wasn't my intent.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 24, 2015, 04:53 pm
I just redraw the board and used 8mil for clearance
I use the DRC rules downloaded from OSHpark. Some key values:

I generally go a bit bigger, trying to stay to 10 or 12 mil for traces, and putting them on 25 mil centers. I only go tighter if really necessary (13 mil vias when necessary, and lower clearances when trying to snake between pins.) But those are just the conventions I use for myself, I don't have any scientific basis for it, other than generally being round numbers.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 24, 2015, 05:27 pm
Ok so, i drew again with:
- 0.254 wire for signal (8 mil)
- 0.4064 wire for power supply on chips
- 0.3 drill
- 8 mil clearance

I read very fast what you wrote, i never used ground plane, i don't know how to make it  :smiley-lol:
But, now i think i'm not so far from the final result, there are still some problems like long run and acid traps,  if you can get me to notice i thank you.
I rotated 180 chips and IO pins so now VCC and GND are at top of board but i kept pin configuration so i don't have to (and i shouldn't like do) reconfigure pins in software.

I'm not an expert, but when i was young (20 years ago?) i looked my father with the old circad software make some simple pcbs and until now i made only some basic pcbs, this is the first so complicate and with smd components  :smiley-mr-green:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 06:33 pm
Ground plane - draw a polygon (not a rectangle) around the outside of  the Dimension line. Name it Gnd. Do the same for both Top and Bottom layers. Then click Rats Nest and it will connect the Gnd pins to it.  You may need to add a few Vias, aslo Name them Gnd, to connect the Top & Bottom layers for maximum Gnd plane coverage.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 24, 2015, 06:40 pm
Ground plane - draw a polygon (not a rectangle) around the outside of  the Dimension line. Name it Gnd. Do the same for both Top and Bottom layers. Then click Rats Nest and it will connect the Gnd pins to it.  You may need to add a few Vias, aslo Name them Gnd, to connect the Top & Bottom layers for maximum Gnd plane coverage.
Do you think that at this point could be useful or i keep the layout as is? :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 06:43 pm
You're using the SSOP package, with 0.65mm pitch on the pins? That could be tricky soldering.
The '328P in TQFP with 0.8mm pitch is hard enough.

Ground plane is definitely useful.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 06:43 pm
Helps when etching the board too as less material has to be removed.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 24, 2015, 06:52 pm
You're using the SSOP package, with 0.65mm pitch on the pins? That could be tricky soldering.
The '328P in TQFP with 0.8mm pitch is hard enough.

Ground plane is definitely useful.
I don't understand, What does '328P have to do with my shield?  :smiley-eek:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 24, 2015, 06:57 pm
I like how you've addressed the acid traps, and also thickened the power/ground traces around the chips. :smiley-cool: (you've still got a couple acid traps near the caps where the smaller trace peels off from the thick trace.)

You've also used very nice thick traces to between JP1 and JP2, but that trace between the two connectors is very long (in order to find a spot you can put the vias) and those two connectors are still isolated from the power source by smaller traces.

if you don't want to move the power and ground to the other end of the connectors, it may improve the situation by putting a thick bus horizontally below the connectors, moving the existing traces down some to give some room. Then, you can run the traces up the side of each connector, much like the the existing traces on JP1 and 2, but continuing them down to the bus. And, instead of putting a via in the the power line, maybe put them in the signals? (See the quick sketch attached - power is selected with the "eyeball" tool to make it highlighted, blue background is ground plane, I didn't include a top ground plane to make it less cluttered, but it should be there.) Also, by putting 6 data lines on the top, and only two on the bottom, I spaced the bottom traces wider apart, letting me put larger vias on those lines (those are 10 mil traces, 20 mil vias, and 50 mil between the bottom layer traces, 25 mil on top - of course, those numbers can be adjusted to your desires.)

i never used ground plane, i don't know how to make it  :smiley-lol:
This video does a reasonable explanation (if you ignore the silly sound effects) https://www.youtube.com/watch?v=O5aZQLSJajI (https://www.youtube.com/watch?v=O5aZQLSJajI)

Near the end, he drops a bunch of stitching vias, and then names each one GND. To save time, I drop one via, name it, and then copy/paste it a bunch of times. He has a section of the board that forms an island and has nothing filled in: I will drop some vias in area like that, and it gets filled in with ground plane. I will then use the "eyeball" tool to select and highlight the ground plane. It really makes it stand out and makes it easier to see areas where there are long skinny sections of ground plane. I will go and add some vias to such a section to make it less likely to pick up noise from adjacent signals, especially if it's a long peninsula that dead ends with no ground connection near the tip.

Again, while typing and drawing, 5 more replies came in. Some of this may now be redundant, but I'm not going in and changing it...  :smiley-twist:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 24, 2015, 07:12 pm
Thanks for your suggestion ShapeShifter, I'll try to move GND and VCC of JP* to a horizontal bottom bus as in your sketch!  ;)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 07:27 pm
Quote
I don't understand, What does '328P have to do with my shield?
I was just using the pitch of the '328P TQFP pins as a spacing comparison to the spacing of the SSOP pins on your chips.  Your pins are closer and trickier to solder by hand.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 24, 2015, 07:34 pm
I was just using the pitch of the '328P TQFP pins as a spacing comparison to the spacing of the SSOP pins on your chips.  Your pins are closer and trickier to solder by hand.
Did you see the youtube video that i posted before?
I hope with that method could be easy to solder these pins. :)
I choose the same package that there was in kickstarter project of original discussion.
Is there a package more easy to solder but not bigger?
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 07:40 pm
As I said, too small for me. We could not do the drag soldering successfully, and do not have steady enough hands to place parts on stenciled solder paste. 0.8mm pitch is the best we've been able to do.  Most times.

Get some practice before you try it.
Easier to solder, and not bigger, do not go together 8)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: bobcousins on Feb 24, 2015, 08:11 pm
Looks like your board is shaping up nicely and you are getting some good feedback. I will restrict to a couple of comments:

1) Make sure to leave clearance around the connectors JP1-JP4 for IDC headers, probably ok depends on size of those decoupling caps.

2) For my 1024 IOs  :smiley-mr-green: is the idea to stack boards? It seems IC6 at least would prevent that.


With SMT, dipping a toe gently into the water is probably a good idea, you might find the water agreeable, or not, either way it's good to have tried it.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: bobcousins on Feb 24, 2015, 08:22 pm
Did you see the youtube video that i posted before?
I hope with that method could be easy to solder these pins. :)
I choose the same package that there was in kickstarter project of original discussion.
Is there a package more easy to solder but not bigger?
The MCP23017 comes in an SO version, which is much easier to solder, but package is inevitably bigger. That actually allows more routing paths, so I would try placing one in your layout.

I use ordinary soldering tools (fine tip and solder) for SMT work, my special tool is a binocular microscope. This allows me to solder like I always used to, but at a smaller scale.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 08:43 pm
We stencil on solder paste (my job), place parts (wife's job), then reflow in a toaster oven (I hand control temperature, wife watches the time).
Got to figure out the glue part so we can reflow double sided.
And assemble all the parts I have for an over controller into an actual oven controller!
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 24, 2015, 09:50 pm
As I said, too small for me.
LOL! Everything these days are too small for me.  ::)

It's not fair... back in the '70s working on projects as a kid, I had great eyesight, but didn't need it because everything was huge. These days, things are so tiny, and my eyesight, while still OK, is nothing like it used to be. I can hardly see half the parts, let alone read the printing on them or solder them. I should've been working with the tiny parts back then, and the big parts now!

Last week, I was working on a customer's board (he built it, I was bailing him out of a software problem) and I needed to tack on some fly wires (dang pins on the processor are too small for logic analyzer microclips.) I didn't notice it, but there was an 0402 resistor (speck of dust!) nearby. Well, I must've accidentally touched it with the iron and the part stuck to the tip never to be seen again. Boy, did that cause problems when things that used to be working suddenly stopped working. Took me a while to figure that one out...

Speaking of reading the printing, who's bright idea was it to use dark grey print on black packages? What's wrong with using white?

1) Make sure to leave clearance around the connectors JP1-JP4 for IDC headers
Good point! I usually try to leave at least 0.2 inches clear on the ends, measured from the last pin.

Quote
2) For my 1024 IOs  :smiley-mr-green: is the idea to stack boards? It seems IC6 at least would prevent that.
Is there room to bend the leads and put the package flat on the board?

But then again, it may not too much of an issue: with a ribbon cable connector mated onto the headers, it will likely be tall enough that the boards won't stack tightly anyway. May need stackable headers with extra long tails, or a set of extra stackable headers as spacers between each row?

The MCP23017 comes in an SO version, which is much easier to solder, but package is inevitably bigger.
Is there room for a bigger package? Hmmm... I guess the I/O headers could be changed to surface mount versions -- they take up more board room because of the way the leads splay out, but that could allow putting the header on the top of the board, the chip right below it on the bottom of the board, and just a a row of vias to pass the signals from the chip to the connector?

________________________________


And now for a drastic idea that will allow tight stacking of a whole column of boards: Dual Row Right Angle Headers (http://www.adafruit.com/products/1541). Make the board just a hair longer on the right side, so there is room to put a 20 pin segment of these on the right side of the board, and another on the left side. Wire them up so you have power/ground, the data bits from one chip, power and ground again, and the data bits from the next chip. Put a pair of these on each end of the board. Now, you can plug a 2x20 IDC connector on it, then split the ribbon cable in half, and put two 2x10 connectors on the other end of the cable. You'll get the same effective pinout, but nothing will be taller than the body of the shield headers, even when there are cables mated. As a side benefit, it will give you LOTS of room on the board to use bigger chips and still have plenty of room for easy routing. Something along the lines of the attached.

I know, a drastic change this late in the game. But at least it's all on paper at this point and you haven't built any boards yet!  :smiley-twist:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 24, 2015, 09:55 pm
This thread is reminding me of an old joke...

Q: What's a camel?

A: A horse designed by a committee!
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 24, 2015, 10:01 pm
The flat layout could interfere with the barrel jack and USB connector.
The original connectors might interfere with the ICPS connector also.
Tall thru pins could be needed.

All the review never hurt, and helps to bring up gotcha's before things are ordered.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 24, 2015, 10:13 pm
The flat layout could interfere with the barrel jack and USB connector.
The original connectors might interfere with the ICPS connector also.
He already extended the left side of the board so as not to interfere with the Ethernet and USB connectors on a Yun. They seem to be taller than other boards, so if he clears those, he should clear the ones on an Uno or more standard Arduino. Still, the left side might need to be extended some more so the header tails are past those connectors (then the only worry is potential interference with the Ethernet and USB cables, but they are typically lower than the receptacle shell.)

On the other end, the board will definitely have to be expanded, since 20 pins won't fit between the shield headers. So that automatically clears the ICSP connector. (In my sample layout, I extended the right side of the board, the left side will probably have to be extended a bit more.)

One advantage of this layout, is that by extending the board, it automatically puts the surface mount chips on top of the tall Arduino connectors and ICSP connector, preventing conflict there. (On his current layout, he was careful where be put the through-hole components to prevent interference.)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 25, 2015, 12:34 pm
Hey! how many comments!  :smiley-mr-green:

This is the new layout, i added ground plane and move IO pins a bit down for more clearance, thanks for the great tip, I would never seen that!  :smiley-yell:

The board is made to not be above RJ45 and USB connector of YUN, JP1 is above ICSP connector but on YUN it don't touch it because usb and rj5 is taller of ICSP so the board should stay upper.

For put 2 boards one above the other, LM317 is not fundamental for the functional of the board, i actually use the clone board with 2 saintsmart expansions and works with arduino power supply, they are only digital signals and i don't think that can be so hungry for use external power on every shield.  :)

Every expansion connected to this board have his power supply.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 25, 2015, 03:53 pm
It's looking real good. We're getting down to the minor details now. You've still got an occasional acid trap here and there.

At this point, I like to look at the routing one layer at a time, and look for little details and things that can be cleaned up. I do this with only the one layer, pads, and vias turned on, all silkscreen, names, and other distractions turned off. For example, on the bottom layer the pair of traces starting under IC2 go up over and down, when there could be room to take a more direct path.

I like how you used liberal silkscreen call-outs for all of the pin functions.

I'm concerned about some the names silkscreens. Many of them seem to use proportional font which means they will look different (and probably take up more room) when the board is produced, because everything will get changed to vector font. You should make sure everything is vector.

Also, many of the components have the names inside the component outline. That will be OK while you're assembling the board, but once the board is built, you won't be able to see them when testing/debugging the board, and it may make it harder to find the parts. That's not such a big deal with a small board like this, but it's a good habit to get into to move them out of the way.

You need to look at the capabilities of the board house that makes the boards, to figure out the minimum silkscreen size. For example, OSHpark prints silskcreen at 200 dots per inch, which is a low resolution by today's printing standards. Very fine or very small text won't be clear. I find that I have to limit my size to about 32 mil (40 is better for small labels) and turn up the ratio to about 15% to make them bolder, otherwise the width of the strokes in a character are well less than 1/200th of an inch.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: CrossRoads on Feb 25, 2015, 04:18 pm
IC1,2,3,4 need something to indicate where pin 1 is also in case someone besides you is assembling them.
Same for the ADDR SEL Jumpers - 0-1-2-3, or 3-2-1-0.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 25, 2015, 05:55 pm
I thought of those too. I don't like it, but I'm guessing the open end of the IC1-4 outline is to show the pin 1 end, much like the notch in some other outlines?

I figured the DIP switch would show position numbers, but you're right that something needs to be on the board to show pin 1 during assembly. Still, probably a good idea to label A0-3 on the board, since the markings on the DIP switch will probably be 1-4, not 0-4.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 25, 2015, 09:02 pm
Updated!  :D

Increase fonts and set all to vector, add ADD SEL numbers, draw IC1-4 first pins, shorted traces under IC3.

I kept R* names inside symbols, not fundamental for normal use :)

Other suggestions?  :smiley-mr-green:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 26, 2015, 11:30 am
Just received pcb specifications from manufactory.

Can you check? It should be ok for me.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 26, 2015, 11:55 am
It will be sexy in red!  :smiley-twist:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 26, 2015, 12:35 pm
Can you check? It should be ok for me.
Hard to say... How does it compare to the parameters you used for laying it out?

One thing I notice is that they say 1:5 for silkscreen weight, which would be 20%. Your silkscreen looks a lot lighter than that. They also say a minimum height of 0.8 mm: it's hard to say, but some of your call outs, like capacitor numbers and address, bits seem like they may be smaller than that?
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 26, 2015, 12:49 pm
Hard to say... How does it compare to the parameters you used for laying it out?

One thing I notice is that they say 1:5 for silkscreen weight, which would be 20%. Your silkscreen looks a lot lighter than that. They also say a minimum height of 0.8 mm: it's hard to say, but some of your call outs, like capacitor numbers and address, bits seem like they may be smaller than that?
Capacitor numbers and address are 0.8128 mm so it should be ok.

I already made some boards with ratio 10% and It's ok (see the last in attached image) so i hope that they accept my pcb files!  ;D
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 26, 2015, 12:56 pm
Quite legible. Are they from the same board house? If not, the same rules may not apply.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 26, 2015, 01:00 pm
Quote legible. Are they from the same board house? If not, the same rules may not apply.
Yes, it's the same (3pcb).
It's the cheaper that i found in china with selection of multiple colors for solder mask.
Do you know others cheaper? :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 26, 2015, 04:45 pm
It's been a while since I priced out sources. Their prices look reasonable -- although not for me, the shipping to the States is almost as much the boards! I hope your shipping is less expensive.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 26, 2015, 04:50 pm
Yes, it's about 40$ for shipping, but there is no comparison with european board houses in total cost. 50 boards it's 80-90$ shipped to Italy!
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 27, 2015, 11:26 am
Ok, last possibility for review on schematic and layout.  :smiley-mr-green:   

Tomorrow i'll send it for build!  :smiley-twist:   

 PS: Difference between this version and the previous is that I removed power supply traces chip to chip, and took it directly from every cap near chip.  :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Feb 27, 2015, 11:56 am
PS: Difference between this version and the previous is that I removed power supply traces chip to chip, and took it directly from every cap near chip.  :)
Good catch! That's the way it should be.

A good tip at this point is to use the "Show" command to highlight critical traces on the board, and see if they look reasonable without a lot of unnecessary rambling. On this board, I think that would include power, ground, and SCL/SDA.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Feb 27, 2015, 11:58 am
Good catch! That's the way it should be.

A good tip at this point is to use the "Show" command to highlight critical traces on the board, and see if they look reasonable without a lot of unnecessary rambling. On this board, I think that would include power, ground, and SCL/SDA.
Yes, this is what I'll do this afternoon before send for build!  :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 11, 2015, 08:01 pm
almost 2 weeks later last post, pcb finally arrived!  :smiley-twist:

In a few days should arrive all components  :smiley-mr-green:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 11, 2015, 08:14 pm
Nice. I hope it works as well as it looks!
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 11, 2015, 08:16 pm
I hope too, or I will have 50 tiles to use for decorate a wall  :smiley-yell:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 11, 2015, 08:33 pm
50!?!?!  :o

I'm not so brave... I would've placed a minimum order, proven the design, and then place the big order...
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 12, 2015, 12:33 am
50!?!?!  :o

I'm not so brave... I would've placed a minimum order, proven the design, and then place the big order...
Most of price is shipping and tax fees.
So buy 5 or 50 it's maybe 10-15$ of difference on a total of 80  ;)

And Why not, maybe i could sell them? :smiley-lol:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 13, 2015, 03:39 pm
Hey ShapeShifter, you are a wizard with code right?  :smiley-mr-green:

I'm trying to modify centipede library (http://macetech.com/Centipede.zip) for use it with the new shield.

The idea is that normal user don't need to know what pin of what chip of what board need to active, but simple give in init:
 - number of attached shields
 - how many chips are used as OUTPUT
 - how many chips are used as INPUT
 - default value for OUT pins (es. sainsmart works with negative value)

And library automatically set all chips.
Then when read or write a pin, it should automatically detect what shield and what chip have to enable.

So, the initialize function should be like:

Code: [Select]

void SmartDomo_Exp::initialize(int countShields, int countOUT_MCP, int countIN_MCP, int defaultOutPortValue)
{
  // inizialize address pins
  pinMode(addrPIN0, OUTPUT);
  pinMode(addrPIN1, OUTPUT);
  pinMode(addrPIN2, OUTPUT);
  pinMode(addrPIN3, OUTPUT);

  // inizialize shields chips
  maxchip_forOUT = countOUT_MCP;
  maxchip_forIN = countOUT_MCP + countIN_MCP;
  int currentchip = 0;
  int i = 0;
  while (i < countShields) // cycle for set default values for every chip on connected shields
  {
    SelectShield(i);

    for (int j = 0; j < 4; j++) {

      if (currentchip < maxchip_forOUT)
      {
        portMode(i, 0b0000000000000000); // set all pins on chip to output
        portWrite(i, defaultOutPortValue);   // write default value for output
      }
      else if(currentchip >= maxchip_forOUT & currentchip < maxchip_forIN)
      {
        portMode(i, 0b1111111111111111); // set all pins on chip to input
      }
      else
      {
        // default configuration for not set chips
        CSDataArray[0] = 255;
        CSDataArray[1] = 255;

        WriteRegisters(j, 0x00, 2);

        CSDataArray[0] = 0;
        CSDataArray[1] = 0;

        for (int k = 2; k < 0x15; k+=2) {
          WriteRegisters(j, k, 2);
        }
      }

      currentchip++;

    }
    i++;
  }
}


(i kept in else the same code of centipede)

But i don't undestand how to detect pin, chip and shield when call for example "digialWrite" function, that in centipede library is:

Code: [Select]


void SmartDomo_Exp::digitalWrite(int pin, int level) {
 
  int port = pin >> 4;
  int subregister = (pin & 8) >> 3;

  int regpin = pin - ((port << 1) + subregister)*8;

  WriteRegisterPin(port, regpin, 0x12 + subregister, level);
 
}


How can i convert it for detect right shield (0-15) and right chip of the shield (0-3)?

The centipede function, passing a pin value of "120", detect that it need to send the command to chip 8, GPIO-B and pin 0, but i don't undestand how.. i'm not so expert with binary numbers.  :P

In my case i should detect that is shield 1, chip 3, GPIO-B, pin 0.  How can i do it?   :smiley-yell:


I attached WIP library.

PS: For semplicity with develop of library and use it, I assume that user have to use all OUTPUT chips consecutively and than all INPUT chips.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 13, 2015, 06:42 pm
Hey ShapeShifter, you are a wizard with code right?  :smiley-mr-green:
Code? What is this code you are talking about? I don't understand...  :smiley-twist:

Quote
How can i convert it for detect right shield (0-15) and right chip of the shield (0-3)?

The centipede function, passing a pin value of "120", detect that it need to send the command to chip 8, GPIO-B and pin 0, but i don't undestand how.. i'm not so expert with binary numbers.  :P

In my case i should detect that is shield 1, chip 3, GPIO-B, pin 0.  How can i do it?   :smiley-yell:
First off, number everything with zero based numbers, it will make the math MUCH easier. You have up to 1024 logical pins, numbered 0 through 1023:

Normally, you would use a lot of division and modulo (remainder after division) arithmetic to convert a logical pin number to a physical board/chip/pin address:
But in this case, since all of the factors are powers of 2, it becomes much easier. The lowest 3 bits (8 values) are the pin number, the next bit (two values) is the port number, the next 2 bits (4 values) are the chip number, and the remaining 4 bits (16 values) are the board number. That's a total of 3 + 1 + 2 + 4 = 10 bits, which gives you your logical pin number range of 0 to 1023. Using B for board, C for chip, P for port, and p for physical pin, the 10 bits of a logical pin number become:
   15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
    0  0  0  0  0  0  B  B  B  B  C  C  P  p  p  p


You can extract those bits by shifting and masking. (If you're not familiar with them, look up the C or C++ shift and bitwise AND operators (http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/).)
Code: [Select]
unsigned logicalPin;

// The logical pin is already in the LSB position, so just mask off the rest of it.
byte pin = (logicalPin & 0x07);

// Shift the port number to the LSB, then mask off the other bits
byte port = ((logicalPin >> 3) & 0x01);

// Shift the chip number to the LSB, then mask off the other bits
byte chip = ((logicalPin >> 4) & 0x03);

// Shift the board number to the LSB, then mask off the other bits
byte board = ((logicalPin >> 6) & 0x0f);


Having everything zero based like this makes it easy to use these values as indexes into arrays to act as lookup tables. For example, you could create a constant 4 element array of I2C addresses, and then index it by the chip number to get the I2C address of the chip.
Code: [Select]
// Define a constant lookup table to convert chip number 0-3 to an I2C address
const byte I2Caddress[] = (36, 37, 38, 39};

byte address = I2Caddress[chip];


However, if you are going to use a switch statement to convert the chip number to an I2C address, then you really don't have to spend the execution time shifting the address into place, just mask it off and use the appropriate case alternative constants:
Code: [Select]
// Mask off and decode the chip number bits
switch (logicalPin & 0x30)
{
  case 0x00:  address = 36;  break;
  case 0x10:  address = 37;  break;
  case 0x20:  address = 38;  break;
  case 0x30:  address = 39;  break;
}

You could do the same thing with the port number to translate that into a device register address, as well as translate the board number into the digital I/O.
Code: [Select]
// Mask off and convert the board number bits
switch (logicalPin & 0x03c0)
case
{
  case 0x0000: digitalWrite(a0Pin, low);  digitalWrite(a1pin, low);  digitalWrite(a2pin, low);  digitalWrite(a3pin, low);  break;
  case 0x0040: digitalWrite(a0Pin, low);  digitalWrite(a1pin, low);  digitalWrite(a2pin, low);  digitalWrite(a3pin, high); break;
  case 0x0080: digitalWrite(a0Pin, low);  digitalWrite(a1pin, low);  digitalWrite(a2pin, high); digitalWrite(a3pin, low);  break;
   ... and so on ...
  case 0x03c0: digitalWrite(a0Pin, high); digitalWrite(a1pin, high); digitalWrite(a2pin, high); digitalWrite(a3pin, high); break;

But it would be tedious to write out 16 case alternatives and the appropriate four digitalWrite statements for each one. You could create an array of 16 elements, where each element is a structure for holding the values of the four output bits, but there is an even simpler way. Since the four bits that identify a board are a straight binary sequence just like the four bits that are output to select the board, the whole board selection process can come down to:
Code: [Select]

// Decode the logical pin number to address bits and set the outputs
digitalWrite(a0pin, (logicalPin & 0x0040));
digitalWrite(a1pin, (logicalPin & 0x0080));
digitalWrite(a2pin, (logicalPin & 0x0100));
digitalWrite(a3pin, (logicalPin & 0x0200));


There is a lot here. If there is anything you don't understand, I would spend some time studying it, researching it, and asking questions until the whole thing makes sense. Once you understand it all, you can decide which is the best way to decode the values, and then you can decide how to write the rest of the library.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 14, 2015, 02:07 pm
After your usually great explain, i edited library with some improvements.  :P

There are some things that need to have shield running for understanding if can work, and other things that is under wip (like digitalReadAll). 

I added 2 different read/write function, because developing my home automation system i notice that it's more simple to control what pin of what board, instead that use it from pin X to pin Y on different shields (i need to know where every pin of every board have to be connected!).

Take a look and let me know!  :D
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: robtillaart on Mar 14, 2015, 04:42 pm
some comments on the lib

the lines do not need to be in the cpp file

#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

a lot of variables are int now that is a 16 bit signed int. If you look carefully you can replace a lot of them with uint8_t (8 bit unsigned int). That reduces the footprint of the library and prevents values below 0 (e.g. negative pinnumbers) e.g.
uint8_t addrPIN0 = 5;
uint8_t addrPIN1 = 6;

also in loops using 16 bits ints where a 8 bit int would be sufficient reduces footprint e.g.
for (uint8_t j = 0; j < 4; j++) {

idem in interfaces of functions


the return value of  Wire.endTransmission(); should return 0 for success.
You can check that in the library and forward this return code the calling functions (user sketch) so it can detect errors.

Code: [Select]

int SmartDomo_Exp::WriteRegisters(int chip, int startregister, int quantity) {
  Wire.beginTransmission(CSAddress + chip);
  wiresend(startregister);
  for (int i = 0; i < quantity; i++) {
    wiresend(CSDataArray[i]);
  }

  return Wire.endTransmission();
}

The functions that use WriteRegister can use/forward the return value even further/

Code: [Select]

int SmartDomo_Exp::WriteRegisterPin(int chip, int regpin, int gpio_register, int level) {

  ReadRegisters(chip, gpio_register, 1);
 
  if (level == 0) {
    CSDataArray[0] &= ~(1 << regpin);
  }
  else {
    CSDataArray[0] |= (1 << regpin);
  }
 
  return WriteRegisters(chip, gpio_register, 1);  // <<<<<<<
 
}


my 2 cents
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 14, 2015, 06:53 pm
Thanks a lot for your suggestions!

This is my first library and every help is very appreciated!  ;D

Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 15, 2015, 12:13 pm
Updated library with robtillaart suggestions and with completed functions digitalReadAll and digitalReadExpAll.  :)

I'm waiting for components for assembly board and compile+test library. I hope they'll arrive tomorrow!  :smiley-mr-green:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: robtillaart on Mar 15, 2015, 02:51 pm

I use a header to track version of the lib, it looks like
Code: [Select]
//
//    FILE: IEEE754tools.h
//  AUTHOR: Rob Tillaart
// VERSION: 0.1.03
// PURPOSE: IEEE754 tools
//
// http://playground.arduino.cc//Main/IEEE754tools
//
// Released to the public domain
// not tested, use with care
//
// 0.1.03 renamed IEEE_Sign IEEE_Exponent
// 0.1.02 added SHIFT_POW2
// 0.1.01 added IEEE_NAN, IEEE_INF tests + version string
// 0.1.00 initial version


If someone has a problem with your library it is very convenient to know the version to debug :)

2) I think there are still some parameters that can be changed to smaller datatypes.
did you measure the diff in footprint?
(note that minimal sizes for datatypes in interfaces are affecting the especially the runtime footprint)

Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 15, 2015, 03:12 pm
Yes, track versioning is a good idea :)

No i didn't measure footprint yet, as i wrote this is my first library :D

Can you help me with this datatypes to change?   :smiley-razz:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: robtillaart on Mar 15, 2015, 03:26 pm
just search for int

uint8_t SmartDomo_Exp::WriteRegisterPin(uint8_t chip, int regpin, uint8_t gpio_register, int level) {
level is a candidate for uint8_t


uint8_t SmartDomo_Exp::pinMode(int logicalPin, int mode)
uint8_t SmartDomo_Exp::pinPullup(int logicalPin, int mode)
uint8_t SmartDomo_Exp::digitalWrite(int logicalPin, int level)
uint8_t SmartDomo_Exp::digitalWriteExp(uint8_t board, int logicalPin, int level)

logical pin can be [0..1024] so uint16_t would prevent negative nr's
mode seems an uint8_t candidate


int SmartDomo_Exp::digitalReadExp(uint8_t board, int logicalPin)
can return an uint8_t
a pin is either LOW==0   or  HIGH (<>0)


void SmartDomo_Exp::digitalReadAll(bool data[])
a bool array takes one byte per value, you should consider making a bit array out of it
Takes 8x less data
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 15, 2015, 03:30 pm
Thanks a lot!

how can i make a 1024 bit array?
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: robtillaart on Mar 15, 2015, 03:53 pm
boolean error

    if(currentchip >= maxchip_forOUT & currentchip < maxchip_forIN)  // bitwise and

must be

    if ((currentchip >= maxchip_forOUT) && (currentchip < maxchip_forIN))  // logical and
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: robtillaart on Mar 15, 2015, 03:53 pm
1024 bit array is a 1024/8 = 256 byte array
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: robtillaart on Mar 15, 2015, 03:59 pm
check this example for bit array
Code: [Select]

void SmartDomo_Exp::digitalReadAll(uint8_t data[])
{
  uint8_t currentchip = 0;
  uint16_t idx = 0;
  for(uint8_t shield = 0; shield < countShields; shield++) // cycle all chips
  {
    SelectShield(shield);
    for (uint8_t j = 0; j < 4; j++)
    {
      if ( (currentchip >= maxchip_forOUT) && (currentchip < maxchip_forIN))
      {
        uint16_t chipValue = chipRead(j);
        data[idx] = chipValue / 256;  // or bithMath (chipValue & 0xFF00) >> 8;
        idx++;
        data[idx] = chipValue % 255;  // (chipValue & 0xFF)
        idx++;
      }
      currentchip++;
    }  // for j
  } // for shield
}
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: robtillaart on Mar 15, 2015, 04:01 pm
  receivedval |= CSDataArray[1] << 8;

==>

  receivedval |= ( CSDataArray[1] << 8 );

to make the order explicit
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: robtillaart on Mar 15, 2015, 04:04 pm
uint8_t SmartDomo_Exp::chipWrite(uint8_t chip, int value) {
 
  CSDataArray[0] = value;
  CSDataArray[1] = value>>8;
 
  return WriteRegisters(chip, 0x12, 2);  // 0x12 is a magic number!
 
}


better make a #define in the .h file

#define SOMEMEANINGFULNAME 0x12

uint8_t SmartDomo_Exp::chipWrite(uint8_t chip, int value) {
 
  CSDataArray[0] = value;
  CSDataArray[1] = value>>8;
 
  return WriteRegisters(chip, SOMEMEANINGFULNAME, 2);  // 0x12 is a magic number!
 
}
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 15, 2015, 04:07 pm
Yes but i don't know what mean this number, There was as is in centipede library :P
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: macegr on Mar 15, 2015, 08:52 pm
It's all magic numbers, but they relate to the chip's datasheet. The code was written five years ago, I'd definitely define/name some register values if I rewrote it. However, it was written while fully understanding the hardware I designed...I would recommend that if you're writing (or more accurately, modifying) a library, you should also do it fully understanding the hardware that you're using.

Also, the check for Arduino 100 is necessary if someone wants to use a pre-1.0 Arduino version.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 15, 2015, 09:03 pm
Hey, nice to see you, I would have never imagined you see my topic!  :)

If you saw, i wrote in top of library that mine is derived from your library, for respect to your great work.
Thank you!  :D

Yes, i'm modifying library for use with my board, but i don't assembly yet, so i'm sure that after assembly it i'll have to do some corrections to the library.


Can i ask you what do you think about my board?  :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 16, 2015, 02:24 pm
Updated!  :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 17, 2015, 05:03 pm
Hi to all, i just assembled first prototype but there is something wrong, i don't know if with pcb or with code.  :smiley-cry:

I have "2:received NACK on transmit of address" from Wire.endTransmission() in portMode and portWrite, what does it mean?

it appear that all chips are dead, address selection is working, every chip has right address and power supply is ok. i don't undestand what could be the problem..  :smiley-sad:

This is the test code, i'm using centipede library for testing until modified library will be ready.

I enabled all chips from 0 to 7, so any wrong address could have chips, it should enable all anyway:

Code: [Select]

// Example code for Centipede Library
// Works with Centipede Shield or MCP23017 on Arduino I2C port
 
#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>
#include <Wire.h>
#include <Centipede.h>
#include "Console.h"

Centipede CS; // create Centipede object
 
 
#define HIGH_VAL 0x0 // Inverto i valori perchè le schede sainsmart lavorano con i negativi
#define LOW_VAL  0x1 // Inverto i valori perchè le schede sainsmart lavorano con i negativi
 
 
uint8_t addrPIN0 = 5;
uint8_t addrPIN1 = 6;
uint8_t addrPIN2 = 7;
uint8_t addrPIN3 = 8;

void setup()
{
pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
  Bridge.begin();
  Console.begin();
  digitalWrite(13, HIGH);

  // Enable pins of address and reset
  pinMode(addrPIN0, OUTPUT);
  pinMode(addrPIN1, OUTPUT);
  pinMode(addrPIN2, OUTPUT);
  pinMode(addrPIN3, OUTPUT);
  pinMode(3, OUTPUT);
 
  // set pin of address to 0000 and reset to 0
  digitalWrite(addrPIN0, LOW);
  digitalWrite(addrPIN1, LOW);
  digitalWrite(addrPIN2, LOW);
  digitalWrite(addrPIN3, LOW);
  digitalWrite(3, LOW);


  Wire.begin(); // start I2C
  CS.initialize(); // set all registers to default
 
  // **DEBUG ** stops the program until Serial Monitor is opened
  //while (!Console) ;

  uint8_t ret = 0;
  ret = CS.portMode(0, 0b0000000000000000); // set all pins on chip 0 to output
  Console.println(ret);
  ret = CS.portMode(1, 0b0000000000000000); // set all pins on chip 1 to output
  Console.println(ret);
  ret = CS.portMode(2, 0b0000000000000000); // set all pins on chip 2 to output
  Console.println(ret);
  ret = CS.portMode(3, 0b0000000000000000); // set all pins on chip 3 to output
  Console.println(ret);
  ret = CS.portMode(4, 0b0000000000000000); // set all pins on chip 0 to output
  Console.println(ret);
  ret = CS.portMode(5, 0b0000000000000000); // set all pins on chip 1 to output
  Console.println(ret);
  ret = CS.portMode(6, 0b0000000000000000); // set all pins on chip 2 to output
  Console.println(ret);
  ret = CS.portMode(7, 0b0000000000000000); // set all pins on chip 3 to output
 Console.println(ret);
 
 
  Console.println("WRITE PORTS");
    // 0b1111111111111111
  ret = CS.portWrite(0, 0b0000000000000000); // set all pins on chip 0(1°centipede) to 1 (sainsmart works with negative value)
  Console.println(ret);
  ret = CS.portWrite(1, 0b0000000000000000); // set all pins on chip 1(1°centipede) to 1 (sainsmart works with negative value)
  Console.println(ret);
  ret = CS.portWrite(2, 0b0000000000000000); // set all pins on chip 2(1°centipede) to 1 (sainsmart works with negative value)
  Console.println(ret);
  ret = CS.portWrite(3, 0b0000000000000000); // set all pins on chip 3(1°centipede) to 1 (sainsmart works with negative value)

  Console.println(ret);
  ret = CS.portWrite(4, 0b0000000000000000); // set all pins on chip 0(2°centipede) to 1 (sainsmart works with negative value)
  Console.println(ret);
  ret = CS.portWrite(5, 0b0000000000000000); // set all pins on chip 1(2°centipede) to 1 (sainsmart works with negative value)
  Console.println(ret);
  ret = CS.portWrite(6, 0b0000000000000000); // set all pins on chip 2(2°centipede) to 1 (sainsmart works with negative value)
  Console.println(ret);
  ret = CS.portWrite(7, 0b0000000000000000); // set all pins on chip 3(2°centipede) to 1 (sainsmart works with negative value)
  Console.println(ret);
  //TWBR = 12; // uncomment for 400KHz I2C (on 16MHz Arduinos)
 
  Console.println("END WRITE PORTS");
}
 
 
void loop()
{
}



Serial monitor:
Code: [Select]

2
2
2
2
2
2
2
2
WRITE PORTS
2
2
2
2
2
2
2
2
END WRITE PORTS

Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 17, 2015, 06:20 pm
I tried also with "i2c_scanner" but response is : "No I2C devices found".. what could be the problem?  :smiley-roll-blue:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 17, 2015, 06:51 pm
Hmmm... I was wondering why your code is setting pin 3 to an output and low. But now I'm looking at your schematic (don't know if it's the latest) and I see that pin 3 is hooked up to the reset lines of all of the chips.

Besides the SCL and SDA pins you are using, these I2C signals are also on pins 2 and 3. Once you initialize the wire library, I'm sure it's re-setting pin 3 to be the SCL signal, overriding your settings.

However, that means that the SCL line is being fed to the reset pins of your chips. Every I2C clock cycle is resetting those chips! I don't know why none of us saw this before now.  :o

For a quick test, gently bend the pin 3 shield pin out of the way so it isn't making contact with the Yun, and use a jumper to temporarily hold that unconnected pin at 5V, and see if it works.

If that makes it work, then you will need to cut the trace going to shield pin 3, and jump it somewhere else, like to pin 4. (A hobby razor knife and a very thin piece of wire will come in handy here. I use solid core wire-wrap wire for such jumpers.)

Another issue is that you are setting pin 3 low. The reset pin is an active low signal, so by holding the line low you would be holding the chip in reset. I say "would be" because the pin will be redefined as I2C by Wire.begin(). But it's something to keep in mind when you move it to another pin: initially set the pin LOW to reset the chip, but then set it HIGH and keep it there to be able to use the chip.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 17, 2015, 06:56 pm
YOU ARE A GENIUS!  :smiley-grin:

Just move outside pin 3 and connected to 5v and now:

ADDR SEL 0000:
Scanning...
I2C device found at address 0x20  !
I2C device found at address 0x21  !
I2C device found at address 0x23  !
done

ADDR SEL 0001:
Scanning...
I2C device found at address 0x24  !
I2C device found at address 0x25  !
I2C device found at address 0x27  !
done


 YEAHHH  :smiley-twist:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 17, 2015, 06:59 pm
uhm. but where is third chip?  :smiley-eek:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 17, 2015, 07:03 pm
Double check all of the connections to that chip. Are the address lines set right? Are there any shorts between pins? Are there any cold solder joints that aren't really making contact? Is the chip in backwards? Is there a lot of flux or other gunk around the pins that needs to be cleaned out?
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 17, 2015, 07:10 pm
I not used pin 4 because ethernet shield use it for SD.

I tried to set:

 Wire.begin();
 
 pinMode(3, OUTPUT);
 digitalWrite(3, HIGH);

But it doesn't work.. so i should only to cut pin 3 and no use reset?  :smiley-razz:


I'll check chip 3 connections!

I'll also use hot air gun for solder SMD chips, maybe i warmed too much the chip 3 (we was testing time and themp for best soldering.. )
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 17, 2015, 07:17 pm
Ok found it, one of address pin was not right soldered!  ;)

How can i solve pin 3 issue without redraw pcb?  :smiley-razz:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 17, 2015, 08:39 pm
I tried to set:

 Wire.begin();
 
 pinMode(3, OUTPUT);
 digitalWrite(3, HIGH);

But it doesn't work.. so i should only to cut pin 3 and no use reset?  :smiley-razz:
You're right, that won't work. Wire.begin() is initializing the pin to be part of the I2C hardware interface. Then, you are re-initializing the pin to always be high, taking the pin function away from I2C. Then, when you try to perform an I2C operation, SDA is being sent, but SCL is blocked because now the signal is always high.

You MUST cut the connection to pin 3. There is no software workaround. Once cut, either tie the pin always high and don't have any reset function, or better yet tie it to the shield reset pin so the chips are reset whenever the 32U4 processor is reset, or best option is tie it to another shield pin and use that as the reset signal.

How can i solve pin 3 issue without redraw pcb?  :smiley-razz:
Cut the trace leading to pin 3. Do it on the bottom of the board where it's less visible (see attached.) Using a hobby razor knife carefully cut a gap in the trace. Then, solder a fine jumper wire from one of the reset pins at the chip (or one of the vias in the chain if they don't have soldermask) and connect it to +5v, the shield reset pin, or another shield I/O pin. If possible to solder onto one of the vias, I would put the jumper on the bottom of the board, going from the desired shield I/O pin to the nearest via on that trace.

An example of a cut and jumped trace:

(http://billmaudio.com/wp/wp-content/uploads/2009/01/p1190206.jpg)

Note how the trace was cut through just above the right end of the black wire, and then a fine wire was soldered in to make the correct connection. Note how the wire is glued down to the board - this is a very good idea. Either cyanoacrilate super glue can be used, or blobs of hot melt glue.

This is not an unusual situation, it's quite common for there to be several cuts and jumps on a new board design. If this is the only issue that crops up, you're doing great!
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 17, 2015, 10:19 pm
Having a look here: http://playground.arduino.cc/Main/ShieldPinUsage
Pin 9 could be a good candidate for replace pin 3, right? I would avoid to make a shield that is incompatible with ethernet shield and gsm shield, that i think they are the most used.

Is it a bad idea if i cut pin out of pin 3 and attach it to pin 9?
I think there is too way to arrive at reset pin for make it with a bottom wire..
i usually i dont like external wire on pcb but it seem the only solution   :smiley-confuse:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 17, 2015, 11:12 pm
Is it a bad idea if i cut pin out of pin 3 and attach it to pin 9?
I'm not sure what you're saying here.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 17, 2015, 11:20 pm
I'm not sure what you're saying here.
Sorry for my bad english  :smiley-lol:
I mean cut pin 3 and solder a wire between pin 3 and pin 9 on bottom of shield.  :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 18, 2015, 12:36 am
You could do that. But it would be a cleaner mod if you could solder a jumper from pin 9 to the nearest via on that line. If you can, then cut the trace where I indicated. It all comes down to whether the vias have solder mask over them. If not, that's a cleaner way to go, as it leaves the circuit in place through pin 3 in case you add a shield that uses those pins 2 and 3 for I2C.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 18, 2015, 03:24 pm
here we are!  :smiley-mr-green:

I tried to solder pin 9 with nearest via on pin 3 line but they are too small for solder a wire that can be stay there good, so easiest solution was cut pin 3 and connect a small wire to +5v. Nearest via is +5v bus that arrive at cap on chip 0.
It is not so beautiful, but it works!  :smiley-yell:

I attached some pics of shield completed, i don't like that type of caps, maybe I'll change in next builds.
This shield looks like a little town  :smiley-lol:

I tested with centipede library and it works good, now i've to complete my library and make some others deep test.

Thanks to all for big help that you gave me until now!
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 18, 2015, 03:31 pm
One question:

In my library i need to set address pin so i use normal digitalWrite, but i think that arduino use digitalWrite of my library instead of "standard" digitalWrite, and it crashes.  :smiley-razz:
I tried to rename all my library functions to something like prefix_* and all work fine, but is there some other method without rename all my functions and keep standard name using some default function like digitalWrite inside the library?

a simple example:


Code: [Select]

void SmartDomo_Exp::initialize(uint8_t countShields, uint8_t countOUT_MCP, uint8_t countIN_MCP, uint16_t defaultOutChipValue)
{
  // inizialize address pins
  // here it crash because it use below fuctions instead of default.
  pinMode(addrPIN0, OUTPUT);
  pinMode(addrPIN1, OUTPUT);
  pinMode(addrPIN2, OUTPUT);
  pinMode(addrPIN3, OUTPUT);
  pinMode(resetPIN, OUTPUT);
  digitalWrite(resetPIN, LOW);

  ...............
}

uint8_t SmartDomo_Exp::pinMode(uint16_t logicalPin, uint8_t mode) {
    pin_pos p; 
  p = logicToRealPin(logicalPin);
  SelectShield(p.board);
  return WriteRegisterPin(p.chip, p.pin, p.gpio_register, mode ^ 1);
 
}

uint8_t SmartDomo_Exp::digitalWrite(uint16_t logicalPin, uint8_t level) { 
  pin_pos p; 
  p = logicToRealPin(logicalPin);
  SelectShield(p.board);
  return WriteRegisterPin(p.chip, p.pin, 0x12 + p.gpio_register, level);
}

Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 18, 2015, 05:18 pm
I attached some pics of shield completed, i don't like that type of caps, maybe I'll change in next builds.
Looks nice!  8)  The repair should work well, and looks nicely done.

Yes, those caps are quite large. There's a 1K marking on them, are they rated for 1000 Volts?  :o If so, you don't need anywhere near that high of a voltage rating, anything over 15 volts will be more than enough, and they will be physically smaller and fit better. (Of course, the cap on the input of the voltage regulator should be rated higher, the 50V rating on the cap you used looks perfect.)

I notice the markings on the shield connectors of your Yun look like stickers. Interesting, the markings on mine are printed directly on the headers. Obviously, ours were built in different batches.

In my library i need to set address pin so i use normal digitalWrite, but i think that arduino use digitalWrite of my library instead of "standard" digitalWrite, and it crashes.  :smiley-razz:
Outside of the class, digitalWrite() will get the "normal" function, unless you are specifically accessing the function defined by the class.

But inside the class, it will assume you want the the one defined by your class. To access a different version of a function with the same name, you have to preface it with the namespace. Since you want the version that is not defined in any class, leave the namespace blank, but you still need the scope resolution operator ( :: ) for example:
Code: [Select]
::digitalWrite(resetPIN, LOW);
Inside your code, you're using SmarDomo_Exp:: in several places to indicate you mean to use the class's namespace. Just using the double colon by itself with nothing in front of it means you want to reference the global namespace. You only need to do this when working within the class itself, because the local class namespace is assumed. When you are outside of the class, you don't need to do this because the global namespace is assumed.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 18, 2015, 06:43 pm
Looks nice!  8)  The repair should work well, and looks nicely done.

Yes, those caps are quite large. There's a 1K marking on them, are they rated for 1000 Volts?  :o If so, you don't need anywhere near that high of a voltage rating, anything over 15 volts will be more than enough, and they will be physically smaller and fit better. (Of course, the cap on the input of the voltage regulator should be rated higher, the 50V rating on the cap you used looks perfect.)
I just checked in a local electronic store, caps are 50V, and they are the only one with 2.54mm.. I will check online if I will found something smaller! :smiley-razz:
For next builds i'll put caps a little more down, I have components for about 4-5 shields, so I need to reorder :D

Thanks for library tip, I'll try!  :smiley-yell:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 18, 2015, 08:59 pm
The family is growing!  :smiley-twist:  :smiley-twist:  :smiley-twist:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 22, 2015, 12:51 pm
After some testing, there is something wrong with 74HC85D.

as the datasheet describes (http://www.nxp.com/documents/data_sheet/74HC_HCT85_CNV.pdf), it should take a max of 35 nS to change output value at change of A and B inputs.

But, as show in this video:

https://www.youtube.com/watch?v=2Frdi_Ajg7s

It take a lot longer, about 5-6 SECONDS!

for explain a bit, console result is:

PIN - BOARD  High/Low result: 0 (ok) / 2 (ko)

Board 1 isn't connected, so it should return always 2.

With multimeter i'm measuring 74HC85D output connected to A2 of every MCP* chip.

When console writes SET SHIELD * code execution is:

Code: [Select]

void SmartDomo_Exp::SelectShield(uint8_t shieldAddr) {
  // extract bit X from binary value of shieldAddr and so on 
  if (lasShieldAddr != shieldAddr)
  {
    Console.print(F("SET SHIELD "));
    Console.println(shieldAddr);
    ::digitalWrite(addrPIN0, (shieldAddr & (1 << (1-1)))?1:0 );
    ::digitalWrite(addrPIN1, (shieldAddr & (1 << (2-1)))?1:0 );
    ::digitalWrite(addrPIN2, (shieldAddr & (1 << (3-1)))?1:0 );
    ::digitalWrite(addrPIN3, (shieldAddr & (1 << (4-1)))?1:0 );
    lasShieldAddr = shieldAddr;
    delay(1000);
  }
}


I added also a delay of 1 SECOND but it doesn't change a lot..
I tried to measure addrPIN0 that is the only one that should change from 0 to 1 when changing the board and it's value change immediately, so is 74HC85D so slow?  :smiley-eek:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 22, 2015, 12:59 pm
Just tried with another board, and works fine.. so there is something wrong with that 74HC85D. I'll try to change it!  :smiley-razz:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 22, 2015, 01:24 pm
As a kid, I was always playing with electronics and building circuits. There was no question I wanted to be an electrical engineer. Then, while at university, was first exposed to computers - pretty interesting. I was on a co-op work/study plan where I spent 6 months in school, and six months working in industry. My first work cycle, I was doing strictly electronics, which was OK. My second cycle was mostly software, which I liked. My third started out by designing a board and finished with programming it - the work on the board was OK but tedious, but the software was really fun. When I came back from that work cycle, I changed majors from electrical engineering to computers.

The main reason: I don't like checking out hardware. OK, that's not quite right: it's fun getting the first board to work. But what I hate is that every board needs the same amount of work to check out and debug. That really wears me down, and that's exactly what you're running into now. I feel your pain!
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 22, 2015, 01:32 pm
Yes, every test that i made I was in cross fingers!   :smiley-eek-blue:

I cannot yet testing 2 boards togheter, but i hope to do it soon.

I'm writing some code for standard board testing, so i can deploy and try every single board. boooring work!  :D
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 22, 2015, 02:31 pm
boooring work!  :D
Yes, but having a an automated test setup goes a long way toward making that easier. Well worth the effort if you have more than a few boards.

I don't know what you have in mind for your test suite, but I know what I would do: put a known good working board on top of the Arduino, and attach four ribbon cables to it. Then, stack the board under test on top, and attach those four ribbon cables to it. The idea is that each chip under test is connected to known working chip. Then the code starts testing:
In the future when you have reset hooked up properly, do a reset test by setting an output pattern on each chip, and verify the pattern. Then pulse the reset line and verify that the pattern is cleared on all chips.

This test would be mostly automatic, with an occasional prompt on the serial monitor for you to change an address bit. It would, of course, list any failures found to the serial monitor.

You could do all of this with just the board under test, connecting chip 1 to 2 and 3 to 4. While that's a simpler setup, when you find a failure (not if, but when!) it will be hard to tell if it's the input or output side that has the problem. With a known good board as a reference, you can be pretty sure that any failures are with the specific chip or bit on the board under test.[/list]
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 22, 2015, 02:44 pm
If i test all chips as outputs, it should also work as inputs, right?

For now i wrote a loop for every chip in output mode with parameter on board address so i can change hardware addr of board and see If response and activate outputs in sequence.
With another loop on a board that it doesnt exists as shown in video i can test that 74hc85 response as expected.  :)

Not too much complex testing suite for now  :smiley-lol:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 22, 2015, 02:55 pm
If i test all chips as outputs, it should also work as inputs, right?
That will have tested the traces and the solder connections on the boards, but not necessarily the input circuitry within the chip itself. Admittedly, internal failures on chips are rare, but they do happen.

It shouldn't take that long to loop through all of the pins because you can write/read/write/read as fast as you can. Since it's the code reading the output via an input, and not you looking at the output, it can go very fast because you don't need delays for you to be able to see the change. Rippling through all of the outputs while watching that the relays flip in the right order can take time, but fully automating it should be relatively fast.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 22, 2015, 03:22 pm
That will have tested the traces and the solder connections on the boards, but not necessarily the input circuitry within the chip itself. Admittedly, internal failures on chips are rare, but they do happen.

It shouldn't take that long to loop through all of the pins because you can write/read/write/read as fast as you can. Since it's the code reading the output via an input, and not you looking at the output, it can go very fast because you don't need delays for you to be able to see the change. Rippling through all of the outputs while watching that the relays flip in the right order can take time, but fully automating it should be relatively fast.
Yes with 2 boards it's lot simpler to automatize the testing. I'll try after change broken 74HC85 on first board  :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 24, 2015, 02:11 pm
Automatic testing works fine!  :smiley-twist:

Code: [Select]
START INIZIALIZE SHIELD
END INIZIALIZE SHIELD
SHIELD 0
0-0 H. result: OK --> IN: 1
1-0 H. result: OK --> IN: 1
2-0 H. result: OK --> IN: 1
3-0 H. result: OK --> IN: 1
4-0 H. result: OK --> IN: 1
5-0 H. result: OK --> IN: 1
6-0 H. result: OK --> IN: 1
7-0 H. result: OK --> IN: 1
8-0 H. result: OK --> IN: 1
9-0 H. result: OK --> IN: 1
10-0 H. result: OK --> IN: 1
11-0 H. result: OK --> IN: 1
12-0 H. result: OK --> IN: 1
13-0 H. result: OK --> IN: 1
14-0 H. result: OK --> IN: 1
15-0 H. result: OK --> IN: 1
16-0 H. result: OK --> IN: 1
17-0 H. result: OK --> IN: 1
18-0 H. result: OK --> IN: 1
19-0 H. result: OK --> IN: 1
20-0 H. result: OK --> IN: 1
21-0 H. result: OK --> IN: 1
22-0 H. result: OK --> IN: 1
23-0 H. result: OK --> IN: 1
24-0 H. result: OK --> IN: 1
25-0 H. result: OK --> IN: 1
26-0 H. result: OK --> IN: 1
27-0 H. result: OK --> IN: 1
28-0 H. result: OK --> IN: 1
29-0 H. result: OK --> IN: 1
30-0 H. result: OK --> IN: 1
31-0 H. result: OK --> IN: 1
32-0 H. result: OK --> IN: 1
33-0 H. result: OK --> IN: 1
34-0 H. result: OK --> IN: 1
35-0 H. result: OK --> IN: 1
36-0 H. result: OK --> IN: 1
37-0 H. result: OK --> IN: 1
38-0 H. result: OK --> IN: 1
39-0 H. result: OK --> IN: 1
40-0 H. result: OK --> IN: 1
41-0 H. result: OK --> IN: 1
42-0 H. result: OK --> IN: 1
43-0 H. result: OK --> IN: 1
44-0 H. result: OK --> IN: 1
45-0 H. result: OK --> IN: 1
46-0 H. result: OK --> IN: 1
47-0 H. result: OK --> IN: 1
48-0 H. result: OK --> IN: 1
49-0 H. result: OK --> IN: 1
50-0 H. result: OK --> IN: 1
51-0 H. result: OK --> IN: 1
52-0 H. result: OK --> IN: 1
53-0 H. result: OK --> IN: 1
54-0 H. result: OK --> IN: 1
55-0 H. result: OK --> IN: 1
56-0 H. result: OK --> IN: 1
57-0 H. result: OK --> IN: 1
58-0 H. result: OK --> IN: 1
59-0 H. result: OK --> IN: 1
60-0 H. result: OK --> IN: 1
61-0 H. result: OK --> IN: 1
62-0 H. result: OK --> IN: 1
63-0 H. result: OK --> IN: 1
0-0 L. result: OK --> IN: 0
1-0 L. result: OK --> IN: 0
2-0 L. result: OK --> IN: 0
3-0 L. result: OK --> IN: 0
4-0 L. result: OK --> IN: 0
5-0 L. result: OK --> IN: 0
6-0 L. result: OK --> IN: 0
7-0 L. result: OK --> IN: 0
8-0 L. result: OK --> IN: 0
9-0 L. result: OK --> IN: 0
10-0 L. result: OK --> IN: 0
11-0 L. result: OK --> IN: 0
12-0 L. result: OK --> IN: 0
13-0 L. result: OK --> IN: 0
14-0 L. result: OK --> IN: 0
15-0 L. result: OK --> IN: 0
16-0 L. result: OK --> IN: 0
17-0 L. result: OK --> IN: 0
18-0 L. result: OK --> IN: 0
19-0 L. result: OK --> IN: 0
20-0 L. result: OK --> IN: 0
21-0 L. result: OK --> IN: 0
22-0 L. result: OK --> IN: 0
23-0 L. result: OK --> IN: 0
24-0 L. result: OK --> IN: 0
25-0 L. result: OK --> IN: 0
26-0 L. result: OK --> IN: 0
27-0 L. result: OK --> IN: 0
28-0 L. result: OK --> IN: 0
29-0 L. result: OK --> IN: 0
30-0 L. result: OK --> IN: 0
31-0 L. result: OK --> IN: 0
32-0 L. result: OK --> IN: 0
33-0 L. result: OK --> IN: 0
34-0 L. result: OK --> IN: 0
35-0 L. result: OK --> IN: 0
36-0 L. result: OK --> IN: 0
37-0 L. result: OK --> IN: 0
38-0 L. result: OK --> IN: 0
39-0 L. result: OK --> IN: 0
40-0 L. result: OK --> IN: 0
41-0 L. result: OK --> IN: 0
42-0 L. result: OK --> IN: 0
43-0 L. result: OK --> IN: 0
44-0 L. result: OK --> IN: 0
45-0 L. result: OK --> IN: 0
46-0 L. result: OK --> IN: 0
47-0 L. result: OK --> IN: 0
48-0 L. result: OK --> IN: 0
49-0 L. result: OK --> IN: 0
50-0 L. result: OK --> IN: 0
51-0 L. result: OK --> IN: 0
52-0 L. result: OK --> IN: 0
53-0 L. result: OK --> IN: 0
54-0 L. result: OK --> IN: 0
55-0 L. result: OK --> IN: 0
56-0 L. result: OK --> IN: 0
57-0 L. result: OK --> IN: 0
58-0 L. result: OK --> IN: 0
59-0 L. result: OK --> IN: 0
60-0 L. result: OK --> IN: 0
61-0 L. result: OK --> IN: 0
62-0 L. result: OK --> IN: 0
63-0 L. result: OK --> IN: 0
SHIELD 1
0-1 H. result:  *** ALERT (2) ***
1-1 H. result:  *** ALERT (2) ***
2-1 H. result:  *** ALERT (2) ***
3-1 H. result:  *** ALERT (2) ***
4-1 H. result:  *** ALERT (2) ***
5-1 H. result:  *** ALERT (2) ***
6-1 H. result:  *** ALERT (2) ***
7-1 H. result:  *** ALERT (2) ***
8-1 H. result:  *** ALERT (2) ***
9-1 H. result:  *** ALERT (2) ***
10-1 H. result:  *** ALERT (2) ***
11-1 H. result:  *** ALERT (2) ***
12-1 H. result:  *** ALERT (2) ***
13-1 H. result:  *** ALERT (2) ***
14-1 H. result:  *** ALERT (2) ***
15-1 H. result:  *** ALERT (2) ***
16-1 H. result:  *** ALERT (2) ***
17-1 H. result:  *** ALERT (2) ***
18-1 H. result:  *** ALERT (2) ***
19-1 H. result:  *** ALERT (2) ***
20-1 H. result:  *** ALERT (2) ***
21-1 H. result:  *** ALERT (2) ***
22-1 H. result:  *** ALERT (2) ***
23-1 H. result:  *** ALERT (2) ***
24-1 H. result:  *** ALERT (2) ***
25-1 H. result:  *** ALERT (2) ***
26-1 H. result:  *** ALERT (2) ***
27-1 H. result:  *** ALERT (2) ***
28-1 H. result:  *** ALERT (2) ***
29-1 H. result:  *** ALERT (2) ***
30-1 H. result:  *** ALERT (2) ***
31-1 H. result:  *** ALERT (2) ***
32-1 H. result:  *** ALERT (2) ***
33-1 H. result:  *** ALERT (2) ***
34-1 H. result:  *** ALERT (2) ***
35-1 H. result:  *** ALERT (2) ***
36-1 H. result:  *** ALERT (2) ***
37-1 H. result:  *** ALERT (2) ***
38-1 H. result:  *** ALERT (2) ***
39-1 H. result:  *** ALERT (2) ***
40-1 H. result:  *** ALERT (2) ***
41-1 H. result:  *** ALERT (2) ***
42-1 H. result:  *** ALERT (2) ***
43-1 H. result:  *** ALERT (2) ***
44-1 H. result:  *** ALERT (2) ***
45-1 H. result:  *** ALERT (2) ***
46-1 H. result:  *** ALERT (2) ***
47-1 H. result:  *** ALERT (2) ***
48-1 H. result:  *** ALERT (2) ***
49-1 H. result:  *** ALERT (2) ***
50-1 H. result:  *** ALERT (2) ***
51-1 H. result:  *** ALERT (2) ***
52-1 H. result:  *** ALERT (2) ***
53-1 H. result:  *** ALERT (2) ***
54-1 H. result:  *** ALERT (2) ***
55-1 H. result:  *** ALERT (2) ***
56-1 H. result:  *** ALERT (2) ***
57-1 H. result:  *** ALERT (2) ***
58-1 H. result:  *** ALERT (2) ***
59-1 H. result:  *** ALERT (2) ***
60-1 H. result:  *** ALERT (2) ***
61-1 H. result:  *** ALERT (2) ***
62-1 H. result:  *** ALERT (2) ***
63-1 H. result:  *** ALERT (2) ***
0-1 L. result:  *** ALERT (2) ***
1-1 L. result:  *** ALERT (2) ***
2-1 L. result:  *** ALERT (2) ***
3-1 L. result:  *** ALERT (2) ***
4-1 L. result:  *** ALERT (2) ***
5-1 L. result:  *** ALERT (2) ***
6-1 L. result:  *** ALERT (2) ***
7-1 L. result:  *** ALERT (2) ***
8-1 L. result:  *** ALERT (2) ***
9-1 L. result:  *** ALERT (2) ***
10-1 L. result:  *** ALERT (2) ***
11-1 L. result:  *** ALERT (2) ***
12-1 L. result:  *** ALERT (2) ***
13-1 L. result:  *** ALERT (2) ***
14-1 L. result:  *** ALERT (2) ***
15-1 L. result:  *** ALERT (2) ***
16-1 L. result:  *** ALERT (2) ***
17-1 L. result:  *** ALERT (2) ***
18-1 L. result:  *** ALERT (2) ***
19-1 L. result:  *** ALERT (2) ***
20-1 L. result:  *** ALERT (2) ***
21-1 L. result:  *** ALERT (2) ***
22-1 L. result:  *** ALERT (2) ***
23-1 L. result:  *** ALERT (2) ***
24-1 L. result:  *** ALERT (2) ***
25-1 L. result:  *** ALERT (2) ***
26-1 L. result:  *** ALERT (2) ***
27-1 L. result:  *** ALERT (2) ***
28-1 L. result:  *** ALERT (2) ***
29-1 L. result:  *** ALERT (2) ***
30-1 L. result:  *** ALERT (2) ***
31-1 L. result:  *** ALERT (2) ***
32-1 L. result:  *** ALERT (2) ***
33-1 L. result:  *** ALERT (2) ***
34-1 L. result:  *** ALERT (2) ***
35-1 L. result:  *** ALERT (2) ***
36-1 L. result:  *** ALERT (2) ***
37-1 L. result:  *** ALERT (2) ***
38-1 L. result:  *** ALERT (2) ***
39-1 L. result:  *** ALERT (2) ***
40-1 L. result:  *** ALERT (2) ***
41-1 L. result:  *** ALERT (2) ***
42-1 L. result:  *** ALERT (2) ***
43-1 L. result:  *** ALERT (2) ***
44-1 L. result:  *** ALERT (2) ***
45-1 L. result:  *** ALERT (2) ***
46-1 L. result:  *** ALERT (2) ***
47-1 L. result:  *** ALERT (2) ***
48-1 L. result:  *** ALERT (2) ***
49-1 L. result:  *** ALERT (2) ***
50-1 L. result:  *** ALERT (2) ***
51-1 L. result:  *** ALERT (2) ***
52-1 L. result:  *** ALERT (2) ***
53-1 L. result:  *** ALERT (2) ***
54-1 L. result:  *** ALERT (2) ***
55-1 L. result:  *** ALERT (2) ***
56-1 L. result:  *** ALERT (2) ***
57-1 L. result:  *** ALERT (2) ***
58-1 L. result:  *** ALERT (2) ***
59-1 L. result:  *** ALERT (2) ***
60-1 L. result:  *** ALERT (2) ***
61-1 L. result:  *** ALERT (2) ***
62-1 L. result:  *** ALERT (2) ***
63-1 L. result:  *** ALERT (2) ***


PS: Shield 1 is not connected  :P

For now performance seem to be good, I need to do other tests!  :smiley-mr-green:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 24, 2015, 03:01 pm
For now performance seem to be good
I'll bet you're spending most of your time sending serial output. Want it to go even faster? Only print out the errors, and don't print anything on a good test.  ;)

Not only should that make it go faster, it will make the errors stand out and be easier to see. :smiley-cool:

Of course, you do want to print out the logic like you did at first, to make sure it's doing all of the things you expect. But now that you know it's working, the success messages are redundant. But you may make changes to the logic in the future, so don't delete the print statements, either comment them out, or put them in conditional compilation blocks so they are easy to re-enable if needed in the future.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 24, 2015, 03:04 pm
Yes i know but i like too much that everything work! :smiley-yell:  :smiley-yell:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: ShapeShifter on Mar 24, 2015, 03:55 pm
It is a giddy feeling when a new board is working properly, isn't it?

All in all, I think we as a group did pretty well if there was only a single cut/jump that needed to be done on the first revision.  :smiley-cool:

Attached is a portion of the first revision prototype board for a project I worked on a couple years ago (I didn't do the hardware, just the software.) It needed more than one cut/jump...  :o
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Mar 24, 2015, 04:01 pm
It seem to be a bit more complex than mine!  :smiley-mr-green:

We done a very good job with this board!  :smiley-cool:
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: gabriel_2512 on Dec 10, 2015, 04:03 pm
Just received pcb specifications from manufactory.

Can you check? It should be ok for me.
Hello! I am looking for a PCB supplier has specifications like that! Would you please give me the contact of this PCB supplier? Thank you so much!
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Dec 10, 2015, 04:06 pm
Hello! I am looking for a PCB supplier has specifications like that! Would you please give me the contact of this PCB supplier? Thank you so much!
Hi, search on google for pcbway.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: gabriel_2512 on Dec 10, 2015, 04:10 pm
Hi, search on google for pcbway.
Thank you so much! You send your designs and order pcb via this website?
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: leen15 on Dec 10, 2015, 04:11 pm
Thank you so much! You send your designs and order pcb via this website?
Yes of course.
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: gabriel_2512 on Dec 10, 2015, 04:20 pm
Ok! Thank you so much for your information! Have a nice day! :)
Title: Re: 64 I/O Expander Shield for max 1024 I/O
Post by: Paul_l on May 18, 2018, 10:40 am
Hello,

I know this is an 3 years old topic, but anyone has the PCB files for this shield ? Hello,

 What i mean in files, the editable one, not the photos :)


Thank you