Quicklogic Quickfeather Unbricking Success / Gotchas
I have started on the path of working with the QuickFeather board from SparkFun. There are some gotcha’s I was able to solve along the way that might baffle some people. My solutions may not be ideal, but here they are.
I found that reading the quickstart guide was very good. (Especially around the area of setting up the access to the /dev/ttyACM port(s) (go to Linux Note for Serial Ports on the page https://qorc-sdk.readthedocs.io/en/latest/qorc-setup/quickstart.html#quickstart-with-qorc-sdk )
Note: the following instructions are based on using Ubuntu as your OS.
The following is correct. I did it from my home directory:
git clone https://github.com/QuickLogic-Corp/qorc-sdk.git
Next is the part which is not totally correct if you are following the instructions. Read on.
The instructions say that you must have python3 installed as well as pip. That is correct. Do that. I am assuming you know how to do that on your platform, the instructions for both of those are on the web and are correct.
One more install is required but not mentioned: You must first install curl.
Finally, you *must* run the install as root. Otherwise the Symbiflow install fails (and who knows what else?). However, since the envsetup.sh must be run using ‘source’ you cannot just use sudo. Instead, do the following:
$sudo su
$cd qorc-sdk
$source envsetup.sh
$cd ..
$chown --recursive yourusername qorc-sdk
$exit
With the above instructions, the install will run to the end and install correctly. Run the chown command as root to put the ownership of the installed files (which were just created and owned by root) to you, so you can run and modify items as needed.
Next, if you wish to always have the development environment available as soon as you log in, you need to edit the file “.bashrc” in your home directory and add the following line last in the file, assuming qorc-sdk is in your home directory:
source ~/qorc-sdk/envsetup.sh
That line tells bash to call the setup script for the Quickfeather board at login. It will add (base) to the beginning of your bash prompt in your terminal. Otherwise, just run that command from terminal just before beginning work on the Quickfeather board.
I followed the instructions on this video (near the end of the video) to start the recovery process: https://www.youtube.com/watch?v=Q5GIZUsXb3I
In my case, I also needed to download some binaries, as the bootloader binary provided in the quickfeather-dev-board repository did not work, and it bricked my board, from the point of view of uploading new applications. Use qf-initial-bins instead. see “Successful. Sort of”: https://github.com/QuickLogic-Corp/qf-initial-bins
I then installed JLink firmware (I have a V8 Jlink with ARM support sitting around that a customer purchased for me). You can download from https://www.segger.com. They have versions for Macintosh, Ubuntu, Windows.
My first attempt with the JLink failed. After restarting everything and running the commands again, I was able to get the green “breathing” light. After that, I tried again with the “cheap” segger unit.
I also found out that the segger XMC-JLink also works for this process. I suspect even segger Jlink-OB units will work. If you identify the hardware board as one that is not from Infineon, then the jlink software connecting to the XMC will not work. It will bail with an error message.
Start out in the directory with the dev-board binaries (so you don’t have to enter a path).
(base) Ubuntu :~/qorc-sdk/quick-feather-dev-board/binaries$ JLinkExe
SEGGER J-Link Commander V7.60d (Compiled Jan 17 2022 13:14:40)
DLL version V7.67d, compiled Jul 5 2022 16:18:19
Connecting to J-Link via USB...O.K.
Firmware: xxxxx compiled Dec 5 2022 14:44:58
Hardware version: V1.00
S/N:xxxxxx
USB speed mode: Full speed (12 MBit/s)
VTref=3.300V
Type "connect" to establish a target connection, '?' for help
J-Link>connect
Please specify device / core. <Default>: CORTEX-M4
Type '?' for selection dialog
Device>
Please specify target interface:
J) JTAG (Default)
S) SWD
T) cJTAG
TIF>s
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>
Device "CORTEX-M4" selected.
Connecting to target via SWD
Found SW-DP with ID 0x2BA01477
DPIDR: 0x2BA01477
CoreSight SoC-400 or earlier
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
[0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
[0][1]: E0001000 CID B105E00D PID 003BB002 DWT
[0][2]: E0002000 CID B105E00D PID 002BB003 FPB
[0][3]: E0000000 CID B105E00D PID 003BB001 ITM
[0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU
Cortex-M4 identified.
J-Link>r
Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Reset: S_RESET_ST never gets cleared. CPU seems to be kept in reset forever.
Reset: Using fallback: Reset pin.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via reset pin
T-bit of XPSR is 0 but should be 1. Changed to 1.
J-Link>loadbin qf_loadflash.bin 0
Downloading file [qf_loadflash.bin]...
O.K.
J-Link>r
Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
J-Link>g
J-Link>exit
The light will be “breathing”. If you are in your home directory (where qf-initial-bins directory is), then you should be able to type the following:
qfprog --mode m4 --mfgpkg qf-initial-bins/
The command works if you have set the alias for the programmer application (the alias is called qfprog, and it is done by the envsetup.sh utility).
You should see a success. If you don’t, as happened in my case, start the process over. You did something wrong. Often the repeats will suss out the issue and give you success.
For some reason, restoring the flash programs from the github repository quick-feather-dev-board did not work. However, I can load the qf_loadflash.bin from this repository using a JLink, and following the instructions in the youtube video, update the binaries to the “factory” settings. The qfprog alias will work to update the flash using qf-initial-bins.
Success! Sort of.
I did a Bing.com search (which now uses AI), and found “qf-initial-bins” in github. This repository *does not* show in the repository list unless you choose “show all repositories” and go to page 2. In addition, the qf-initial-binaries bootloader flash load binary does not “breathe” the green led. It flashes it.
Once I downloaded the repository, I read its README.md that tells you to program the board with the following. NOTE: THE FOLLOWING IS WRONG:
python3 TinyFPGA-Programmer-Application/tinyfpga-programmer-gui –port COMXXX –mfgpkg quickfeather-initial-binaries
NOTE: THIS FOLLOWING INFO IS CORRECT:
qfprog –mode m4 –mfgpkg qf-initial-bins/
The github repository is downloaded to qf-initial-bins, and the –mfgpkg command does all of the binaries in the right order. The mode, not mentioned or described, appears to need to be “m4”.
The board now boots into the “diag” application and works as described in the quickstart pdf. The qfprog will recognize the board is in the programming mode when the green light is blinking. This was done with the “cheap” segger!
MORE NOTES:
As I was mucking around with the quickfeather board, reprogramming caused /dev/ttyACM0 to be “dead” and /dev/ttyACM1 to show up. Evidently, there was enough of a change in the USB ID so that the Linux kernel assigned a different tty port to it during my failures. Just use the new port if it shows up. The programmer is smart enough to detect this on its own.
Also, if you download the TinyFPGA-programmer-application repository manually, you will have to go into the python script file and fix several “is not” lines and change them to “!=” as suggested by the python interpreter. This will happen if you follow the install by hand instructions.
Fini
Enjoy!