Custom board with MK02 and MK20 not responding

Status
Not open for further replies.

DatoDavid

Member
First of all a big thank you to Paul et al. for conceiving and making the Teensy hardware and software.

I designed and built a custom board with a MK02 bootloader carefully unsoldered from a Teensy LC and a fresh MK20DX256VLH7. It's a main board for a synthesizer, with MIDI in and outputs, headphone/speaker amplifier and connectors that go to the potentiometers/leds. Unfortunately, the Teensy part is not working.

Screen Shot 2016-09-16 at 10.28.49.png

Here is part of the schematic, which looks a lot like the Teensy 3.2 schematic found on https://www.pjrc.com/teensy/schematic.html
I've left out the LDO, amps, connectors and MIDI stuff.

schematic.jpg

It's not responding to a programming request and I can't seem to figure out why. The K20 keeps resetting every few microseconds, which is expected behaviour for an unprogrammed chip, but it doesn't seem to take in the bootloader code.

First suspect is the crystal:

mcu-programming-layout.jpg

It's a surface mount HC49 16MHz 18pF crystal with two 20pF load capacitors. The bottom layer is an unbroken ground plane with no switching traces near the crystal. It's probably not as neat a layout as the four-layer Teensy with its small SMD crystal, but it should be okay. I can't measure any oscillations, so the microcontroller is obviously not starting up the crystal.

I've built four of these boards and all seem to suffer the same issue. In a very radical move, I programmed a blink sketch onto a working Teensy 3.2 and transplanted the working microcontroller onto my board. Surprisingly, it worked. The crystal oscillates nicely at 16MHz and the blink pin is happily blinking away. To me, this means we can rule out the crystal as a source of the problem.

Other things I've done:
- Add extra decoupling to the 3V3 line. It's rock solid if I look at it with the scope
- Unconnect the signals to PTA4, so that the uC doesn't accidently end up in EZport mode
- Checked the polarity of the USB D+/D- signals
- Checked Vbat and Vregout

Here is a logic analyzer grab of what is happening on the SWD/JTAG pins between the MK02 and MK20:

Teensyloader-K20-JTAG.jpg

You can clearly see the repeating resets. Shouldn't the MK02 pull reset HIGH? To me the TCK signal looks quite erratic for a clock signal. The MK02 keeps sending signals even if I don't press the PROG button.

Any ideas on how to hunt down this issue?

I have a scope and logic analyzer, so if there is data I need to measure/grab I can do so. Also, I have a NXP/Freescale FRDM board that I can use as an OpenSDA JTAG/SWD programmer, except that I don't know how to use them.
 
A little update on my debugging process.

I installed Kinetis Design Studio for Mac and updated the firmware on my FRDM-K22F board to become a J-link compatible OpenSDA programmer. With this, I uploaded my compiled sketch and the board is working as expected. Woohoo!

Uploading through Teensy Loader doesn't work, though. So to me it sounds like it could be two things:
- Either the MK02 is not programming the MK20 correctly
- Or there is something wrong with the USB connection to the host

Is there a good way to check these two?

Edit: I found out the K20 does not enumerate as a serial port, even though I've set the Teensy USB type to Serial. That'll be my first target for investigation tomorrow.

Edit2: I found some soldering issues near the USB port and fixed them. Now at least it enumerates as a Teensyduino serial port. The Teensy software fails to upload, however. Here is what verbose mode spits out:

12:36:02: remote connection opened
12:36:02: remote cmd: "comment: Teensyduino 1.29 - MACOSX"
12:36:02: remote cmd: "dir:/Users/david/Documents/Arduino/DATO/duo-firmware/"
12:36:02: remote cmd: "file:duo-firmware.hex"
12:36:02: File "duo-firmware.hex". 34728 bytes, 13% used
12:36:02: remote cmd: "status"
12:36:02: status data sent
12:36:02: remote connection closed
12:36:02: remote connection opened
12:36:02: remote cmd: "status"
12:36:02: status data sent
12:36:02: remote cmd: "status"
12:36:02: status data sent
12:36:03: remote cmd: "status"
12:36:03: status data sent
etc...
 
Last edited:
You got your MK02 from PJRC? If I have an issue with a board not programming, the first thing I check is if the RESET is being pulled down when I pressed the program button. That'll tell you if the MK02 is doing its job.
 
Hi @yeahtuna, thanks for responding. You might have noticed the original question is over four years old and this issue has long been solved. This particular problem was due to bad connections – both soldering mistakes and an error on the board.

Going from here, we built a separate plug in board carrying the MKL02 to be able to debug the two boards separately and got it working successfully.
 
Status
Not open for further replies.
Back
Top