Shop OBEX P1 Docs P2 Docs Learn Events
More pins - brainstorming — Parallax Forums

More pins - brainstorming

Dr_AculaDr_Acula Posts: 5,484
edited 2013-05-03 08:51 in Propeller 1
I always seem to need more pins!

So I'm working on a "super gadget gangster" board with lots of I/O. Tempting to use a pile of HC373 latches for more digital outputs. Define a 16 bit bus and isolate it with HC245 chips. Inputs could be HC244 chips

Bring out lots of pins. Maybe 4x40=160. Headers like these http://futurlec.com/ConnHead.shtml

Arduino stackable headers are tempting, but they do seem more expensive than the dual female headers a little further down. Maybe bring out 20x4 = 40 pins, and have four of these = 160 I/O lines. Stagger them if you want to stack boards.

I seem to have a need for several different things:
1) latchable digital outputs. Always handy for leds, memory chips, displays.
2) Bidirectional data transfer. Good for talking to a bus that might exist on another board that normally is being used by that board.
3) Pins that you can toggle rapidly

#3 is a concept I have been thinking about a lot. You can have a pin that you can toggle rapidly - eg /RD or /WR on a ram chip. But there are never enough. So you need groups of pins that you can select as a block - maybe of 4 or 8 pisn. Select block 1 - toggle pins rapidly on a ram chip. Select block 2 and toggle pins rapidly on an SD card.

I've got a bit stuck though with the idea of pins being either inputs or outputs.

The propeller is very flexible in that pins can be defined as inputs or outputs, and can be L, H or HiZ. That really is 4 states for each pin. How can you expand that to talk to more I/O while still maintaining the flexibility of all of those 4 states?

I've been thinking about the idea of the Open Collector. There were lots of 74xx pins with open collectors, and they are great in that you can have a single pullup resistor, and lots of things can be inputs or outputs. It is one way of expanding propeller pins while keeping the flexibility of those 4 states above.

For 3V, 74HC is better, so 74HC07 type chips could be useful. 74hc125 is interesting too, particularly if you join the data and control lines together, then the outputs are either Low or HiZ but High is not allowed. Emulates an open collector circuit.

Still a bit messy though when changing from inputs to outputs.

I wonder if the good old fashioned 4016 could be useful? Could it switch, say, an SD card?

"On" resistance might be a problem. There were problems recently with 2000 ohm series resistors on a touchscreen stopping an SD card working. 4066 might be better. Hmm - a 74HC4066 might be even better again - only about 100 ohms.

I wonder if you could use a bunch of 74HC4066 chips to do things like use some propeller pins to talk to an SD card, then later, use the same pins to talk to a keyboard? That ought to work. It might be not quite as good using those same pins to then talk to a TV display but probably would be good enough.

Thoughts would be most appreciated!
«1

