<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Manzel's Blog</title><link href="./" rel="alternate"></link><link href="./feeds/all.atom.xml" rel="self"></link><id>./</id><updated>2020-06-20T13:44:00+08:00</updated><entry><title>Elecrow PCB Review</title><link href="./elecrow-pcb-review.html" rel="alternate"></link><published>2020-06-20T13:44:00+08:00</published><updated>2020-06-20T13:44:00+08:00</updated><author><name>zst123</name></author><id>tag:None,2020-06-20:./elecrow-pcb-review.html</id><summary type="html">&lt;p&gt;PCB design art is something I have been experimenting with. Recently, I used Elecrow PCB who offers yellow soldermask with black silkscreen without additional cost.&lt;/p&gt;
&lt;p&gt;&lt;img alt="elecrow yellow" onerror="this.onerror=null; this.src='/elecrow-pcb-review_image1.jpg'" src="./elecrow-pcb-review_image1.jpg" style="width: 70%; margin: auto; display: block;"/&gt;&lt;/p&gt;
</summary><content type="html">&lt;p&gt;PCB design art is something I have been experimenting with. Recently, I used Elecrow PCB who offers yellow soldermask with black silkscreen without additional cost.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image1.jpg"
     onerror="this.onerror=null; this.src='/elecrow-pcb-review_image1.jpg'"
     alt="elecrow yellow"
     style="width: 70%; margin: auto; display: block;"/&gt;&lt;/p&gt;


&lt;hr&gt;
&lt;h3&gt;Introduction&lt;/h3&gt;
&lt;p&gt;There are many cheap prototype PCBs manufacturing services online. They can also produce boards in colors other than the conventional green.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image2.png"
     alt="jlcpcb colorful"
     style="width: 60%; margin: auto; display: block;"/&gt;
&lt;center&gt;&lt;i&gt;(Image above is from the JLCPCB Facebook page. This is an example of colorful PCBs.)&lt;/i&gt;&lt;/center&gt;&lt;/p&gt;
&lt;p&gt;I got interested when I found out that Elecrow PCB offers yellow soldermask with black silkscreen without additional cost.&lt;/p&gt;
&lt;p&gt;&lt;img alt="(image of PDF document)" src="./elecrow-pcb-review_image3.png"&gt;&lt;/p&gt;
&lt;p&gt;In comparison, JLCPCB only has the option for yellow PCBs with white silkscreen. PCBway offers black-on-yellow but at a higher cost than white-on-yellow.&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Review Objective&lt;/h3&gt;
&lt;p&gt;I decided to try out Elecrow PCB and I ordered 2 boards. I was surprised at how well they produced it for the price.&lt;/p&gt;
&lt;p&gt;I am writing this blog post because I could not find any recent reviews on Elecrow PCB.&lt;/p&gt;
&lt;p&gt;This review is not paid for and I hope to share as much of my personal experience with you.&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Board Design&lt;/h3&gt;
&lt;p&gt;I designed both my boards in KiCad. These are the 3D renders and later on, let's see how it compares to the actual board received&lt;/p&gt;
&lt;p&gt;My first board is a badge design of the Bare Bears cartoon series. I manually panalized it to fit within 100mm x 100mm.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image4.png"
     alt="Board #1, 3D render"
     style="max-height: 400px; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;p&gt;One potential problem of this board will be the tight corner in between the bear's legs (the smallest width here is about 1mm). I read Elecrow PCB can do a 0.8mm contour routing so I hope it will turn out nicely.&lt;/p&gt;
&lt;p&gt;Another possible difficulty will be the panalization. I later realized that the mouse-bite and the tabs may make the board flimsy and I wonder how they will deal with it during manufacturing.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image5.png"
     alt="Board tight corner"
     style="width: 80%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;My second board will be to try out the yellow soldermask. &lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image6.png"
     alt="3D render front"
     style="width: 80%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;p&gt;In this board, I added a plated slot and prototyping spaces in thhe empty space on the left.&lt;/p&gt;
