Author Archives: CRImier

t22lyxxobaxxxxxxxx_54871093

SSD1332 65K 96×64 Color OLED sample code + pinout + simplest Eagle breakout

So, I’ve searched for this display’s files for two weeks. Those are cheap (3$ on eBay), but unlike all those SSD1332 displays with green ribbon of uniform width (and available drivers and breakouts). I’m not even sure if this display is SSD1332 based, and I’m not sure I care after many frustrating unsuccessful attempts to get it working. It’s cheap, however, but you do get a bare panel with a controller.

Apparently, these displays are produced by RiTDisplay. They weren’t that helpful with datasheets though and it’s not even listed on their page. Also, apparently, it’s discontinued now. The display has 27 pins, with SPI and 8-bit interface both available. I found it listed as RGS10096064FR004 on one site but the datasheet seemed to be behind the paywall.

Recently, I found the datasheet (more or less accessible), pinout information (found it before somewhere too, but it was hard) AND SAMPLE CODE! I haven’t yet checked it, but since it was hard to find, I’m sharing it with others.

Dropbox link

RGHost link

Yandex Disk link

Also, I’m sharing the simple board I’ve made in Eagle. It’s in no way complete –  no annotations, some jumpers might be missing for your purpose and you’ll have to check the pinout for your driving mode, but the FPC pitch is right and all the pins you’d need are broken out on headers. I also plan to transfer it to KiCad quite soon, so expect it to be available as well.

eagle_ssd1332_breakout

Dropbox

RGHost

Yandex Disk

The sudo fraud

Ilya's blog

Dear systems engineers,

It really amazes me how people are fine with typing sudo all the time. A kitten is denied a new toy for another day when you do this!

cat-96877_640

Typing sudo locally all the time

Is it really simpler for you to type sudo all the time rather than having one terminal tab open with a root shell? Besides, some systems even ask for a password when you run a sudo command. Be honest with yourself, are you a masochist?

Using sudo on servers

Security

Intro: each Amazon image comes with standard username for logging in. Never seen anyone changing that username.

Supposedly, the attacker would need to know the username in addition to your stolen private key. Right… and it’s not one of these: ubuntu, admin, ec2-user, centos … and looking at your ssh banner won’t give any clue as to which username is used:

SSH-2.0-OpenSSH_…

View original post 220 more words

Flashing BIOS on MSI FM2 boards with a Richland processor

Say you, like me, had a motherboard with an incorrectly flashed BIOS. What do you do in that case? Well, best case, you use DualBIOS or an integrated BIOS recovery tool. What if neither is available? Well, you get a programmer and flash it. What if then you’re stuck with non-matching motherboard and CPU because:

  • The latest BIOS version which is available as binary is not compatible with the CPU you’re on (“please update BIOS for Richland”)
  • You can’t get another CPU in less than a month and a lot of money
  • All the versions which support your CPU are available only as self-unpacking EXEs which seem to work only when you’re in Windows, which you don’t seem to be able to do because the BIOS is not letting you:

20160306_120756

Fuckers.
Well, there actually is a solution.

  1. Get a flash drive, put MS-DOS on it (either format it using Windows =<7 and that checkbox which is there)
  2. Put that damned EXE on this drive and insert it into the motherboard (rear USB 2.0 ports preferred, the ideal orifice would be located on the body of the person responsible for a decision of not providing ROMs)
  3. Boot and press F1 to go into that damn BIOS
  4. Go “Settings”->”Save and Exit” -> override boot order and boot into that flash drive
  5. Enter “dir” to see the filename of the BIOS flashing tool
  6. Run it and reboot when it allows you.

Voila!

The boards on which this should work, according to the BIOS release notes:

FM2-A55M-E33 /FM2-A55M-E23 / FM2-A55M-P33 / FM2-A75MA-P33 / FM2-A85XMA-P33

You might have some luck with other boards, too. This approach worked for me with FM2-A75MA-P33.

CTRL-EVENT-REGDOM-CHANGE on latest Raspbian Jessie Lite

I’d get following errors when I ran wpa_supplicant to connect to my home network from Raspbian Jessie Lite (using CLI, of course)

wlan0: SME: Trying to authenticate with 0c:xx:xx:xx:xx:xx (SSID=’MYSSID’ freq=2412 MHz)
wlan0: Trying to associate with 0c:xx:xx:xx:xx:xx (SSID=’MYSSID’ freq =2412 MHz)
wlan0: Associated with 0c:xx:xx:xx:xx:xx
wlan0: CTRL-EVENT-DISCONNECTED bssid=0c:xx:xx:xx:xx:xx reason=3 locally_generate d=1
wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD

It turns out that wpa_supplicant runs as a service and is to be controlled through wpa_cli. You can go that way, or you can simply killall wpa_supplicant if you’re in a hurry and run  the usual command line, and the errors will go away.

Black Swift board – connecting to WiFi network using UART

Hi! Today I’m showing you how to connect to a wireless network using serial console (or SSH over wired LAN, for that matter) in OpenWRT.
bsb_serial_login

Disclaimer: this tutorial is mainly focused on Black Swift boards, which are nice boards running OpenWRT, but I believe it should apply to most of the OpenWRT boards.

Connecting to WiFi using serial connection might be necessary because you’ve got WiFi connection as the only other way to configure your board but you need to connect to the Internet somehow, for example, to download updates. Not to mention it is kinda is hard to change settings on a connection you’re using to change them, one wrong move/glitch and you’re cut off, needing to reboot the board and restart =( Say, you’ve got a Black Swift Pro board with USB-UART embedded, or you have connected an external USB-UART to your BSB Basic, doesn’t matter. What matters is that you’ve got a terminal at your service, and that ain’t going anywhere – even if WiFi goes down. … I like serial consoles. They’re reliable.

By the way, I’m overriding the UCI configuration. It’s temporary, so not gonna get saved anywhere. For UCI configuration there are many other guides, which I need not repeat here – these are plain old command line tools. If this guide gets outdated at some point, do not hesitate to contact me using comments or e-mail.

Say, your network interface is wlan0 – one can never be too sure, what if you were using an USB-WiFi dongle? If in doubt and things go wrong, check.
Now you need to issue a couple of commands to connect to your WiFi network of choice. I suggest you follow this guide, it has info about using different network encryption types with iw utility. For me, I had to use wpa_supplicant because my network is WPA2 protected. For this, I needed a file with network’s PSK, and that file is usually generated by wpa_passphrase command-line utility. BSB’s firmware provides no wpa_passphrase tool in the default image, however, you can run it on any Linux machine and then just copy the output over.

If you don’t have a Linux PC with this tool nearby, there’s also this option:
1. Take this configuration:

network={
    ssid="MYSSID"
    #psk="passphrase" #network password goes here, but this is not necessary
    psk=59e0d07fa4c7741797a4e394f38a5c321e3bed51d54ad5fcbd3f84bc7415d73d
}

2. Generate the PSK part on this website
3. Fill in the fields according to the field names and save this in a file.

Then, you have to start wpa_supplicant like this:
wpa_supplicant -iwlan0 -cwpa.conf, where wpa.conf is the file you’ve just generated.

Hit Ctrl^Z when you can see it has connected to the right AP to free the terminal, then send wpa_supplicant to background with bg command.
You can use iw dev wlan0 link to verify you’ve connected to the wireless network, if you’ll be unsure about that.

Check if DNSMASQ is running – it’s most likely serving DHCP addresses on the wireless network you just connected to, you’d want to avoid that.
ps |grep dnsmasq
Once you know the PID, just kill it.

Okay, now getting the address by DHCP.
udhcpc -i wlan0

We should have basic connection. Check network connectivity now:
ping 8.8.8.8

However, we don’t have DNS working, the reason is that DNSMASQ is used as a caching DNS server and therefore it made itself a system-wide DNS server, and we just had to shut it down. We need to edit /etc/resolv.conf and replace “127.0.0.1” in there with any DNS server, be it your router, your provider’s DNS or one of public DNS addresses. I chose 8.8.8.8. When done, test it:
nslookup google.com
If the results are reasonable, you’re good to go. Now, set up whatever you need to set up. For me, I finally could do opkg update – I’ll tell you about that one later =)


 

Bonus: connecting USB-UART to the Black Swift board

(Basic, as the Pro boards have USB-UART on the board)
Requirements:

  1. A USB-UART dongle with suitable logic levels – 3.3V max. If in doubt, plug it in and check RXD and TXD lines’ levels from the ground. None should be above approx. 3.3V.
  2. A couple of sufficiently thin wires (I used male-male breadboarding wires, as you can see on the pictures below). If you don’t have headers attached to your BSB, you can solder those wires right into the connection holes on the BSB.

Diagram:

BlackSwiftToUART

You can safely swap the RXD/TXD lines, and you might need to because different manufacturers label them differently. If you plug in the board but see nothing in the terminal, most likely that’s what you need to do.

UART parameters: 115200, 8n1

20160104_023652

Tip – if you don’t have 5V line on your connector, you most definitely won’t burn your GPIO by connecting wires to it accidentally 😉

20160104_031908

I was surprised that my BSB breakout had GPIO columns swapped. I soldered UART wires incorrectly the first time before my gut feeling warned me I should check the pinouts before plugging it all in.