Comments

  • pedwardpedward Posts: 1,642
    edited 2012-03-02 21:41
    As an aside, the Prop 2 will allow you to assign the logical ports A,B,C,D to specific physical pins. This means you can do your layout however is convenient and define the pin orders in software. It also has the potential to REALLY obfuscate your design from reverse engineering.
  • LeonLeon Posts: 7,620
    edited 2012-03-02 23:03
    Use a single CPLD instead of lots of chips. I like the Altera MAX II devices, they are actually small FPGAs but Altera plays that down.
  • average joeaverage joe Posts: 795
    edited 2012-03-02 23:18
    Once again you amaze me. I'd never though of using open collectors with the prop. Now that you bring it up, I want to go check my parts stash for some of these. I have some 4066's laying around. I should play with these. IMO, it would be nice to have a parallel bus, 8 or 16 bit, with a few isolated child nodes. http://www.midibox.org/dokuwiki/doku.php?id=mbhp I really like the modular design of this system and have thought about porting over portions of this system to the propeller. More work than I have time for right now though.
    Really, I think at least 2 parallel busses, along with say 8 spi devices would be nice for me.
  • pedwardpedward Posts: 1,642
    edited 2012-03-03 00:24
    Don't forget about the 8255, those were some very useful chips in their day. I've got at least a tube of those and pondered using them with the Prop.
  • average joeaverage joe Posts: 795
    edited 2012-03-03 01:19
    OOO, I need to score a couple of 8255's. They look really handy. One thing I've been pondering is reclaiming the EEPROM and programming ports. I'm thinking it might be nice to switch these separately for debugging purposes.
  • RickInTexasRickInTexas Posts: 124
    edited 2012-03-03 01:43
    pedward wrote: »
    Don't forget about the 8255, those were some very useful chips in their day. I've got at least a tube of those and pondered using them with the Prop.
    ++ On the 8255. I used these back in 1982(!) with an 8085 board that you had to type in op-codes on a hex display/keypad. Assembler? Ha! At least it beat flipping toggle switches like the Altair 8xxx. I have one or two lying around, so I was surprised to see an object on OBEX http://obex.parallax.com/objects/75/. I was even more surprised to see that Jameco stocks them for about 5 USD each. (82C55A_JAMECO_52417.pdf). They are 5 volt parts, but accept 2.0 volts as a logic high, so interface with the prop should work fine.

    For simple buffering, 3/5 volt level-shifting I've used the 74HC244/245. No Latching, but you can select I/O direction and Hi-Z also. Oh, and if you end up looking at the HC373 latches, save yourself some headaches and go with the HC573s. Much saner layout, I/O pins grouped in a row on each side.
  • Heater.Heater. Posts: 21,230
    edited 2012-03-03 02:23
    You can still buy parallel IO cards for industrial PC's that use 8255s. We have been using them in one of our products.
    They are a disaster. Given some electrical noise in an industrial environment they will flip their outputs to inputs and every thing stops working.
    That's even when we have opto isolators on all inputs and outputs.
    After endless rearrangements of grounding and shielding etc we gave up on them.
  • jmgjmg Posts: 15,173
    edited 2012-03-03 02:39
    Heater. wrote: »
    You can still buy parallel IO cards for industrial PC's that use 8255s. We have been using them in one of our products.
    They are a disaster. Given some electrical noise in an industrial environment they will flip their outputs to inputs and every thing stops working.
    That's even when we have opto isolators on all inputs and outputs.
    After endless rearrangements of grounding and shielding etc we gave up on them.

    Were you only doing an INIT once ?
    I've seen that effect (but not in 8255) in doing noise-tolerance-kill tests (a suppressor removed AC Brush PowerDrill is good..), and one 'cure' we used, was to refresh the INIT/CONFIG registers, in an interrupt.
    99.9% of the time, this simple replaced the same value, but if it DID change for some reason, it reduced the effect from permanent.
  • idbruceidbruce Posts: 6,197
    edited 2012-03-03 03:32
    I always wondered about the MAX7300 chips. Are these any good?
  • Heater.Heater. Posts: 21,230
    edited 2012-03-03 03:54
    jmg,

    I think we got around it by unloading and loading the Linux PIO driver module when things went wonky. It did not happen very often so that was workable. Luckily the thing we were communicating with implemented a serial connection and the problem went away:)

    Amazing thing was that we could make this glitch on the bench just by turning a lab PSU on and off nearby. That's even with the PC with 8255s being run from a battery powered UPS, opto isolators on the I/O, no electrical connection to that PC in any way. Even the short connections from 8255 to opto's being via shielded cables.
  • User NameUser Name Posts: 1,451
    edited 2012-03-03 10:15
    idbruce wrote: »
    I always wondered about the MAX7300 chips. Are these any good?
    Great idea so long as toggle speed isn't important. A 400 kHz i2c bus is a pretty severe restriction in the flow of parallel signals.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-03-03 13:28
    Here is a possibility... A later variant of the Motorola MC6820/MC6821. Maybe you can find them cheaper elsewhere???
  • pedwardpedward Posts: 1,642
    edited 2012-03-03 13:33
    Another option is a second propeller running RCFAST with pins 30/31 connected to the first to upload a comms object. Do high speed serial between the 2, then create a SPIN object named PORTB. Then it would be portb.inb, portb.outb, portb.dirb, etc.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-03-03 13:54
    heyhey.. Back to my twin/tri prop idea ;)
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2012-03-03 14:20
    What i remember from the 8055 is that if you change the direction of one of the ports then there could be all sorts of resets of others, tricky when one of the ports was split in half.

    I have long wished for the illusive Prop 1.5, but those gits at the lottery have, again, witheld my funding.
  • idbruceidbruce Posts: 6,197
    edited 2012-03-03 14:23
    Great idea so long as toggle speed isn't important. A 400 kHz i2c bus is a pretty severe restriction in the flow of parallel signals.

    Okay, so how about the MAX7301?
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-03-03 17:26
    i2c is slow, and only a few led drivers have a (very limited) pwm.
    Simple make your own "spi type" running in one cog that constanly updates at 1mhz.
    Turn seven prop pins in to 32 inputs and 48 outputs.

    pin1: clock shared with all the chips that are daisy chained pairs.
    pin2: latch to all the ser-par and used as reset for the par-ser
    pin3: serial in from par-to-serial converter 1-2
    pin4: serial in from par-to-serial converter 3-4
    pin4: serial out to ser-to-par converter 1-2
    pin5: serial out to ser-to-par converter 3-4
    pin7: serial out to ser-to-par converter 5-6 (100ma open drain version)

    A 8bit latch version probably could be done with 12pins (64out and 64 inputs)
  • RickInTexasRickInTexas Posts: 124
    edited 2012-03-03 18:15
    Doh is me! While waxing nostalgic about the 70s and Intel 8xxx stuff, I'd forgotten about two other obvious chips. Both are available in narrow DIP packages cheaply, and both will run fast, around 20 MHZ SPI or SPI-like.

    1) 74HC595 8-bit Shift Registers. Great tutorial here: http://www.ermicro.com/blog/?p=1050
    2) Microchip MCP23S17 16-Bit SPI I/O Expander. Tutorial: http://www.ermicro.com/blog/?p=1846

    The 74HC595 is simpler, can be daisy-chained, but is Parallel Out only. Does latch and Hi-Z.

    The MCP23S17 is pretty cool, very flexible in In/Out for each pin, interrupts on input change, etc.

    The datasheet for the MCP23S17 makes me cross-eyed, but the above above link gave me the "aha" moment that made it possible for me to use this with the 16-bit Microchip processors.

    I know there are some SPI -related drivers on OBEX but I've no experience with any of them. I'd be interested anyone's experience using SPI on the Propeller with any of these general I/O devices.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-03-03 21:07
    Some great ideas here - thanks!

    I agree that the 573 is much better than the 373.

    Re bidirectional switching, I have been looking at the 74HC4316. It is similar to the 4066 but it has an enable pin which enables all four connections when it is low. This means you can tie the four control leads high (always on) and switch the entire chip with a single active-low signal.

    So this gives you the ability to move pins up and down at Propeller speeds and have the flexibility to use those pins to drive an SD card and then switch to a keyboard or a display.

    Re switching between groups, I think the criteria there is not speed but rather, saving propeller pins. I am looking at the range of microcip I2C expanders eg MCP23008 http://hackaday.com/2011/06/07/working-with-i2c-port-expanders/ (there is also a 16 pin version).

    One super simplistic idea is to take on MCP23008 and a pile of 74HC4316 chips and have two groups of 28 pins (32 minus two for I2C and two for download) and you can select group 1 or select group2.
  • jmgjmg Posts: 15,173
    edited 2012-03-03 21:18
    idbruce wrote: »
    Okay, so how about the MAX7301?

    I'd call that expensive. A CPLD and most vanilla micros are cheaper.
    You can still buy 82C55, but at 'go away' price points.

    So you best bet is to choose something mainstream, and cheap per IO.

    A CPLD could create an interesting expansion, like a QuadSPI version of a 82C55 ( IO Latch and Data Direction Registers)
    in 44/48/ 64/100 pin packages. 24 io will fit into 44 pins, with a couple of address pins, so you can save /SS fanout trees.

    but cheapest is a small Micro, and putting 'Microcontroller' into Digikeys search, gives 30,000(!) + hits.
    you then filter for stock, IO count, and price, and avoid the fringe ones....

    Cheapest at $1.28 1+ is a RS08 part with 31 io, then you have a PIC16F59 at $1,56, and a highest stock goes to a AT89S51 at $1,87.
    RS08 I think has 4 pins as LCD only, so the IO drops there, but the PIC and AT89 are pretty vanilla - just too dumb.

    Showing up for the first time, in stock, I see is the Nuvoton Mini51 $2.05 1+, and $1.02 100+ for 29 io pins.
    http://search.digikey.com/us/en/products/MINI51ZAN/MINI51ZAN-ND/2786714
    This has Wide Vcc 2.5 V ~ 5.5 V, and 24MHz On Chip Osc, and plenty of peripheral options (SPI, UART) and speeds.
    Just 4K of code, but for IO expander, that's plenty.. Choice of QFN or TQFP48

    (Interesting to note some smaller LPC11xx series are tagged as 'Non Stock' at Digikey, and they are narrow Vcc anyway, and their volume price is well above the Mini51 )
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-03-03 21:43
    @jmg - it seems that there are many digital output solutions. Some would work for things like TV and VGA, and some would work for audio output too, possibly with some code modifications.

    One challenge could be to consider a propeller chip that had less pins - eg say it had 4 pins and you wanted to use those 4 pins for an SD card, then swap some code and use them for TV output, and then swap some code and use them for a keyboard input.

    Another concept is to consider that if everything you talk to can be made HiZ, then you don't need to isolate it.

    Consider an SD card sharing pins with a SPI D to A. If the /CS lines are driven by an I2C expander, then both those SPI devices can share pins because they can both be deselected. Hmm - for safety you might use a demultiplexer like a 138 so that no two devices can be on at the same time.

    I'm trying to think of solutions that don't require modifying existing objects - solutions that pass through data at the same speed the propeller runs.

    How about a board that gives you the 28 prop pins, 8 (or 16) "control" pins from an I2C expander, and a pile of digital outputs from 573 latches? The rule for anything that connects is that it must be able to be put into HiZ. So, for instance, if you wanted to add a keyboard, you might use one pin from the I/O expander to switch on a 74HC4316. That means the keyboard can be totally isolated if you then want to use those pins for something else.
  • cavelambcavelamb Posts: 720
    edited 2012-03-03 21:49
    Are you familiar with the 74LS259?
    It's an 8 bit addressable output latch.
    16 pin package with 8 output pins, 3 address pins and a data pin (write a 1 or 0 to any bit)
    Also an /enable for a chip select if desired (expansion)

    It's one of my old time favorites.
    VERY LOW software overhead when banging individual output bits.

    Conversely, a one of eight multiplexer (74LS151) can make an expanded 8 bit input port.
    The same three address lines above...

    Decode a couple more pins for addresses (74LS139 a is good one - dual 2 to 4)
    for chip selects and you suddenly get lots of IO for the pins invested.


    8255s are fun, but have overhead.
    And have to have all 8 data pins, 2 address pins, /Rd, /Wr, and /CS
    13 pins gets you 24.

    Zylog ZIO chips gave bit level control, but were also byte-wide devices.
    13 pins get you 16.

    But to be fair, these guys can be paralleled, with a couple more bits decoded for chip selects.




    http://gauss.sdsmt.edu/shop/datasheets/ttl/259.pdf
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-03-03 22:47
    Are you familiar with the 74LS259?
    It's an 8 bit addressable output latch.
    16 pin package with 8 output pins, 3 address pins and a data pin (write a 1 or 0 to any bit)
    Also an /enable for a chip select if desired (expansion)

    No I didn't know about that one. Very useful looking chip. I can see several places where that could decrease the chip count. Thanks!
  • jmgjmg Posts: 15,173
    edited 2012-03-04 02:03
    Dr_Acula wrote: »
    How about a board that gives you the 28 prop pins, 8 (or 16) "control" pins from an I2C expander, and a pile of digital outputs from 573 latches? The rule for anything that connects is that it must be able to be put into HiZ..

    The problem with HC573, is they have no readback - you can get devices like SN74LVCZ161284AGR that give 19io with readback, and even a open collector mode, but they lack latches.
    - and even in volumes they are no cheaper than the vanilla uC above.

    Another approach is to use a device like TLE7232GS, which is a SPI driver with 1 Ohm 240mA pins, and it does have read-back.

    If you want standard PROP libraries, the Mini51 above has high baud rate options, and SPI is good to > 4MBd in slave, and with a variable length to 32 bits per transfer.
    UART also seems fast, with UART_CLK / (A+2), {A must >=3}, so I think that makes it
    4.423680
    3.686400
    3.159771
    2.764800 etc
    & 2.211840MBd would map to the 80MHz Prop with a 0.46% error.


    It could be coded rather like a CPLD, with a very small and stable driver (even in ASM?), that allowed the SPI port, to access IO and Timer and ADC and UART and PWM etc registers.
  • average joeaverage joe Posts: 795
    edited 2012-03-04 11:46
    My need for more pins has me exploring the PIC 18F452 and 18F2620. I happen to have a few of these laying around. These have a 8 bit parallel slave port that looks interesting.
  • prof_brainoprof_braino Posts: 4,313
    edited 2012-03-05 05:13
    As long as you are brainstorming, here is a possiblility.

    I don't know what your costs are for additional parts, boards, layout etc; but if it costs more than $8 for 22 pins and 6 cores, you might consider adding additional prop chips. The PropForth MCS module (Muli-Channel Sybchronous serial) allows one to add more bare prop chips directly to the configuration, using only two capacitors, four resistors, and a couple wires. Once the channel is set up, it appears that the new cogs and pins are local to the main propchip. Since the communication channel runs at clock speed, the remote resources are not noticably slower than the local resources.

    This might be reasonable in some cases, since one only has to buy the same trhee parts in quantity, instead of lots of different parts in smaller volumes.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-03-05 05:18
    I spent a day designing some very complex circuits but I think I have this down to just one chip - a 74HC137 three to eight decoder and latch.

    Ok, P0-P27 are generic pins that can control anything. 8 groups of these = 224 pins.

    A "group" could be a physical board, like a Gadget Gangster board. These can all be stacked and each board selected as needed. Each board has 28 I/O pins.

    The rule for any board is simple - there is a "board select" line that is low to select that board. If it is high, then all pins must be HiZ.

    So - for SD cards that is easy - connect /CS to the /board_select line and connect the other 3 pins directly to the prop pins.
    Digital outputs = just connect them up (eg 573 latches)
    Digital inputs = use a 74HC244 and the HiZ control goes to /board_select
    Bidirectional bus when you can control the direction = use a 74HC245
    Bidirectional bus when you don't know the direction = use a 74HC4316 (eg for keyboard/mouse)
    For TV and VGA that will load the prop pins with (effectively) low value pulldown resistors = use a 74HC244
    For audio you might use a 74HC4316 to prevent data noise


    To select a board, P0-P3 are temporarily used to select which board. After this is done, P0-P3 can be used as inputs or outputs by that board.

    See the schematic below.
    The programming sequence is designed to isolate P0-P3 before using them to select which board.

    A 3-8 decoder is preferable to 8 latches because only one group must ever be selected at any one time.
    The outputs need to be latched and a 137 provides the same function as a 573 followed by a 138.

    The eeprom data line is used to select this chip. At startup this line will be toggling rapidly and this could give random outputs on different boards so the 137 is disabled with a RC network that takes about 2 seconds to charge the capacitor and then select the chip.

    There are weak pullups on P0-P3 to start the chip in deselected mode. These may not be necessary as the two enable inputs would override these 4 pins.

    In software you would need to have 16 longs - 8 to control the DIR data for each group, and 8 to control the OUTA status of each group when changing to different groups.

    One could envision a stack of boards each assigned a different group. C3. Dracblade. ILI9325. Cluso's board. Prop demo board. Software select and switch between them. It could be very handy for developing software for multiple platforms.

    You could either pass the 8 outputs of the 137 to each board. Or you could have a local 137 on each board as they will all respond the same way to P0-P4 and P29

    I hope there are no bugs I haven't thought of. 244 I/O pins would be cool!
    837 x 549 - 58K
  • idbruceidbruce Posts: 6,197
    edited 2012-03-05 05:25
    @prof_braino
    Once the channel is set up, it appears that the new cogs and pins are local to the main propchip. Since the communication channel runs at clock speed, the remote resources are not noticably slower than the local resources.

    This sounds interesting, but I do not completely understand what you are saying. Let's assume a situation of two Prop chips. Does this mean that COGNEW has access to 16 cogs, and what would be the total IO count available?

    Bruce
  • idbruceidbruce Posts: 6,197
    edited 2012-03-05 05:50
    Hey Doc

    GM to ya.

    I don't completely understand your post either.

    I see you are using P0-P3. Would these same pins be used on all boards, Such as (4) Prop pins = 224 GPIO?

    Bruce
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-03-05 14:30
    Hi idbruce,

    P0-P3 are used on all boards, along with P4-P27. The gadget gangster format simply passes all 32 pins through to each board. The aim was to use P0-P3 (or more if needed) to select which board, but still make these pins available for general purpose I/O when a board is selected.

    While a board is deselected it will obviously not be connected to the propeller. There may be an argument for having some pins always selected. An example is serial inputs, keyboard and TV. But not serial outputs for instance, those can be selected on the fly when required.

    To make a certain pin always selected, I guess you simply connect that pin to a TV or whatever but then that pin is not available to any of the other boards.

    I am trying to think of something that is as flexible as possible, rather than rigidly saying "this pin must connect to an SD card, and these pins always do TV etc"

    Oh, and by the way idbruce, I have some good news for you - re this thread http://forums.parallax.com/showthread.php?137266-Propeller-GUI-touchscreen-and-full-color-display/page2 and your post #21
    Caress that wonderful looking creature
    see this article http://www.ctv.ca/CTVNews/Entertainment/20120305/elle-macpherson-jeff-soffer-reported-split-120305/
Sign In or Register to comment.