&lt;p&gt;On the back, I added images and halftones. Halftone is a technique used in printing to produce a gradient of color by using dots of different sizes.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image7.png"
     alt="3D render back"
     style="width: 80%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Gerber Generation&lt;/h3&gt;
&lt;p&gt;It would be great if Elecrow could provide some instructions on how to export the Gerber files to their requirements.&lt;/p&gt;
&lt;p&gt;I had to search online to see what settings other people used. I took reference from these websites.&lt;/p&gt;
&lt;p&gt;In the end, I used these settings without any issues.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Kicad settings A" src="./elecrow-pcb-review_image8.png"&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="Kicad settings B" src="./elecrow-pcb-review_image9.png"&gt;&lt;/p&gt;
&lt;p&gt;After which, I renamed the Gerbers to the Elecrow filenames.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;KiCad Filename&lt;/th&gt;
&lt;th&gt;Elecrow Filename&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Top Copper&lt;/td&gt;
&lt;td&gt;F_Cu.gtl&lt;/td&gt;
&lt;td&gt;LcdPrototype.GTL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bottom Copper&lt;/td&gt;
&lt;td&gt;B_Cu.gbl&lt;/td&gt;
&lt;td&gt;LcdPrototype.GBL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Top Soldermask&lt;/td&gt;
&lt;td&gt;F_Mask.gts&lt;/td&gt;
&lt;td&gt;LcdPrototype.GTS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bottom Soldermask&lt;/td&gt;
&lt;td&gt;B_Mask.gbs&lt;/td&gt;
&lt;td&gt;LcdPrototype.GBS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Top Silkscreen&lt;/td&gt;
&lt;td&gt;F_SilkS.gto&lt;/td&gt;
&lt;td&gt;LcdPrototype.GTO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bottom Silkscreen&lt;/td&gt;
&lt;td&gt;B_SilkS.gbo&lt;/td&gt;
&lt;td&gt;LcdPrototype.GBO&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Non-Plated Drill Holes&lt;/td&gt;
&lt;td&gt;NPTH.drl&lt;/td&gt;
&lt;td&gt;LcdPrototype-NPTH.TXT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plated Drill Holes&lt;/td&gt;
&lt;td&gt;PTH.drl&lt;/td&gt;
&lt;td&gt;LcdPrototype-PTH.TXT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Board Outline&lt;/td&gt;
&lt;td&gt;Edge_Cuts.gm1&lt;/td&gt;
&lt;td&gt;LcdPrototype.GML&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h3&gt;Ordering Process&lt;/h3&gt;
&lt;p&gt;The website interface is simple. You specify details, such as the color, thickness and quantity.&lt;/p&gt;
&lt;p&gt;&lt;img alt="website interface" src="./elecrow-pcb-review_image10.png"&gt;&lt;/p&gt;
&lt;p&gt;I should mention that Elecrow provides $5 worth of loyalty points to offset your first purchase. I forgot to use it at that point of time, so remember to make use of the points.&lt;/p&gt;
&lt;p&gt;I chose the cheapest shipping. Each design costs US$4.90 and shipping of US$10.47 to Singapore. In total, I paid US$20.27. I submitted my zip files and waited.&lt;/p&gt;
&lt;p&gt;For the next few days, I heard no news. There's no feedback or progress indicator like JLCPCB or PCBway. I can only see that it is in production. Hence, I assumed there was no issue with my uploaded files.&lt;/p&gt;
&lt;p&gt;After exactly a week (5 working days + 2 weekends), the status changed from "Production" to "Shipped".&lt;/p&gt;
&lt;p&gt;&lt;img alt="website interface" src="./elecrow-pcb-review_image11.png"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Shipping Issues&lt;/h3&gt;
&lt;p&gt;If everything goes fine, Elecrow will send you an email with the tracking number and photos of the boards.&lt;/p&gt;
&lt;p&gt;At the time when I ordered, it was during the COVID-19 global pandemic. Thus, my shipping experience has not been ideal due to delays and increased prices. Despite this, the Elecrow customer service has been very accommodating to me as I'll explain my story below.&lt;/p&gt;
&lt;p&gt;In this case, I did not receive any email for one whole week before I decided to contact them. I got a reply and they told me that they will check with the post office.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image12.png"
     alt="email"
     style="width: 80%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;p&gt;The cheapest shipping option was PLT Express. Unfortunately, it so happened that they have suspended services due to the pandemic.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image13.png"
     alt="email"
     style="width: 80%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;p&gt;After a few emails back and forth, I was recommended to use Shenzhen DHL. I had to pay an additional $15.19 via their PayPal account.&lt;/p&gt;
