All posts by tallen

My Workstation

IMG_20150415_131523I built the gnu tool chain from source. The right monitor has my vi editing session, OpenOCD, and a telnet to OpenOCD. …and yes! that is a model M keyboard the second best keyboard ever made. The left monitor is a little more interesting, the box in the left hand side of my desk is a BitScope, this is a decent Oscilloscope, Spectrum analyzer, and logic probe all in one box. The Linux software works well out of the box. Also there is a Flyswatter II and an Olmex USB programmer (I like the Olmex better), these were a bit difficult to get set-up with OpenOCD but have gotten easier as OpenOCD has matured. I’ve used things like AVROne, and PIC Kit 2, but OpenOCD is far better as remote gdb works well. Say what you will about the learning curve for gdb but it’s the best debugger.

Messy

My lab bench is a bit messy at the moment. Okay, here I spent a few bucks (the microscope) but I share lab space with an engineer from another department. This engineer has low vision (legally blind). He has forgotten more about analogue then I’ll ever know. I hoped, if I spent some bucks and got a good microscope, he’d use it too and he does so it was a good deal. IMG_20150414_141233

I’m A Curmudgeon

I admit it, not only do I use vi (vim), but I use the terminal version. Here’s is screen shot of some Braille Buzz source, notice I use clang complete (Intelligent code completion), and tagbar for navigation. Please don’t get too hung up on the code remember this was hacked together as a proof of concept, the production code will still be C but not so messy.vim colourized with ClangComplete

may not look like much but she’s got it where it counts

In order for our department to function we had to get out from under the main company’s security policy, in order to do that we need our own infrastructure. Our security policy (I wrote it) basically says you (we are all developers in this department) are your own system administrator (part of the job description). You are responsible for whatever your workstation does on our network network, if I have to pull your plug and you can’t do your job that’s on you, not me. Sounds harsh but in practice not so much.

We took a disused electrical service room, Facilities brought me more air-conditioning that I could have wished for, and Maintenance gave me an old equipment rack. The two Dell boxes down on the bottom are nothing to get excited about but the SuperMicro on top, I built from scratch (about half the price of a comparable Dell and yes I counted my labor). Now, I have no illusions that this server room is going to win any beauty contests but these three machines run our Firewall, phones(Asterisk), file servers (SMB and NFS), backups, and Android builds. If something breaks, I have parts–you try getting more than an appeasement engineer in the four hour response time here in Louisville Kentucky. The only downtime we’ve had in about a year is when a fan failed on one of those old Dells, we lost an hour of Internet. Oh, those two things on the right are interesting they are Braille printers (embossers).IMG_20150414_115925

Toaster Oven Re-Flow

This project involves a lot of teaching an old company some new tricks, but there are a million things that could go wrong with this stunt! My goal was to keep costs low as we flush out a new process for doing things. Toaster Oven re-flow is just what it sounds like. Instead to spending $10K on a re-flow oven I did some reading and convinced my boss, Larry Skutchan, that we should at least try this. My yield stands at about 80%. We have prototyped this whole product in-house, the only thing we sent out were the board spins.

The Prototype

Here is the prototype fresh off the 3D printer! It was a real pleasure to work with Industrial Designer / Modeler Andrew DakinĀ  and Industrial Engineer / 3D printer guru Andrew Moulton, they took some very primitive ideas and turned them into something awesome! It’s hard to see but the 26 keys across the top have the Braille letters of the alphabet on them.BBPrototype

Braille Buzz Main Board

BBMainBoardV0.2This is the second board spin. I designed this board and product from scratch. I started with the data-sheets for the ST Micro chip, took some tips form the Olmex boards that featured a similar chip, crossed my fingers and it worked! I have used Eagle (very popular), and Altium (very complicated), and I even tried PCB (too primitive) but my favorite is kiCad (just right). I suspect Verilog can be used for PCB layout, it’s really for “programming” logic gates, but I have my suspicions that it could be a good choice for really complex PCBs.

My .vimrc

execute pathogen#infect()
nmap :TagbarToggle

source ~/.vim/vimrcs/basic.vim
source ~/.vim/vimrcs/filetypes.vim
source ~/.vim/vimrcs/plugins_config.vim
source ~/.vim/vimrcs/extended.vim

try
source ~/.vim/my_configs.vim
catch
endtry

” Highlight all instances of word under cursor, when idle.
” Useful when studying strange source code.
” Type z/ to toggle highlighting on/off.
nnoremap z/ :if AutoHighlightToggle()set hlsendif
function! AutoHighlightToggle()
let @/ = ”
if exists(‘#auto_highlight’)
au! auto_highlight
augroup! auto_highlight
setl updatetime=4000
echo ‘Highlight current word: off’
return 0
else
augroup auto_highlight
au!
au CursorHold * let @/ = ‘\V\<'.escape(expand('‘), ‘\’).’\>’
augroup end
setl updatetime=500
echo ‘Highlight current word: ON’
return 1
endif
endfunction

OpenOCD for BrailleBuzz (STM32F103)

This is my convenience stuff for working with openOCD. “debug” loads the “executable” bin and halts the MCU. “run” loads the “executable” bin and starts it running. “samples” loads some data in to the second bank of flash.

Compile environment for BrailleBuzz (STM32F103)

Okay three big topics here: crt0 (also known as c0), crt1 (also known as c1), and the linking scripts. crt0 is the code that needs to run before your main, it sets up things like the stack. crt1 is the low level stuff that would normally be OS calls. I sorta simulate an OS because we don’t have one, so I simulate a heap and malloc, etc. The linking scripts tell the linker where to put things in the address space.

crt0

This is the code that executes before your main function gets called. Execution starts at 0000h (actually it may be a pointer on this implementation). But before one can actually run any C one has to do some set-up stuff. Traditionally one writes crt0 in assembly and indeed my original was in assembly. If your careful and don’t use certain C constructs you can write crt0 in c itself. There is heavy interaction with the linker script as we need to prepare things like the BSS, EBSS, stack etc. Remember C is gonna need to know where in the address space (which changes from implementation to implementation) things like RAM(rw), flash(ro) and heap are.

crt0.c

crt1

This is the low level operating system type stuff. Well, we don’t have one, but we’d still like things like printf and malloc to work or at least not crash. Remember after you call printf, somewhere down the pike some ascii (or unicode) has to go somewhere. In our case we’re going to output it to one of the UARTs. This is very convenient when debugging! This code took a long time to sort out and is incomplete. I got some of the stubs from the manufacturer. Recall that in a unix OS we would be opening files (in dev), reading from and writing to them but here we don’t have an OS or a file-system so we make some assumptions, lots of assumptions.

crt1.h

crt1.c

linker script

We need to tell the linker where to put things. What addresses correspond to RAM? What addresses correspond to ROM(flash)? Where’s the “heap”, how big is it.

stm32.ld

IRQ handlers

Lastly we have the irq handlers. We mostly just go into an infinite loop. Naturally we really should do better than this but I never got round to it.

irq.h

irq.c