Gadgeteer Buses

I was just thinking about SPI and I2C type sockets on Gadgeteer and was wondering why these types of modules don’t have an additional socket on them similar to DaisyLink modules (which is I2C…). For example, if you want to have multiple modules (say multiple OLED display modules) on the same SPI bus how how would you do it physically? Let’s ignore any driver or memory constraints for now… By plugging the module directly into the S socket, you are essentially creating a one slave bus. I suppose you could plug an Extender into the S socket and then two S modules into the Extender and then another Extender between others…but that’s ugly. I suppose an eBlock-type module could be developed. It seems to me that the Gadgeteer standard needs to be changed to allow bus type modules to be plugged into each other. Am I overlooking something? Thoughts?

When the pins are just being used as GPIO it makes sense as it stands today; when it’s possibly the start of a Bus, then you’re right it needs to be an open bus that can have many modules connected.

SPI, I2C, and one-wire will be different too - the SPI devices need their own CS lines as well as the shared bus, I2C just shares SDA/SCL, and OW just need a pin. That will add complexity to how the downstream pins are used.

Yep Extender is one option; perhaps the better option is that these bus-type devices should all be designed around the extender with all pins shadowed - for maximum flexibility you’d want jumper selectable CSes on SPI too.

I2C & OW modules could easily be setup just like a DaisyLink module using a pass-thru socket. SPI throws a bit of a kink but using traditional configuration you could use the three additional GPIO pins as CSs and support a chain of up to 4 modules or in a daisy-chain SPI configuration it could work for almost unlimited modules. Sure using an Extender to accomplish this would work but it’s a fairly crude way to do it IMO.

My point being that I think we can make an argument for additional labeling of sockets in the Gadgeteer module specs. In addition to “*” (DaisyLink) sockets on a module there could also be “S”, “I”, & “XY” (for OW - although that labeling would be confusing). Perhaps this wasn’t defined because of difficulties with the GUI designer. I think that could be worked out.

In MSR we prototyped a display multiplexer module that would allow one SPI socket to address 3 displays. It was pretty cool but we only made a couple of them.

The ModuleDefinition.xml schema allows for modules that expose additional sockets for exactly this purpose. Gadgeteer.Socket.GetSocket (the static instantiator for sockets) includes a parameter to choose from one of several sockets on a module. It’s a start :slight_smile:

Cool! Exactly what I had in mind. Did you make a video?

I’ll study the ModuleDefinition.xml file. The Module Builders Guide makes it sound as though the only “legal” sockets on a module are those going to the mainboard and one for DaisyLink. You may consider elaborating a little more in the guide.

A good start indeed!