&lt;p&gt;And after they shipped it from there, they sent an email with the tracking number and photos of the boards.&lt;/p&gt;
&lt;p&gt;&lt;img alt="email" src="./elecrow-pcb-review_image17.png"&gt;&lt;/p&gt;
&lt;h3&gt;Delivery&lt;/h3&gt;
&lt;p&gt;With DHL expedited shipping, it will cost me double the price per board. But it was still somewhat affordable, thus I decided to go with it.&lt;/p&gt;
&lt;p&gt;This brought the total cost to US$35.46.&lt;/p&gt;
&lt;p&gt;With Shenzhen DHL, the package travelled from China to Singapore in a mere 2 days!&lt;/p&gt;
&lt;p&gt;This is a summary of my waiting time.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Day&lt;/th&gt;
&lt;th&gt;Date&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;23 Apr&lt;/td&gt;
&lt;td&gt;I placed an order&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5 May&lt;/td&gt;
&lt;td&gt;Status on website changed to "Shipped"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11 May&lt;/td&gt;
&lt;td&gt;I emailed them to ask for tracking number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12 May&lt;/td&gt;
&lt;td&gt;They replied; they will follow up from the post office&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;21 May&lt;/td&gt;
&lt;td&gt;Informed me that PLT Express is suspended&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;26 May&lt;/td&gt;
&lt;td&gt;Package returned from post office &amp;amp; shipped using DHL that night&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;28 May&lt;/td&gt;
&lt;td&gt;Package arrived&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If you minus the time wasted due to shipping issues, I could hhave possibly gotten my package in slightly over a week with the fastest shipping.&lt;/p&gt;
&lt;h3&gt;First Impressions&lt;/h3&gt;
&lt;h5&gt;Packaging&lt;/h5&gt;
&lt;p&gt;The box is filled with lots of bubble wrap and packaged very well.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image14.jpg"
     alt="packaging"
     style="width: 80%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;p&gt;As I said earlier, the BareBears board may be flimsy. I realized that Elecrow added pieces of hard cardboard before vacuum packing the PCBs in order to protect it during shipping.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image15.jpg"
     alt="packaging"
     style="width: 80%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;h5&gt;Quantity&lt;/h5&gt;
&lt;p&gt;Many of these Chinese PCB manufacturers may sometimes throw in an additional board or two. Perhaps when if they have extra space on their production panel.&lt;/p&gt;
&lt;p&gt;For both boards, I ordered only 10. I received 12 pieces of my panelized BareBear board. And to my surprise, I saw a whopping 16 pieces of my yellow PCBs!&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image16.jpg"
     alt="packaging"
     style="width: 80%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;h3&gt;Fine details&lt;/h3&gt;
&lt;p&gt;The one thing I like about Elecrow PCB is that they do not insert any order numbers or ID on your board.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image18.jpg"
     alt="packaging"
     style="width: 80%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;p&gt;It seems like the black soldermask is shiny, while the white silkscreen has a matte finish. I really love the matte white look.&lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="./elecrow-pcb-review_image19.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Yellow soldermask looks quite dull on areas without copper. I wish I had done a polygon pour including the orphans/islands. The black silkscreen is shiny instead.&lt;/p&gt;
