Wednesday, August 5, 2015

Hardware/Software

That's the lovely thing about embedded computing; the software and hardware layers are so intimately entwined.

On the one side, since the software is controlling physical processes (like servo motors, ultra-bright LEDs, etc.) a software error can "crash" the hardware. I've bent a servo shaft more than once due to getting a line wrong in the code I was testing.

And on the other side, the hardware can make for a less than pristine software environment. I was struggling this whole evening to get tone generation via timers to work sensibly. And as it turns out -- even though the amp I'm using was designed to be attached to Arduino clones, when I sent a full-strength pin signal to it, it crashed the chip and caused it to reset.

The reset is FAST on AVRs. Fast enough that the result was actually in the audible domain; the chip would crash and reset as fast as 400 times a second.

I finally clued in to what was happening when I realized I couldn't write a time out function that worked. And a single slim resistor before the amp seems to have solved that issue.

So good thing I got into this now. Would have been even more of a pain to debug when I had trigger switch and LED and so forth connected as well.

And now I'm comfortable enough again with the hardware timers on the AVR to make another shot at software synthesis. I found a cute little article on waveform lookup tables on the AVR and although I don't really need the waveform per se, I do want the ability to make complex tones that would be difficult to achieve with the Arduino tone() library.




So the raygun is more or less on schedule. I didn't finish the electronics assembly (preferring to leave parts out until I'd figured out which pins were best to drive the speaker with). But that's solved, and finishing the harness is maybe another hour. The biggest chunk of time left on this project is the programming, and all in all I made a good start at it today.

Oh, yeah. And now one of the companies I called asking for work calls back to see if I can drop in for a week or two to cover a guy who is on vacation. And it's a company I do not want to turn down...

No comments:

Post a Comment