20160104_014908

The wires – beware, they are plugged in wrong holes on this picture!

20160104_032726

End result, up and running great.

Oh, and if you will have problems running a counterfeit USB-UART adapter based on PL2032, like the one I used, I highly recommend visiting this site for drivers. Worked like a charm on Windows 8 x64.

Making luakit play YouTube videos

Luakit, even though it’s a quite awesome (and fast!) browser, doesn’t play YouTube videos out-of-the-box. At least, when installing it from Raspberry Pi Debian repos, it doesn’t pull the dependencies need and doesn’t even list the packages as ‘recommended’. Nowhere I could find it, but one Arch Linux forum page had a hint, which I decrypted:
Install gstreamer1.0-libav and gstreamer1.0-alsa – the latter being responsible for sound in YouTube videos.
That’s it. Hope it helps =) If you find it’s still not working for you – comment below, I’ll try to debug the issue.

Compiling the latest Arduino IDE for Raspberry Pi

I now have started to use Raspberry Pi 2 with Raspbian Jessie as my desktop PC, and it does all the things I need it to do pretty well. Except… Well, Raspbian is stuck with Arduino IDE 1.0.5, even Jessie. Honestly, it sucks – the newest is 1.6.4 (arduino.cc, not arduino.org version. Screw arduino.org.) Did you know we’ve gotten a sketch autosave feature somewhere around 1.5? If I’d have known, I could have gotten some of my sketches saved when Arduino IDE crashed. Oh, BTW, 1.0.5 also crashes. Why are we stuck with it is incomprehensible.

Even more incomprehensible given that Arduino IDE happily compiles on Raspberry Pi 2 with just a build.xml file (ant build system file) slightly modified to add a new architecture, as well as some pre-compiled files replaced by the ones compiled for ARM. I won’t go into details much, since I hope that Arduino maintainers accept my build.xml modifications  and do what’s necessary to support ARM architecture. If they won’t, I’ll post complete build instructions myself. I’ll describe what needs to be done though.

  1. First, dependencies. Honestly, I have installed a lot of packages while trying many different ways to run Arduino IDE (including getting Linux x32 tarball and trying to replace libs one by one, which was probably stupid), so I just don’t know which from what I’ve installed is necessary and which isn’t. If you absolutely need it before it’s supported, you can always use tools like apt-file to determine necessary packages by using their filenames. I guess that ‘apt-get build-dep arduino’ will bring most of them.
  2. Then, there’s libastylej.so . You’ll need to install libastylej-jni package – it’s something that Arduino IDE sources have to download from arduino.cc website. I have modified build.xml so that it’ll copy the installed libastylej.so instead of unzipping the bundled version. You’ll also have to install avr-gcc and avrdude, as well as libusb-dev.
  3. Now’s building. You can use the official tools and instructions for building Arduino IDE, except that, as for now, the working build.xml is in my Arduino repository copy. It’s forked from version 1.6.5, but I’m sure it’ll work with the next versions as well. As for now, you might just clone my  repo instead of official:
    git clone https://github.com/CRImier/Arduino.git
    You should be able to just run ‘ant’ and relax while it compiles. Then use ‘ant run’ to run the thing, at least for the first time (haven’t researched if it does something first run-specific). After first run, at least, it should be perfectly safe to just  run it as ‘linux/work/arduino‘ (from ‘build’ directory) or even move the ‘linux/work’ directory somewhere and name it ‘arduino-1.6.5’.
  4. To have the “Compile” and “Upload” functions working, you need to replace all the files in ‘build/linux/work/hardware/tools/avr/bin‘ by their symlinks in /usr/bin.  You’ll also want the ‘build/linux/work/hardware/tools/avr/etc/avrdude.conf‘ to point to ‘/etc/avrdude.conf‘. Here’s an one-liner that you have to execute in the bin directory to make symlinks:

    for i in *; do echo $i; rm $i; ln -s /usr/bin/$i $i; done

If you try this approach and it doesn’t work, there’s a possibility I have forgotten something. Do post an error message in the comments – I’ll try to solve it =) There might be some problems because I’m using Raspbian Jessie, when most of you will use Raspbian Wheezy, so I figure some packages might need to be grabbed from testing repositories in case there’s a problem with them in Wheezy.

One more problem solved, and Raspberry Pi is one step closer to being a suitable work PC replacement for a guy like me. I’d say web browsers are still a major problem though. On Raspbian Jessie, as for now, both Epiphany, Iceweasel and Chromium crash randomly from time to time. A browser that crashes randomly isn’t a good browser for me. If you’re searching for a browser too, try Luakit. It’s Webkit-based, fast, never crashed since. You can see the latest HTML5 test of it here.