&lt;p&gt;The halftone technique appears to work and it seems like they can do the really small dots too.&lt;/p&gt;
&lt;p&gt;&lt;img src="./elecrow-pcb-review_image20.jpg"
     alt="packaging"
     style="width: 80%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;p&gt;I'm amazed at the contour routing of the PCBs, especially the tight portion between the bear's legs. Although there is a dent at some areas (in this photo, the left foot has a dent in the middle).&lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="./elecrow-pcb-review_image21.jpg"&gt;&lt;/p&gt;
&lt;p&gt;Also, the milled slot is not entirely smooth and has some unevenness.&lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="./elecrow-pcb-review_image22.jpg"&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3&gt;Soldered Board&lt;/h3&gt;
&lt;p&gt;I don't have any other complains for now, considering the low price for it's quality.
So far I only soldered the Bare Bears board. This is how it looks like.&lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="./elecrow-pcb-review_image23.jpg"&gt;
&lt;img alt="image" src="./elecrow-pcb-review_image24.jpg"&gt;&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;I think only the downside of Elecrow PCB might be their slightly slower production time and lack of live feedback on the production process.&lt;/p&gt;
&lt;p&gt;There are many attractive features of Elecrow PCB. I particularly like their soldermask/silkscreen colours and the really flat HASL finish.&lt;/p&gt;
&lt;p&gt;Do let me know if you find my review helpful. I hope to do more of such blog posts in the future.&lt;/p&gt;</content><category term="Electronics"></category><category term="PCB"></category><category term="Elecrow"></category></entry><entry><title>Fixing CP2102 with custom VID/PID</title><link href="./fixing-cp2102-with-custom-vidpid.html" rel="alternate"></link><published>2020-06-13T15:54:00+08:00</published><updated>2020-06-13T15:54:00+08:00</updated><author><name>zst123</name></author><id>tag:None,2020-06-13:./fixing-cp2102-with-custom-vidpid.html</id><summary type="html">&lt;p&gt;I bought some cheap CP2012 serial IC chips from AliExpress. Maybe it was too cheap at only SGD3.86 for 5 pieces with free shipping. Of course, I should have expected some issues to pop up when I started using it.&lt;/p&gt;
&lt;p&gt;&lt;img alt="CP2102" onerror="this.onerror=null; this.src='/fixing-cp2102-with-custom-vidpid_image1.jpg'" src="./fixing-cp2102-with-custom-vidpid_image1.jpg" style="width: 30%; margin: auto; display: block;"/&gt;&lt;/p&gt;
</summary><content type="html">&lt;p&gt;I bought some cheap CP2012 serial IC chips from AliExpress. Maybe it was too cheap at only SGD3.86 for 5 pieces with free shipping. Of course, I should have expected some issues to pop up when I started using it.&lt;/p&gt;
&lt;p&gt;&lt;img src="./fixing-cp2102-with-custom-vidpid_image1.jpg"
     onerror="this.onerror=null; this.src='/fixing-cp2102-with-custom-vidpid_image1.jpg'"
     alt="CP2102" style="width: 30%; margin: auto; display: block;"/&gt;&lt;/p&gt;


