SamuKata
Pybricks
Pybricks

patreon


Week 3&4: Ports

The past few weeks were all about the 6-wire port interface. Aside from the plug, EV3 cables are very similar to Powered Up cables:

My goal is to generalize the Pybricks port interface drivers that we have already written for SPIKE in such a way that they can run on EV3 too. This avoids code duplication and makes it easier to maintain in the long run. You can see parts of this effort here. (I normally create small commits, but sometimes you just have to do a giant overhaul like this!)

This major revision also got us a few steps closer to a popular request we frequently get from advanced users: direct access to the data pins on the ports. Now that we can switch modes between different LEGO protocols, there will also be an option to turn off the LEGO protocol entirely. This gives you the power and freedom to interface with custom devices.

Fortunately, LEGO published the EV3 schematics a long time ago, so we don't have to reverse-engineer how it works!

Not everything works the same between both platforms, though. The EV3 also has additional analog inputs on the motor and data pins. We'll need to enable those to detect and use analog devices like the EV3 touch sensor and NXT sensors. The same goes for I2C as used by some NXT sensors.

The EV3 supports UART on all four sensor ports, but only ports 1 and 2 have real UART peripherals. Ports 3 and 4 use an emulated UART on a dedicated PRU co-processor. These are challenging to set up, but I'm excited to share that we have signs of life coming out of those ports too.

As always, a huge thanks for your support! If you'd like to see more of such updates, please let me know. Special requests are welcome too. I'm happy to zoom in on the development of your favorite topics.

Week 3&4: Ports Week 3&4: Ports Week 3&4: Ports

Comments

A solution for hub to hub communication conforming to the rules might be https://www.youtube.com/watch?v=DBp3nf8R7-s but this has very limited application.

Gregor Gramlich

That sounds great. There is an interesting question coming up for the current and following WRO competitions. The German FAQ states that you are allowed to use multiple controllers, but you may not use Bluetooth for communication. Is there a way to allow for cable bound communication / daisy chaining on the Spike Prime (or even interacting between Spike and EV3)?

Gregor Gramlich

☝🏻Brilliant - go ahead!

chris


More Creators