Connect with us

Circuit to count how many modules are daisy chained

Discussion in 'Microcontrollers, Programming and IoT' started by lax, Sep 12, 2021.

Scroll to continue with content
  1. lax

    lax

    1
    0
    Sep 12, 2021
    Current Design
    This is going to be fun to describe a circuit in English 

    Currently I have a working prototype comprised of 2 parts:

    1. A main board (MB) connected to a RPi4 using 6 Output GPIOs and GND and a 3.3V Vcc
    2. Attachable modules (0 to 4) boards that can daisy chain to each other or the main board using a BUS that uses only 8 pins:
      • 2 x Board Select Bits (for a max of 4 Boards) that connects to an IC per module
      • 3 x Data Bits for each module
      • 2 x GND
      • 1 x Power (3.3 Vcc)

    Each module can attach to the previous board (or the main board) using an 8-port connector.

    Physically, we can have 0 to 4 modules. They are designed to be attached and detached at will (like Lego blocks) but hopefully not detached too often as I will have to deal with mechanical wear and tear.

    This works quite well and uses very little number of GPIOs and cabling is simple. This is NOT a high speed circuit but rather human information slow speed info.

    The problem
    I now realize that I will need a detector/validator of how many modules are attached or functioning. No matter how idiot proof I will make the software that drives this, nature will find a way and create better idiots. I can’t rely on human interaction to tell me how many modules are attached - or a module might fail. I am blissfully ignoring that I might be the incompetent idiot.

    Logically I will need extra electronics, extra lanes on the BUS and extra INPUT GPIOs to handle this.

    My goal is to find the simplest way without having to recreate the whole project from scratch.

    Solutions I have thought of
    1) Add 4 extra lanes and use 4 extra GPIOs as INPUT
    This forces each board to have a unique ID and makes just daisy chaining identical each board infeasible. Also uses 4 more GPIOs and makes cabling much more complicated.

    2) Use Full Add Circuit on each Module
    Each module will have a binary adder – like the 74LS83 - and add 1 to the sum of modules before it. I’ll have to make sure the last module has 0s as input from before and add 1. The main board will need 3 bits (and 3 GPIOs in input mode) to read the number - since I can have 0..4 boards.

    Still adds a bunch of lanes and adds full adder circuits which will need to be a 4 bit adder. Not sure how to handle the LAST module to make sure previous input is at 0.

    This is a great solution for future expansion as it can go all the way to 8 modules with no changes and 16 modules by adding another lane/GPIO.

    Makes the simple layout I had much more complicated.

    Magical Solution I Can’t Find But Hoping For
    Since I’m already using 2 bits output for board select attached to GPIOs, I thought I can maybe just add 1 more bit and make the board select bits bi-directional. So I can set to INPUT and count the number of modules (0..7) and set to output based on the info and access a validated module.

    My electronics knowledge is rusty and can’t design such a circuit that is safe and can be used both for INPUT and OUTPUT, having each direction access a different IC

    Sooooo

    Asking for help/guidance on how to proceed.
     
    Last edited: Sep 12, 2021
  2. Bluejets

    Bluejets

    5,001
    1,050
    Oct 5, 2014
    Show a schematic and name all the modules, power supplies etc.
     
    davenn likes this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-