&lt;p&gt;Before I elaborate on the issue, I'd like to show off my fine hand-soldering skills. &lt;code&gt;heheh&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I did not have a hot-air gun so I soldered it using a soldering iron with lots of flux.&lt;/p&gt;
&lt;p&gt;&lt;img alt="soldered cp2102" src="./fixing-cp2102-with-custom-vidpid_image2.jpg"&gt;&lt;/p&gt;
&lt;h3&gt;The Issue - Custom VID &amp;amp; PID&lt;/h3&gt;
&lt;p&gt;The issue is rather simple and so is fixing it too.&lt;/p&gt;
&lt;p&gt;The device is a Silicon Labs CP2102. However, upon connecting the USB port to my computer, I realised that it was detected as a different device.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ lsusb
Bus &lt;span class="m"&gt;006&lt;/span&gt; Device &lt;span class="m"&gt;010&lt;/span&gt;: ID 11ca:0204 VeriFone Inc VeriFone USB to UART Bridge Controller
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;It appears that the CP2012 can actually be configured or pre-programmed to have a different VID/PID. In Windows, it can be done using the &lt;code&gt;CP21xxCustomizationUtility.exe&lt;/code&gt; tool found in AN721.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.silabs.com/documents/public/application-notes/AN721.pdf"&gt;AN721 Documentations (.pdf file)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.silabs.com/documents/public/example-code/AN721SW.zip"&gt;AN721 Software (.zip file)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However, resetting it to default is a challenge, because one must create and install the custom driver for the custom VID/PID first, before using the tool to change it back to default.&lt;/p&gt;
&lt;h3&gt;Fixing it in Linux&lt;/h3&gt;
&lt;p&gt;It is easier to fix it in Linux, because the kernel allows for easy overriding and loading of drivers for a different VID/PID device without modifying the driver.&lt;/p&gt;
&lt;p&gt;I also found an unofficial command-line tool to program these CP2102 easily. &lt;a href="https://github.com/DiUS/cp210x-cfg"&gt;&lt;code&gt;cp210x-cfg&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;First, connect and check the ID of the device. Here, mine is detected as &lt;code&gt;11ca:0204&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ lsusb
Bus &lt;span class="m"&gt;006&lt;/span&gt; Device &lt;span class="m"&gt;010&lt;/span&gt;: ID 11ca:0204 VeriFone Inc VeriFone USB to UART Bridge Controller
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Load the driver and override the ID to be our custom ID. This must be done as superuser.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ sudo -s
&lt;span class="c1"&gt;# modprobe cp210x&lt;/span&gt;
&lt;span class="c1"&gt;# echo 11ca 0204 &amp;gt; /sys/bus/usb-serial/drivers/cp210x/new_id &lt;/span&gt;
&lt;span class="c1"&gt;# exit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Now it will be detected as a proper serial device.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ ls /dev/serial/by-id/
usb-Silicon_Labs_VeriFone_USB_to_UART_Bridge_Controller_0001-if00-port0

