Fun example of a USB MIDI piano based on SAMD21J.
The schematic is very simple:
This board is designed to interconnect with a 2x5 swd connector:
The sam BA bootloader can be found here.
Problem #1: missing ground¶
I quickly realized I forgot to connect GND_4 to the common GND of the circuit, and the chip wasn’t responding when programming. I had to solder add a bypass wire:
Here is a closeup of the bypass:
Problem #2: edbg doesn’t recognize SAMD21JE17¶
After the previous step,
edbg was reporting a different error:
>> edbg -ebpv -t samd21 -f .\sam_ba_SAMD21J17A.bin Debugger: Alex Taradov Generic CMSIS-DAP Adapter 598682CF v0.1 (S) Clock frequency: 16.0 MHz Error: unknown target device (DSU_DID = 0x10010301)
This error meant that reading the chip’s ID was successful, but it was not recognized.
I had to add the following line in edbg’s
target_atmel_cm0p.c and recompile it:
This fix is available on my fork of edbg, and I will send a pull request to Alex to include it in the official release.
The code makes extensive use of Adafruit’s FreeTouch, for its simplicity. Here is a simple usage of a qtouch pad:
Adafruit_FreeTouch qt = Adafruit_FreeTouch(pins_piano[i], OVERSAMPLE_4, RESISTOR_50K, FREQ_MODE_NONE); qt.begin(); int value = qt.measure();
The following settings should be set when programming:
This project is provided under the MIT License.