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