$ realpath /dev/serial/by-id/usb-Silicon_Labs*
/dev/ttyUSB0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;You can use it as it is, however this means we have to keep overriding the ID for every PC we connect to.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;We can change it back to the original VID &amp;amp; PID using the &lt;a href="https://github.com/DiUS/cp210x-cfg"&gt;&lt;code&gt;cp210x-cfg&lt;/code&gt;&lt;/a&gt; tool.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ git clone https://github.com/DiUS/cp210x-cfg
$ &lt;span class="nb"&gt;cd&lt;/span&gt; cp210x-cfg/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Install dependencies and make it.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ sudo apt install -y libusb-1.0-0-dev
$ make
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Program it back to the original VID/PID. From AN721 documentations, it tells us that the default for CP2102 is &lt;code&gt;10C4:EA60&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ sudo ./cp210x-cfg -m 11ca:0204 -V 0x10C4 -P 0xEA60
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Finally, we have the original ID back&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ lsusb
Bus &lt;span class="m"&gt;006&lt;/span&gt; Device &lt;span class="m"&gt;065&lt;/span&gt;: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Reload the original serial driver again.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ modprobe cp210x
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;hr&gt;
&lt;p&gt;For completeness, let's change the product name too&lt;/p&gt;
&lt;p&gt;Before changing&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ sudo ./cp210x-cfg -m 10C4:EA60
ID 10c4:ea60 @ bus &lt;span class="m"&gt;006&lt;/span&gt;, dev &lt;span class="m"&gt;105&lt;/span&gt;: VeriFone USB to UART Bridge Controller
Model: CP2102
Vendor ID: 10c4
Product ID: ea60
Name: VeriFone USB to UART Bridge Controller
Serial: &lt;span class="m"&gt;0001&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Command to change&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ sudo ./cp210x-cfg -m 10C4:EA60 -N &lt;span class="s2"&gt;&amp;quot;zst123&amp;#39;s CP2102 UART Bridge&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;After changing&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;$ sudo ./cp210x-cfg -m 10C4:EA60
ID 10c4:ea60 @ bus &lt;span class="m"&gt;006&lt;/span&gt;, dev &lt;span class="m"&gt;106&lt;/span&gt;: zst123&lt;span class="s1"&gt;&amp;#39;s CP2102 UART Bridge&lt;/span&gt;
&lt;span class="s1"&gt;Model: CP2102&lt;/span&gt;
&lt;span class="s1"&gt;Vendor ID: 10c4&lt;/span&gt;
&lt;span class="s1"&gt;Product ID: ea60&lt;/span&gt;
&lt;span class="s1"&gt;Name: zst123&amp;#39;&lt;/span&gt;s CP2102 UART Bridge
Serial: &lt;span class="m"&gt;0001&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;This gave me a interesting adventure into understanding how USB devices are matched to their drivers using its VID/PID. Buying electronics from these non-reputable sellers can sometimes provide some fun experiences to improve your troubleshooting skills in the process. It also comes at a low cost too.&lt;/p&gt;</content><category term="Electronics"></category><category term="CP2102"></category><category term="Serial"></category></entry><entry><title>Chinese Altera Max II CPLDs - Hello World in Ubuntu</title><link href="./chinese-altera-cpld.html" rel="alternate"></link><published>2020-05-19T09:16:00+08:00</published><updated>2020-05-19T09:16:00+08:00</updated><author><name>zst123</name></author><id>tag:None,2020-05-19:./chinese-altera-cpld.html</id><summary type="html">&lt;p&gt;About a year ago, I bought some cheap Altera MAX II CPLD boards from eBay. I remember it was pretty cheap, about USD10 with free shipping for both the board and programmer. However, I never really got to it because of my busy schedule last year. Now with stay home measures in place due to the pandemic, I finally have time to start learning about CPLDs.&lt;/p&gt;</summary><content type="html">&lt;h3&gt;Introduction&lt;/h3&gt;
&lt;p&gt;About a year ago, I bought some cheap Altera MAX II CPLD boards from eBay. I remember it was pretty cheap, about USD10 with free shipping for both the board and programmer.&lt;/p&gt;
&lt;p&gt;However, I never really got to it because of my busy schedule last year. Now with stay home measures in place due to the pandemic, I finally have time to start learning about CPLDs.&lt;/p&gt;
&lt;p&gt;&lt;img src="./chinese-altera-cpld_image1.jpg"
     alt="EPM240 Dev Board"
     style="width: 50%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;p&gt;There are a few guides on how to program this CPLD board on Windows OS. Hence, in this post, I'll focus on going through with my Ubuntu setup.&lt;/p&gt;
&lt;h3&gt;Board&lt;/h3&gt;
&lt;p&gt;The board is quite simple. You will find an Altera Max II &lt;strong&gt;EPM240T100C5N&lt;/strong&gt; with a 50MHz crystal and an LED. It is a tiny CPLD with only 240 logic elements.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pinout&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pin 12&lt;/td&gt;
&lt;td&gt;50MHz Crystal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pin 77&lt;/td&gt;
&lt;td&gt;Red LED&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;You can find the &lt;a href="https://artofcircuits.com/product/altera-max-ii-epm240-cpld-development-board"&gt;schematics&lt;/a&gt; online too&lt;/p&gt;
&lt;h3&gt;Getting Started on Ubuntu&lt;/h3&gt;
&lt;h4&gt;Install Quartus Prime Lite&lt;/h4&gt;
&lt;p&gt;As of writing, the latest version of the IDE is &lt;strong&gt;Quartus Prime Lite Edition 19.1&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;To keep things simple, I downloaded the Combined Files installer: &lt;code&gt;Quartus-lite-19.1.0.670-linux.tar&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src="./chinese-altera-cpld_image2.png"
     alt="Extracted files"
     style="width: 75%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;p&gt;After extracting, run &lt;code&gt;bash setup.sh&lt;/code&gt; in Terminal.&lt;/p&gt;
