Saturday, July 28, 2018

I bought a bunch of logic level converters for 3.3v to 5v as part of a first robotics team project:

So with a serial connection you have to connect the Tx from the sending device to the Rx of the receiving device.  This level converter is labled with a bunch of Rx and Tx, however there is only one correct way to wire this device.   I got very confused...   So for me next time I use one of these or possibly for you if you are also trying to figure out how to connect this up, I present you with the following:

You have to do the Rx-Tx switch on the low voltage side.  Basicially hooking this module up any other way will not work.

The neutrals are drawn as separate, but they should actually be common. They are also drawn with a ground symbol, cause that's how the board is labeled; but they are not ground wires, they are actually neutrals, but nobody cares. :-)

Good luck!

These are so cheap, here is a pack of 10 for $5.

Thursday, January 11, 2018

Arduino on Gentoo

Oh goodness, another very poorly maintained article on how to do something using Gentoo...   I wish I had infinite time to improve the Gentoo Wiki..

I'm trying to write the blinkin light program for this Arduino that I have here and software issues on the PC are causing me headaches....

Gentoo Wiki -Arduino

I think I can improve this one, I'll give it a shot.

UPDATE: I didn't improve that wiki article, and I think it's unlikely that I'll go back and work on it.  But that just means you can! ...   If you want to. :-)

Friday, July 07, 2017

Gentoo on RaspberryPi

There are several guides on how to setup Gentoo on a Raspberry PI.  For whatever reason they all seem to have mistakes or things in them that frustrate me.

