{"id":1415,"date":"2023-03-10T21:30:34","date_gmt":"2023-03-10T21:30:34","guid":{"rendered":"https:\/\/socmaker.com\/?p=1415"},"modified":"2023-03-17T18:35:41","modified_gmt":"2023-03-17T18:35:41","slug":"quicklogic-quickfeather-gotchas","status":"publish","type":"post","link":"https:\/\/socmaker.com\/?p=1415","title":{"rendered":"Quicklogic Quickfeather Unbricking Success \/ Gotchas"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I have started on the path of working with the QuickFeather board from SparkFun.  There are some gotcha&#8217;s I was able to solve along the way that might baffle some people.  My solutions may not be ideal, but here they are.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 <a href=\"https:\/\/qorc-sdk.readthedocs.io\/en\/latest\/qorc-setup\/quickstart.html#quickstart-with-qorc-sdk\">https:\/\/qorc-sdk.readthedocs.io\/en\/latest\/qorc-setup\/quickstart.html#quickstart-with-qorc-sdk<\/a> )<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note: the following instructions are based on using Ubuntu as your OS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following is correct.  I did it from my home directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/QuickLogic-Corp\/qorc-sdk.git<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next is the part which is not totally correct if you are following the instructions.  Read on.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The instructions say that you must have <em>python3<\/em> installed as well as <em>pip<\/em>.  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. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One more install is required but not mentioned: You must first install <em>curl<\/em>.   <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 &#8216;source&#8217; you cannot just use sudo.  Instead, do the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$sudo su\n$cd qorc-sdk\n$source envsetup.sh\n$cd ..\n$chown --recursive <em>yourusername<\/em> qorc-sdk\n$exit\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next, if you wish to always have the development environment available as soon as you log in, you need to edit the file &#8220;.bashrc&#8221; in your home directory and add the following line last in the file, assuming qorc-sdk is in your home directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> source ~\/qorc-sdk\/envsetup.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I followed the instructions on this video (near the end of the video) to start the recovery process: <a href=\"https:\/\/www.youtube.com\/watch?v=Q5GIZUsXb3I\">https:\/\/www.youtube.com\/watch?v=Q5GIZUsXb3I<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 &#8220;Successful.  Sort of&#8221;: <a href=\"https:\/\/github.com\/QuickLogic-Corp\/qf-initial-bins\">https:\/\/github.com\/QuickLogic-Corp\/qf-initial-bins<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 <a href=\"https:\/\/www.segger.com\">https:\/\/www.segger.com<\/a>.  They have versions for Macintosh, Ubuntu, Windows.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My first attempt with the JLink failed.  After restarting everything and running the commands again, I was able to get the green &#8220;breathing&#8221; light.  After that, I tried again with the &#8220;cheap&#8221; segger unit.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Start out in the directory with the dev-board binaries (so you don&#8217;t have to enter a path).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(base) Ubuntu :~\/qorc-sdk\/quick-feather-dev-board\/binaries$ JLinkExe\nSEGGER J-Link Commander V7.60d (Compiled Jan 17 2022 13:14:40)\nDLL version V7.67d, compiled Jul  5 2022 16:18:19\n\nConnecting to J-Link via USB...O.K.\nFirmware: xxxxx compiled Dec  5 2022 14:44:58\nHardware version: V1.00\nS\/N:xxxxxx\nUSB speed mode: Full speed (12 MBit\/s)\nVTref=3.300V\n\n\nType \"connect\" to establish a target connection, '?' for help\nJ-Link&gt;connect\nPlease specify device \/ core. &lt;Default&gt;: CORTEX-M4\nType '?' for selection dialog\nDevice&gt;\nPlease specify target interface:\n  J) JTAG (Default)\n  S) SWD\n  T) cJTAG\nTIF&gt;s\nSpecify target interface speed &#91;kHz]. &lt;Default&gt;: 4000 kHz\nSpeed&gt;\nDevice \"CORTEX-M4\" selected.\n\n\nConnecting to target via SWD\nFound SW-DP with ID 0x2BA01477\nDPIDR: 0x2BA01477\nCoreSight SoC-400 or earlier\nScanning AP map to find all available APs\nAP&#91;1]: Stopped AP scan as end of AP map has been reached\nAP&#91;0]: AHB-AP (IDR: 0x24770011)\nIterating through AP map to find AHB-AP to use\nAP&#91;0]: Core found\nAP&#91;0]: AHB-AP ROM base: 0xE00FF000\nCPUID register: 0x410FC241. Implementer code: 0x41 (ARM)\nFound Cortex-M4 r0p1, Little endian.\nFPUnit: 6 code (BP) slots and 2 literal slots\nCoreSight components:\nROMTbl&#91;0] @ E00FF000\n&#91;0]&#91;0]: E000E000 CID B105E00D PID 000BB00C SCS-M7\n&#91;0]&#91;1]: E0001000 CID B105E00D PID 003BB002 DWT\n&#91;0]&#91;2]: E0002000 CID B105E00D PID 002BB003 FPB\n&#91;0]&#91;3]: E0000000 CID B105E00D PID 003BB001 ITM\n&#91;0]&#91;4]: E0040000 CID B105900D PID 000BB9A1 TPIU\nCortex-M4 identified.\nJ-Link&gt;r\nReset delay: 0 ms\nReset type NORMAL: Resets core &amp; peripherals via SYSRESETREQ &amp; VECTRESET bit.\nReset: Halt core after reset via DEMCR.VC_CORERESET.\nReset: Reset device via AIRCR.SYSRESETREQ.\nReset: S_RESET_ST never gets cleared. CPU seems to be kept in reset forever.\nReset: Using fallback: Reset pin.\nReset: Halt core after reset via DEMCR.VC_CORERESET.\nReset: Reset device via reset pin\nT-bit of XPSR is 0 but should be 1. Changed to 1.\nJ-Link&gt;loadbin qf_loadflash.bin 0\nDownloading file &#91;qf_loadflash.bin]...\nO.K.\nJ-Link&gt;r\nReset delay: 0 ms\nReset type NORMAL: Resets core &amp; peripherals via SYSRESETREQ &amp; VECTRESET bit.\nReset: Halt core after reset via DEMCR.VC_CORERESET.\nReset: Reset device via AIRCR.SYSRESETREQ.\nJ-Link&gt;g\nJ-Link&gt;exit<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The light will be &#8220;breathing&#8221;.  If you are in your home directory (where qf-initial-bins directory is), then you should be able to type the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>qfprog --mode m4 --mfgpkg qf-initial-bins\/ <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">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).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You should see a success.  If you don&#8217;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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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 &#8220;factory&#8221; settings.   The qfprog alias will work to update the flash using qf-initial-bins.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Success!  Sort of.<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">I did a Bing.com search (which now uses AI), and found &#8220;qf-initial-bins&#8221; in github.  This repository *does not* show in the repository list unless you choose &#8220;show all repositories&#8221; and go to page 2.  In addition, the qf-initial-binaries bootloader flash load binary does not &#8220;breathe&#8221; the green led.  It flashes it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">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:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>python3 TinyFPGA-Programmer-Application\/tinyfpga-programmer-gui &#8211;port COMXXX &#8211;mfgpkg quickfeather-initial-binaries<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NOTE: THIS FOLLOWING INFO IS CORRECT:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">qfprog &#8211;mode m4 &#8211;mfgpkg qf-initial-bins\/ <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The github repository is downloaded to qf-initial-bins, and the &#8211;mfgpkg command does all of the binaries in the right order.  The mode, not mentioned or described, appears to need to be &#8220;m4&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The board now boots into the &#8220;diag&#8221; 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 &#8220;cheap&#8221; segger!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MORE NOTES:<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">As I was mucking around with the quickfeather board, reprogramming caused \/dev\/ttyACM0 to be &#8220;dead&#8221; 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.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, if you download the TinyFPGA-programmer-application repository manually, you will have to go into the python script file and fix several &#8220;is not&#8221; lines and change them to &#8220;!=&#8221; as suggested by the python interpreter.  This will happen if you follow the install by hand instructions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Fini<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Enjoy!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have started on the path of working with the QuickFeather board from SparkFun. There are some gotcha&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1415","post","type-post","status-publish","format-standard","hentry","category-blogposts"],"_links":{"self":[{"href":"https:\/\/socmaker.com\/index.php?rest_route=\/wp\/v2\/posts\/1415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/socmaker.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/socmaker.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/socmaker.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/socmaker.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1415"}],"version-history":[{"count":20,"href":"https:\/\/socmaker.com\/index.php?rest_route=\/wp\/v2\/posts\/1415\/revisions"}],"predecessor-version":[{"id":1442,"href":"https:\/\/socmaker.com\/index.php?rest_route=\/wp\/v2\/posts\/1415\/revisions\/1442"}],"wp:attachment":[{"href":"https:\/\/socmaker.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/socmaker.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/socmaker.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}