&lt;p&gt;As the install files are huge, I decided to uncheck all other devices except for the Max II series.&lt;/p&gt;
&lt;p&gt;&lt;img src="./chinese-altera-cpld_image3.png"
     alt="Installer"
     style="width: 75%; margin: auto; display: block;"/&gt;&lt;/p&gt;
&lt;h4&gt;Starting Quartus Prime Lite&lt;/h4&gt;
&lt;p&gt;Connect your USB Blaster. Check if it is detected with this command&lt;/p&gt;
&lt;p&gt;&lt;code&gt;dmesg | tail&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Next, start the JTAG process with sudo. &lt;em&gt;(If you do not give it root permissions, &lt;a href="https://stackoverflow.com/questions/18704913/unable-to-lock-chain-insufficient-port-permissions"&gt;you will get a "Insufficient port permissions" error during programming&lt;/a&gt;&lt;/em&gt;).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo ~/intelFPGA_lite/19.1/quartus/bin/jtagconfig&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Finally, start Quartus Prime Lite&lt;/p&gt;
&lt;p&gt;&lt;code&gt;~/intelFPGA_lite/19.1/quartus/bin/quartus &amp;amp;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You will see the start screen.&lt;/p&gt;
&lt;p&gt;&lt;img alt="start screen" src="./chinese-altera-cpld_image4.png"&gt;&lt;/p&gt;
&lt;h4&gt;Hello World Project&lt;/h4&gt;
&lt;p&gt;Create a new project using &lt;code&gt;New Project Wizard&lt;/code&gt; and then create a new &lt;code&gt;Verilog HDL file&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="New Project Wizard" src="./chinese-altera-cpld_image5.png"&gt;&lt;/p&gt;
&lt;p&gt;This the Verilog code for blinking an LED. &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;// Pin 12 = clk (50MHz Crystal)&lt;/span&gt;
&lt;span class="c1"&gt;// Pin 77 = led (Red LED)&lt;/span&gt;
&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="n"&gt;BlinkingLed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;input&lt;/span&gt; &lt;span class="n"&gt;clk&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;output&lt;/span&gt; &lt;span class="kt"&gt;reg&lt;/span&gt; &lt;span class="n"&gt;led&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kt"&gt;reg&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mh"&gt;31&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mh"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;always&lt;/span&gt; &lt;span class="p"&gt;@(&lt;/span&gt;&lt;span class="k"&gt;posedge&lt;/span&gt; &lt;span class="n"&gt;clk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;begin&lt;/span&gt;
        &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mh"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mh"&gt;22&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mh"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;led&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mh"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;
            &lt;span class="n"&gt;led&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mh"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;endmodule&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Make sure to assign the pins under &lt;code&gt;Pin Planner&lt;/code&gt; too.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Pin planner" src="./chinese-altera-cpld_image6a.png"&gt;&lt;/p&gt;
&lt;p&gt;After which, click on &lt;code&gt;Programmer&lt;/code&gt; &amp;gt; &lt;code&gt;Auto detect&lt;/code&gt; &amp;gt; &lt;code&gt;Start&lt;/code&gt; to program the board.&lt;/p&gt;
&lt;h4&gt;Launch Script &amp;amp; Dark Theme Workaround&lt;/h4&gt;
&lt;p&gt;I have been using a dark theme on my system. However, the &lt;code&gt;Pin Planner&lt;/code&gt; is unusable with a dark theme. As seen below, the selection rows have a white text and a bright background.&lt;/p&gt;
&lt;p&gt;&lt;img alt="selection rows" src="./chinese-altera-cpld_image6b.png"&gt;&lt;/p&gt;
&lt;p&gt;The workaround is to &lt;a href="https://askubuntu.com/a/427440"&gt;launch the app with a white theme&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I decided to create a launch script to do everything for me.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;# Settings&lt;/span&gt;
&lt;span class="nv"&gt;GTK_DATA_PREFIX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;~/intelFPGA_lite/
&lt;span class="nv"&gt;TARGET_THEME_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Yaru&amp;quot;&lt;/span&gt;
&lt;span class="nv"&gt;SYSTEM_THEME_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt; gsettings get org.gnome.desktop.interface gtk-theme &lt;span class="p"&gt;|&lt;/span&gt; sed -e &lt;span class="s2"&gt;&amp;quot;s/&amp;#39;//g&amp;quot;&lt;/span&gt; &lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;