[Edit:  This is a story of failure.  I've struck out the useless & frustrating bits.  The only interesting or possibly useful bit is at the bottom.]

So here is my guide, for me, which you will probably find mistakes in and find frustrating. Sorry.

So if you really want the best speed from you Pi SD card the partitions need to be done in just the right way - or so I'm told:
However it's worth noting that the SDCard reader on the Pi does have a theoretical limit on how fast it can move data.  I think its somewhere close to 25Mbps (MBps?).  So maybe don't expect that your extreme/pro/super card will run at top speed no matter what we do to it:

fdisk -c=dos /dev/mmcblk0
x (expert mode)
h (set to 255)
s (set to 63)
p (check out the total bytes on the card)
c (set cylinders = integer part of { [total bytes] / 255 / 63 / 512 })
   (Probably the same as the default because we started with "-c=dos")

r (go back to regular mode)

(I make my partitions like this:
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Geometry: 255 heads, 63 sectors/track, 1883 cylinders
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9649c08a

Device         Boot    Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *          63   262207   262145  128M  c W95 FAT32 (LBA)
/dev/mmcblk0p2        262208 28155902 27893695 13.3G 83 Linux
/dev/mmcblk0p3      28155903 30253055  2097153    1G 82 Linux swap / Solaris

I put the swap at the end, cause I figure it will get trashed and die from heavy use.  Maybe I wil be able to shrink partition 2 and just move the swap in as write fatigue destroys it. YMMV)

mkfs.vfat -F 32 -n BOOT /dev/mmcblk0p1
mkfs.f2fs -L ROOT/dev/mmcblk0p2
mkswap -L SWAP /dev/mmcblk0p

(Might need to choose something other than f2fs to start with, I think the modern raspberry pi kernels support ext4)

Then mount them up at /mnt/gentoo and /mnt/gentoo/boot

And start copying files, I followed these instructions:
And that didn't work: kernel panic couldn't mount the partitions...  I think the problem was with the /boot/cmdline.txt file.  But seeing as I already took issue with that guy's sdcard formating and choice of filesystem, I decided to look elsewhere.

I tried to follow these instructions:

mount /dev/mmcblk0p1 /boot
emerge --oneshot sys-boot/raspberrypi-firmware

* Please configure your ram setup by editing /boot/config.txt

vim /boot/cmdline.txt
"root=/dev/mmcblk0p2 rootdelay=2"

mount /dev/mmcblk0p2 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/mmcblk0p1 /mnt/gentoo/boot
tar xpjf /home/anon/Downloads/Gentoo\ RPi\ Images/stage3-armv6j_hardfp-20161205.tar.bz2 -C /mnt/gentoo


This isn't working....  All the guides I've been able to find are terrible. Many broken links, small incomplete sections, nothing covered thoroughly, while trying to cover a huge variety of software and scenarios:
*Using portage to get firmware.
*At least four different sections concerning installing the kernel
*Modifying ebuild files
*Stage 3 downloads
*Stage 4 downloads
*Cross compiling with cossdev
**Creating an overlay
*Compiling using chroot
**Using QEMU virtualization
* Binhost servers (

Really! >:-(

That's too much stuff to just touch on and assume that the reader will figure it out.  I wasted days trying to work though all that, and I've at least experienced many of those concepts/software before.  If you were trying to scare someone off of using Gentoo on a raspberry pi; congratulations: you did a great job!  (Jerk.)
Then near the bottom I find this:

Is a working link to a Raspberry Pi 3 image that can be installed by Noobs, and has clear instructions.
I ordered a couple of raspberry pi 3's and I'll wait for them to arrive.

(What a waste...)

In the mean time I started working on my own Gentoo on Raspberry Pi wiki how-to.  I don't know if I'm going to be successful; but if I can figure out how to get Gentoo onto a Pi - then I can definitely write a better wiki page about it.

Sunday, July 02, 2017

Trying not to "fix" my phone.

So I went into settings on my Nexus 6 and tapped repeatedly on the Build Number; and apparently now I'm an Android developer!!! I ordered this phone within hours of it being available and I've been absolutely overjoyed with how well it's worked for me. I think however it's time for me to start playing with it. Maybe I'll try out the Lineage OS. First thing's first; I need to do some backing up and updating; then more backing up and testing.... Fun times, fun times!

Update 7/2/2017
Ok so I found some pages that gave information on how to backup parts of the phone, pictures, contacts etc... To my pleasure I'd already activated all the "built-in" Google backup options. So even if I screw this up tremendously it's likely that I can eventually get my phone back to a functional state. However what I'm really after is a complete image of the phone so that after messing around with it if I'm unhappy with the state of things I can just roll back to the way everything was before I started. I haven't been able to find a way to do this yet.
Things I have figured out, there are several software packages which are very interesting:
appears to offer the adb program which allows sending commands to the android OS, among other things.

The Open Handset Alliance's SDK

The Open Handset Alliance's NDK, for writing native code instead of transportable Java code.

The Open Handset Alliance's IDE for Android developers.

(Ha! The only one to have util in the name, and it's in the
 dev-java group instead of dev-util - It probably makes more sense than it seems, still funny :-) - I don't know what this is for yet. Says it's a library providing API's

What isn't clear at all is whether Android Studio comes with the Android-Tools, and the SDK, or whether all three need to be installed.  More questions...

Then this fell into my lap: According to an XDA Developers forum post: "All user data, content and media on the internal partition are erased when you unlock the bootloader."

So I need to get a backup I'm happy with before doing that, good tip! 

I installed Android Studio and then I really started to get upset:

I hate mystery meat navigation.  I'm desperate for some specific relevant information.  Even with very excellent adblocker software I'm spent hours pouring through useless web pages full of pictures, beggin for money, with the same abysmally low quality of information.  Hints, Allegations, and Things Left Unsaid.  I need some concrete documentation that doesn't have hundreds of pages of beginner crap at the beginning which I simply can't force myself to wade through.

All this effort to make stuff easy to use for the average person makes things REALLY HARD to use for someone who want's to really use the hardware.

This sucks.

After lunch I came back to this problem with fresh eyes and I found this.  Someone else, as frustrated as I, who diligently, and clearly, asked for help and got it!  Hooray for you Izzy! (and thank you!).

So I went into the developer settings on the phone and enabled USB debugging.
Then I swpied on the phone from the top down and selected Use USB for Charging, and changed it to Use USB for file transfers.
I was hoping that the phone would automagicially show up in the File Manager but it didn't...

I ran adb usb  and immediately got the Allow USB debugging? pop-up on the phone. - Progress!!

I'd like to access the files on the device and copy those over before tying out the adb backup command....   Hmm.

I did a little digging and found that Android uses MTP for file transfers, the sys-fs/mtpfs fits the bill. However is appears that my Kernel isn't built with FUSE support.   Doe!  Off to go build a new kernel.

Update 7/2/2017
   Working on the new kernel, I think I'd like to try turning on the "Randomize the address of the kernel image" option in the "Processor type and features" menu.  I seem to recall that I had that turned on before, but for what ever reason I have it turned off now.

Other changes:
General Setup - Timers subsystem - full dynticks -  I found this explanation and chose to go from idle dynticks to full dynticks.
General setup - Initial RAM filesystem and RAM disk - Turned off; not using it right now although I'm sure I will at some point.
General setup - Use a virtually mapped stack - A new option that I enabled for better kernel security.
Processor Type and Features - Common API for compressed memory storage & both ZBUD and Z3FOLD - This system doesn't have very much ram, this might help(?) Would be interesting to test a few things with and without this option.
Power Management and ACPI options - CPU Frequency scaling - Intel P state controll VS ACPI Processor P-states driver - Apparently performance differences between these drivers are tiny, but it might be interesting to try Intel's driver, for now I left it at the ACPI driver.  I did turn on the CPU idle PM support - Menu governor - and the CPU idle for Intel processors - seemed appropriate.
Device Drivers - Multiple devices driver suport (RAID & LVM) - Autodetect RAID arrays during kernel boot - Turned off, according to the tool tip it might save several seconds at boot up.
Device Drivers - Network Device Support - Ethernet driver support & PHY Device support and infrastructure & Wireless LAN - I changed everything to modules instead of built in - despite disabling quite a few drivers I'm sure I still have more than I need being built. - Will have to check to see what modules get loaded and thin the herd.
Device Drivers - Network Device Support - USB Network Adapters - Set everything to 'M' and turned off Multi-purpose USB Networking framework.
Device Drivers - Input Device Support - Mice - Synaptics I2C Touchpad Support & Synaptics USB device support - Turned both on as modules, maybe my touch pad will work now!!!  I either forgot to turn these on originally, or I was so annoyed at the touch pad that I disabled them - I don't remember which.
Device Drivers -Character devices - Serial drivers - 8250/16550 and compatible serial support - Changed from off to 'M' - Maybe this is the reason the touchpad wasn't working?
Device Drivers -Character devices - Hardware Random Number Generator Core Support - Changed the Intel and VIA driver to modules - Surely we have zero or one and not both of these, I'm guessing zero.
Device Drivers - Character devices -/dev/nvram - Turned this off.
Device Drivers - Graphics Support - Bootup Logo - Instead of just the 244 color logo I chose all three. - Maybe should disable all of these, and see if there is a difference; I'm not sure I've ever noticed the bootup logo.  Then again I like my computers to boot very quickly, maybe it just scrolls by too fast.  I should probably turn this off; the only bootup logo I want to see is SLiM.
Device Drivers - HID Support - Special HID Drivers - I enabled a few as modules here that referred to mice, maybe one of them is needed for the touchpad.
Device Drivers -HID Support - I2C HID Support - Enabled as a module, again touchpad..
Device Drivers - USB Support - USB ULPI PHY interface support - Set to 'M' - it's a new option and it says it provides functions such as ADP sensing/probing (OTG protocol) and USB charger detection.  Seeing as I have USB OTG adapters for the Raspberry Pi zero, maybe I'll need it someday.
Device Drivers - DMA Engine Support - Synopsys Designware AHB DMA PCI Driver - is marked as M and I can't change it - it used to be off.
Device Drivers - X86 Platform Specific Device Drivers - Asus Laptop Extras - Changed from disabled to Module
I kind of rushed through the crypto options because it's bedtime...  :-)   I'll have a go at compiling the kernel tomorrow,  I did remember to enable FUSE. ;-)

The Kernel compiled smoothly, and my little laptop now boots in under 15 seconds.  Still needs some work, but we're getting there. :-)  I had to use Samba/CIFS to help fix another laptop, So I rebuilt the Kernel with

Still trying to smooth out some of the wrinkles in my kernel:
Device Drivers - Misc devices - ME Enabled Intel Chipsets - Turned on
Device Drivers - Multifunction device drivers - Intel ICH LPC - Turned on

Found a new problem; one which I feel like I've encountered before: The UI fonts in libreoffice have gone to greek? maybe italian?  I managed to switch them to Japanese; but can't see to get them back to english.

Doing an emerge --oneshot libreoffice to see if that helps, then I'll try out these latest kernel modifications; including FUSE.

It did not help...

Nor can I connect via serial console cable to my Raspbery Pi.  I'm at least three problems deep now; I really wish I could solve one! 

Monday, June 19, 2017

2017 Gentoo Maintiance

This weekend I updated the Gentoo installation on my laptop.  I've been away from Gentoo for so long that it proved to be quite an adventure.  An old blog post from six(!) years ago proved helpful in getting everything cleaned up.  But things have changed a bit since then: So here is an updated list of the commands/utilities that I use to keep my system running smoothly.

emerge -uDNav --with-bdeps y --backtrack 200 @world
        (Watch out for Python upgrades, do those first!)
        (Watch out for GCC upgrades!)
        (Watch out for Kernel upgrades)
(Repeat the last two commands until they both finish with nothing to do.  Maybe also emerge @preserved-rebuild)


(if obsolete packages are found remove or, upgrade them and run revdep-rebuild and dispatch-conf again)
If pearl was updated run: pearl-cleaner --all
(Perl upgrades can be messy, apparently..)
Check to see if GCC needs to be set to a new version before removing the old one:
gcc-config -l
gcc-config #
env-update && source /etc/profile
emerge --ask --oneshot sys-devel/libtool
emerge -av --depclean --exclude gentoo-sources  (*** be careful with this one ***
It's suggestions on what to remove are sometimes dumb.)

eclean distfiles
emaint --check world

emaint --fix world

Check to see if you need to upgrade your kernel; once that's done then you can emerge -C any old ones your not keeping.
        layman-updater -R
      layman -S

I plan to edit this again someday (6/21/2017), but this is a nice update from the last one. :-)

Wednesday, December 23, 2015

Tin foil hats and what they say about us.

The modern tin foil hat is on Kickstarter because: of course it is:

Contrary to their marketing I suspect this hat sends stronger, and more harmful, signals then those which it blocks.  

According to the video you should wear it on a first date.  It's kind of a messed up metaphor for our times:  Be open and honest about your inner crazy; while pampering and protecting it.

That was sarcasm by the way.  Please be uncomfortable with your inner crazy.

Sunday, December 20, 2015

Intel you've failed us.

As a computer enthusiast I've got a rockin' desktop, and to keep it " rockin' " I have to upgrade it about every three to five years, depending on how much disposable income I've got at the time.  Well my current desktop is from late 2011 and I'm itching for an upgrade.

Intel makes the best desktop CPU's because they have the best/smallest process technology.  However market forces dictate that they cater to the very low power segments of the CPU markets.  With the Desktop and Laptop markets being eclipsed by cellphone's and tablets Intel has to dramatically shift focus from making the fastest chips, to making the best low power chips.  So Intel is throwing all it's giant manufacturing muscle and CPU know-how into making tiny low power CPU's.  A difficult transition to be sure.

This is great news!  I would love to replace my power hungry server CPU with something very low power so I can leave it running without having a huge electric bill!  Also I'd love for my massive water cooled desktop to be even more overclock-able, and to be able to cram more cores into the same thermal load!!

Intel's newest CPU architecture is called Skylake.  The following Wikipedia article lays out all the different code names in case you are curious.  (My current chip is a middle of the road Sandy Bridge):

I realize that the enthusiast CPU market is a much smaller part of the computing landscape today; I know that all their efforts are going towards finding that special sauce for a low power blockbuster chip.  Surely though with Intel making SEVENTY, yes -7-, -0-, seventy different Skylake CPU's there should be a few to choose from for desktop lovers like myself.


Wait what?


What do you mean...  nope?

You get nothing!


Look at that Wikipedia article up there, the column titled "enthusiast".

INTELLLL!!!!! No enthusiast class chips in (core) generations 5 or 6.  The 4th generation enthusiast chips, Haswell-E were only like 10% better than the 3rd generation chips. No one is going to spend ~$2,000 to upgrade from a three year old enthusiast chip to a two year old enthusiast chip for only a 10% improvement.

Nothing in that list of seventy Skylake chips has a core count above 4.  Some of them are quite fast, the i7-6700K is actually a sweet little chip.   The integrated graphics are annoyingly eating up a large chunk of die space.  Sure it has a mere 20 PCI-e lanes; at least they are flexible.  While the high base clock, and high IPC, mean that this CPU is quite a mover.  If you can find one....  Right now, if you can find one, your going to pay 150%  list for it; there aren't enough to go around.

Alright, so no enthusiast chips worth paying for, and one upgrade candidate with the same 4 cores and limited PCI-E that I already have.  YAWN! [ Seriously!!!  My cell phone has 8 cores!!! - Hello!] 

Alright forget the desktop.  Surely there is something for my server in that list.  Hmm, again, nothing with a core count above 4...  doesn't look good.  Hey the m7-6Y75 only uses 4.5 watts!  Amazing! Can I buy one, nope.  It's a FCBGA1515 chip.  Only way to get one is to become an amazing electrical engineer, design and fabricate your own motherboard, buy an expensive ultra book (or someday a compute stick??), and transplant the CPU. - Not going to happen.. Yet.   :-{ 

Ok how about the E3-1280 V5 - Really excellent chip!  I'd love to have one, in a workstation....   Not a server.  Server CPU's usually aren't doing much. I don't need a barn burner with only 4 cores.  Doesn't matter though, can't get that chip yet, not available.  I could get it's slightly slower cousin the E3-1275 V5, at a premium.  But I want something really low wattage for energy savings; and/or something with lots of cores for virtulization - which also gets me energy savings, and is fun!  -  In the previous generation of Intel chips called Broadwell: Intel make a 8 core hyper-threading monster called the Xeon D-1540.  I'm willing to buy previous generation tech: I could get one of those.  Just one problem.  It's a soldered on chip ( FCBGA 1667 ), and there is only one motherboard you can buy it on, the Mini-ITX X10SDV-TLN4F from Supermicro.  It only has one PCI-e express slot; and I have two hardware RAID cards that I need in my server. So as much as I want one: it doesn't work for me.  

Ok, keep looking, how about the 'L'  suffix chips like the Xeon E3-1260L V5 or the even lower power 1240L => Not available (Yet...  Soon?  [...please?...]).

What about the 'M' series those look...  strange.  I think they are purpose built for semi-powerful gaming laptops.  The integrated graphics on those things are fairly intense; and completely unnecessary for a mostly headless server. Also another unique soldered socket ( FCBGA 1440 ).  

Why does one generation of chips need so many soldered sockets!  Can't I get anything for my server or my desktop!!!

[Several Deep Breaths Later...]

Pentium 4405U - FCBGA 1515 - Not available on desktop boards.
Pentium 4405Y - Same as above but completely unavailable so far.
Pentium G4400T - Amazing all-in-one chip with very low TDP.  35W!  2 cores at 2.9Ghz with fairly powerful HD510 graphics.  Wonderful for an affordable SFF desktop, not great for a server; but OK; but not available and it has another(!!!) socket type: FCLGA1151 - So finding a good motherboard for it even when it becomes available will probably be impossible.
Core i3-6167U - FCBGA1356 (How many more socket types are there! - I imagine motherboard company engineers toiling away 60+ hours a week, in incredible pain from carpel tunnel, desperately trying to make motherboards for all these different sockets..)

There are a ton of processors in the i3-6000 series.  I believe these are all for mainstream laptops, so far I haven't seen anything remotely close to something I could re-build my server around.

Failure.  Complete and utter failure.  I guess I'm going to have to wait until ARM chips become good enough to rival Intel's desktop chips.  It seems like AMD's abandonment of the desktop market (honestly a good idea on their part) has made Intel loose all interest.  I wonder if I could pick up a cheap 16 core Abu Dhabi.  Not sure I could stand to have a 32nm chip though; not when the current state of the art is down to 14nm.  

Intel just refuses to make any decent chips for people looking to upgrade.
What choice do I have?
I guess I'll just save my money, and hope that "Kaby Lake" includes some love for users like me.

PS: My I do tend to rant a lot on this blog, my apologies...  All is well :-)