MK312 SMD Version Crashing

I finished assembling the SMD version of the MK312 (which I modified to make 2-layer). After swapping the right transistors in (the P- and N-channel part numbers are switched in the schematic), I have gotten it to startup and pass its self-test. It gets to the screen that says “Battery: 00% Press Any Key…” (battery 0% with 15V input??). When I press a button, the processor appears to crash/restart, flashing one of the LEDs then doing the startup process again, but without re-initializing the LCD I guess. As soon as I press the button, the top row of the LCD fills with black rectangles, but if you look at it from an angle, you can barely see that the top line of text of the startup sequence is being output until it gets to the “Press Any Key” screen again.

I’ve tried other firmware, which does nothing (no LCD output) and have added a decoupling capacitor near the LCD and have put a short ground wire between the front panel and the main board. I also checked the 5V rail and the ATMEGA’s reset line (which both look solid at 5V even when it crashes) and some of the data lines on the LCD, which look nice and square. I’ve read on some other topics on here it helps to make the ribbon cable shorter (the only ones Mouser had in stock were either way too short or really long), but the data seems to be getting through just fine. I tried adding pull up resistors and 100nF caps to the buttons (for debouncing), but it made it immediately crash at the “Press Any Key” screen without having to push the buttons.

Regarding the weird 0% battery thing, it seems to be sensing something because if I just power the 5V (without the 9V/12V), it does say low battery.

Has anyone else had or found a solution to this black square/crashing problem? Anything else I should measure? It seems very odd to me that a button press would cause the processor to crash.

The firmware expects to see power on the +12v rail so fix that and try again.

There is a voltage divider at one of the ADC inputs - it measures the 12V rail. Check the divider resistor values.

Just buy a spare IDC connector and make the cable shorter.

I’ve checked and all the rails are present, the divider resistors are correct, and the ADCs are reading the values (via the debug screen). The voltages on the pins are around 2.5 and 2.9 volts. If I connect the ADC inputs directly to 5V or GND:

5V on battery voltage sense: Failure 21
0V on battery voltage sense: battery shows as 16% (instead of 0 [what?], still crashes on button press)
5V on 12V sense: top line of LCD doesn’t update to show battery status at all (still crashes on button press)
0V on 12V sense: “Battery: Low Shut Off Power!”

Regarding the cable, this SMD variant uses a flat flex cable instead of a standard IDC ribbon cable, which I guess I could chop up and resolder (or I could solder some janky wires across), but I’m not thinking that’s the problem at this point.

The custom firmware the guy made for this version seems to have modifications in the battery checking and the LCD communication routines. I’ve talked with some people on the metafetish Discord and probed a bunch of the data lines with my logic analyzer. Nothing looks particularly strange, so I’m assuming there is a problem in the custom firmware version (the guy did say it was untested). I’m planning on trying to get the normal firmware running to see if that will work (by probing the gates of the FETs, it only runs the self-test once and doesn’t seem to reset when I press the buttons, so that’s a good sign), but it does not work with the LCD on the SMD version. The normal firmware sends out stuff to the LCD at about 1MHz, while the new LCD, though it uses the same protocol, does not support speeds that fast, so I will need to hack in a different LCD to see if it will display anything.

Thanks for the suggestions. I still have no idea why it’s crashing, so if there’s anything else you think I should try let me know.

I would say 1MHz for the LCD is way too fast. HD44780U has an External clock frequency 350 kHz MAX. I would say Chinese clones will be even worse.

Honestly, I’m not really sure what’s going on anymore. My logic analyzer is showing sub-microsecond pulses on the LCD data lines and all kinds of weird stuff. After reviewing the board, it looks like the ground plane is pretty chopped up, which could definitely explain some of the problems. When I get a chance, I’ll look at the data on a proper oscilloscope and probably scrape off the solder mask and add wires connecting the grounds better. Pretty much just guessing here…

This was exactly the problem (part of it) with my 1.3R. I slightly modified the board - I made isolation between pads and copper pour a tiny bit larger - for better soldering. This was a mortal mistake, the ground copper pour is barely enough in original design.

I think you really need to use a proper oscilloscope or at least try to experiment with the logic analyzer threshold voltage.

Yep. I hastily redid some of the board to make it 2-layer (the original was 4) when I had the chance to order some PCBs to make it cheaper. I added some vias attempting to make the grounding better but it doesn’t look like enough now that I look at it some more. Next week is finals at college so I’ll have to wait a while before I get to use my oscilloscope at home (unless I want to just wander into a lab with my uh… “personal project”).

1 Like

Please check your design. The operational amplifier inputs are interchanged. They don’t have to be inverting.

Here is my suggestion to change the circuit design.

I’m not the person who created this SMD version, and the schematic seems to be largely correct and matches with the original through-hole board (though now I’ve found out the guy made a second revision of this). However, he did swap the part numbers on the main FETs which took me a while to figure out (it was just shorting the 9V through the transformer until I fixed it).

Regarding the crashing problem, I eventually got tired of fighting with it so I wrote my own shitty firmware using the Arduino IDE. I found that there were absolutely no stability problems that would indicate something wrong with the hardware. So, I took off the small LCD the guy specified and replaced it with a standard LCD from my junk bin. When I uploaded the standard firmware everyone uses with the through-hole version, it worked perfectly fine. It definitely seems like there was something wrong with the custom SMD version firmware the guy made. For some reason while I was messing with swapping different versions of the firmware, the crystal oscillator stopped working (verified with my oscilloscope, maybe I was pressing on it to disconnect the programming cable?), so I had to switch the fuses to use the internal 8MHz RC oscillator instead. I didn’t bother calibrating it because I don’t plan on using the serial functionality.

The board looks like a total hacky mess with an LCD hanging from a bunch of wires, TO-220 transistors soldered onto SMD pads to fix the swapped P/N-channel issue, and extra grounding wires, but it does work. :slight_smile:

1 Like

OK that was my mistake. The circuit I meant was from

That’s the second revision I was referring to but I lost the link. I would’ve built that one had I known about it, but I guess it’s good I didn’t if it had more problems…