&lt;span class="c1"&gt;# Custom Theming&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; ! -d &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$GTK_DATA_PREFIX&lt;/span&gt;&lt;span class="s2"&gt;/share/themes/&lt;/span&gt;&lt;span class="nv"&gt;$SYSTEM_THEME_NAME&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; 
&lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;Creating theme configutation&amp;quot;&lt;/span&gt;
    &lt;span class="c1"&gt;# Make symlink of the target theme&lt;/span&gt;
    mkdir -p &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$GTK_DATA_PREFIX&lt;/span&gt;&lt;span class="s2"&gt;/share/themes/&amp;quot;&lt;/span&gt;
    ln -s &lt;span class="s2"&gt;&amp;quot;/usr/share/themes/&lt;/span&gt;&lt;span class="nv"&gt;$TARGET_THEME_NAME&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$GTK_DATA_PREFIX&lt;/span&gt;&lt;span class="s2"&gt;/share/themes/&lt;/span&gt;&lt;span class="nv"&gt;$SYSTEM_THEME_NAME&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c1"&gt;# Connect to JTAG with root permissions&lt;/span&gt;
&lt;span class="c1"&gt;# https://stackoverflow.com/questions/18704913/unable-to-lock-chain-insufficient-port-permissions&lt;/span&gt;
sudo ~/intelFPGA_lite/19.1/quartus/bin/jtagconfig

&lt;span class="c1"&gt;# Launch Quartus with white theme&lt;/span&gt;
&lt;span class="nv"&gt;GTK_DATA_PREFIX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$GTK_DATA_PREFIX&lt;/span&gt; ~/intelFPGA_lite/19.1/quartus/bin/quartus &lt;span class="p"&gt;&amp;amp;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;That's all for now. HDL coding is pretty different from programming languages and I'm still getting the hang of it. I have tried out examples for seven segments and PWM generation. Unfortunately, that's all I can do for now until I can get more hardware to interface with.&lt;/p&gt;
&lt;h3&gt;References&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bigdanzblog.wordpress.com/2015/01/22/chinese-altera-max-ii-development-boards-and-hello-world/"&gt;Chinese Altera Max II Development Boards and Hello World&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.modest-destiny.com/posts/altera-usb-blaster-with-ubuntu-1404/"&gt;Altera USB-Blaster with Ubuntu 14.04&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/18704913/unable-to-lock-chain-insufficient-port-permissions"&gt;Unable to lock chain (Insufficient port permissions)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://askubuntu.com/questions/78088/can-i-apply-a-different-gtk3-theme-from-the-main-one-to-an-individual-applicatio"&gt;Can I apply a different GTK3 theme from the main one to an individual application?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.tifr.res.in/~ehep2019/pdfs/expt02_2_QUARTUS_LIT18.1_INSTALL_STEPS.pdf"&gt;Quartus Prime Lite Edition 18.1 on Ubuntu16.04 LTS &amp;amp; Windows&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><category term="FPGA/CPLD"></category><category term="CPLD"></category><category term="Altera"></category></entry><entry><title>My first post</title><link href="./my-first-post.html" rel="alternate"></link><published>2020-05-18T16:53:28+08:00</published><updated>2020-05-18T16:53:28+08:00</updated><author><name>zst123</name></author><id>tag:None,2020-05-18:./my-first-post.html</id><content type="html">&lt;p&gt;&lt;em&gt;Hello everyone!&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is my new blog where I will write about things happening around me, ranging from my personal experiences to my technical side of life. &lt;/p&gt;
&lt;p&gt;&lt;img alt="my-first-post_image1.png" src="./my-first-post_image1.png"&gt;&lt;/p&gt;</content><category term="Updates"></category></entry></feed>