Fourletter pHAT & I2C bandwidth & keyscan support (oh my)


#1

Apologies if this is already addressed; I couldn’t find it. Also apologies for re-hashing stuff you already know - it’s all new to me.

Hey roni pirates and fellow buccaneers…

As I said, new to RPi & your products, not new to RISC µC development nor *nix. I’ve bought a few already, and wired them in stacktastic ways b/c of the way the header stacking goes, like mounting a fourletter or microdot up “top” but mounting a explorer with reversed headers and the Pi0 sandwich’d with long male pins out both sides and a lipo tack-soldered halfway down the pins. Strange but functional. As long as 1=1 , 40=40, hey so far so good.

So anyway, couple questions for you re: fourletter;

On the fourletter using the Holtek chip, displaying seems slow at times. Great for echo’ing a scroll or outputting a value every half second… ludicrously slow for PoV. - not that I’m looking for 18kHz refresh; but 100Hz would be nice.

Pi Forum People (yea those people!) seem to think in many cases it’s i2c not python overhead. I don’t know if this is true, but what the hell. So, on these v1.1 Pi0Ws (or every Pi?), it seems i2c defaults to 100kHz; the Holtek datasheet shows it is capable of 400kHz. extra bandwidth can’t hurt, anyway. The wire run is certainly short enough; a couple millimeters of pcb traces.

Since you have that glaringly loud header about test it with Raspbian when things don’t work right… what (in Raspbian) is the proper way to set the clock rate? Apparently the previous versions just used modprobe parameters, but with the device tree setup of the latest releases, modinfo only shows “debug” as a parameter for i2c_bcm2835.

I discovered the device-tree-compiler package, fdtdump/get/put, and see you can set “clock-frequency” for i2c0/1/2, but that seems a bit hard-coded and forced. I also notice in the __overrides__ section there’s a 22 byte hex string labeled i2c#_baudrate, which leads me to guess maybe there’s an on-the-fly way… thoughts?

Secondly, the Holtek HT16K33 keypad matrix pins; I love your black conformal coating, sells the Yarr! quite well, but makes visually tracing copper a bit difficult w/o magnification for these old eyes. If I want to use them will I have to solder directly to SOP* legs & conscript some existing driver to fit? (*obviously soldering to the LED pins, which I’ve already soldered, is easier and safer… but sans schematic I’ll have to trace it all out first. hint. hint.)

Thanks in advance and have a great day!

  • = -

PS: Not to annoy gadgetoid, but as a new RPi guy who is primarily a remote console user, pinout.xyz drives me nuts and I wish there was an ascii/ansi/curses console-friendly version we could pull from lynx/curl/wget… for now I’m using printouts, actual paper. :oldskool:


#2

I need some time to digest the rest of your post (it’s Mon… wait it’s not Monday!? Oh good grief where did the week go!?) but I just wanted to pick out this point :D It’s actually a rather intriguing idea and I’m tempted to give it a go. All of the data behind Pinout is trivial to transform, so I should be able to build up the framework for a Python/Curses Pinout applet and then it can just be auto-generated from there.


#3

oh! tl;dr? ok!

  1. how do you set i2C clock (to 400kHz) the official way in Raspbian?
  2. how can I utilize the HT16K33’s key scanning for button or matrix input?

#4
  1. From what I understand, you should do it with device-tree: dtparam=i2c1_baudrate=400000 - it seems to work for me, but I have’t confirmed it with a scope.
  2. Let me dig up the schematic :D