OK, so this is tangentially amp-related, but...it's going in OT anyway.
I've got a three-channel preamp which uses an ATmega88PA-PU controller to take MIDI signals in and switch channels accordingly. The latency is about 400-500ms, which is unacceptable, so I need to experiment to find the shortest gap which doesn't include a massive "thump" (assuming the gap's there for noise suppression). I know that the gap is a function of the program running on the controller (spoke to the manufacturer).
So...I've been working on the pre-requisites for making some changes:
1 - I've got a TL866II unit to flash the controller.
2 - I've got Arduino IDE set up to use it (I think), and to handle the ATmega88PA.
3 - I have beer at the ready.
4 - The guy who built it is going to be sending me the original source code this evening.
My questions are...
1 - It seems like there are multiple options for setting the controller's clock, but the board in the preamp appears to have a clock crystal there already. Is there any easy way to find out which clock frequency it's set to use without going back to the guy to ask him?
2 - Can I tell it to ignore the external clock and use its internal clock instead? Is this even advisable?
3 - ...or am I going to have to simply try delay(10000) and reflash with different clocks until the delay is exactly 10s to work it out?
<space for hire>
Comments
And I was writing the code from scratch, in English. How's your Russian?
Well, I haven't...but let's put it this way - I've been programming for about 30-odd years, and there are schoolkids who write programs for the Arduino, which have these chips at the core. On top of that, I'll be getting the source code this evening, and it's orders of magnitude more simple to alter existing code than it is to write from scratch even in an unfamiliar language.
It's written in C, I believe, which is more of a universal language than English Point is, this isn't a complex program - I know it uses the existing Arduino MIDI.h library, which is blindingly easy to deal with. I'd be amazed if there were more than 50 lines of code involved, which makes it pretty easy to trace.
Having dumped the contents of the IC in question, there are exactly 2016 bytes of program in there. It can't be that big or difficult to understand in its original form...can it?
As an aside, I count it as a major win that I've managed to get the TL866II programming gadget to work under Linux! I suspect that'll actually turn out to have been a harder job than correcting the code...
1 - It really does sound great (it's a Soldano X88R clone)
2 - Nobody else seems to do a decent clone, and none of them support MIDI
3 - A real X88R with MIDI is rare enough that we're talking "house deposit" money, whereas this one cost me £350
Could be how he's implemented any delays, could be reading an IO pin instead of using a HW interrupt. Could be he's been dicking with the internal clock divide registers.
I use Atmel micros quite a bit so post questions if you need to know stuff
Good luck.
Yeah...so I've got the source code. Oddly, it wasn't built using Arduino sketches the way I'd expected. This one has all of the MIDI and I/O implementation built from scratch, which I'll admit is more than I bargained for.
That said, once I'd figured out that it was built using CodeVision (and that the eval version will work because the binary image is less than 4KB). The slight sticking point is that CodeVision doesn't support the programmer gadget I've got, which means I need to figure out how to get it to output a file format that the programmer's software can process. I believe I've got them both talking - Intel Hex appears to be the one - but I won't know until I've got the chip blanks tomorrow and I can try it.
I've also figured out how it works and where the gap is generated (looks like both a pre- and post-switch delay), so I know what I need to change. Once I've done that, I think I'll probably have a go at porting the whole thing to a more-manageable Arduino sketch. That's not really necessary for what I'm doing right now, but it'll be handy for my next project - when I've got some time, I'm probably going to build a combined MIDI controller and loop switcher, with the added functionality of trails in the loops.
As a total aside, I don't have the manual for the preamp. It's only from reading through the code (comments in Russian...yay...) that I've figured out how to save channel assignments per-patch
We also used ISP-U I think it was called and that too detected clock speed
I'm gettin' there. The main question now is whether the file I've exported from CodeVision is properly compatible with the import for Xgpro (the burner software). Both reckon they're talking Intel Hex, but I'm naturally distrustful.
And I did a little reverse engineering of compiled software - it's something that needs more practice than I have it. Might do some more...
Tried it at various ever-decreasing combinations...got it down to 2ms pre-delay and 2ms post-delay with no thump. I'd call that a massive fucking win!!!!!!!!!!!!
I really must stop assuming that everyone's going to write their code DRY.