├── .github ├── ISSUE_TEMPLATE │ ├── BUG_REPORT_EC.md │ ├── Feedback-request.md │ └── config.yml └── stale.yml ├── .gitignore ├── Docs ├── Board_manager.png ├── Settings_IDE.png ├── dap_cat_programmer.jpg ├── executingGDB.png ├── flashComplete.png └── openOCDRunning.png ├── LICENSE ├── LICENSE_HARDWARE ├── README.md ├── firmware ├── CMSIS_DAP │ ├── CMSIS_DAP.ino │ └── src │ │ └── CMSIS_DAPusb │ │ ├── DAP.c │ │ ├── DAP.h │ │ ├── SW_DP.c │ │ ├── USBHID.c │ │ ├── USBHID.h │ │ ├── USBconstant.c │ │ ├── USBconstant.h │ │ ├── USBhandler.c │ │ └── USBhandler.h └── UsbSerialAdaptor │ └── UsbSerialAdaptor.ino ├── hardware ├── KiCad │ ├── TS-1088R-02026.lib │ ├── TS-1088R-02026.mod │ └── TS1088R02026.kicad_mod ├── SWD_Cat_Programmer-cache.lib ├── SWD_Cat_Programmer-rescue.lib ├── SWD_Cat_Programmer.kicad_pcb ├── SWD_Cat_Programmer.kicad_prl ├── SWD_Cat_Programmer.kicad_pro ├── SWD_Cat_Programmer.kicad_sch ├── SWD_Cat_Programmer.pro └── SWD_Cat_Programmer.sch └── scripts ├── nrf52.cfg └── saml21.cfg /.github/ISSUE_TEMPLATE/BUG_REPORT_EC.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F640 Bug report " 3 | about: Report a bug or unexpected behavior while using the DAP Cat Programmer . 4 | title: 'ElectronicCats' 5 | labels: bug 6 | --- 7 | 8 | **Please, before reporting any issue** 9 | - Make sure your board it's in good condition. 10 | - Verify that it really is a board problem and not a hardware problem. 11 | - **Avoid** to submit a GitHub issue for project troubleshooting. 12 | 13 | Any feedback/suggestions should be discussed on the [feedback section](https://github.com/ElectronicCats/DAP-Cat-Programmer/issues): 14 | * Just click on New Issue and select the correct category. 15 | 16 | When reporting any issue, please try to provide all relevant information to help on its resolution. 17 | 18 | 19 | **Describe the problem:** 20 | A clear and concise description of what the problem is. 21 | The more detailed this is, the easier we can come up with a solution. 22 | 23 | 24 | **To Reproduce:** 25 | Explanation of the steps you followed and how your problem arose. 26 | If you think it is absolutely necessary, mention in detail what you modified. 27 | 28 | 29 | **Expected behavior:** 30 | A clear and concise description of what you expected to happen. 31 | 32 | **Screenshots:** 33 | If applicable, add screenshots or photos to help explain your problem. 34 | 35 | **To help us to understand your situation, we would like to ask you for the following additional information:** 36 | - What Operating System and version are you using (e.g. Windows 11, macOS 12.0, Linux)? 37 | - In case you are using the Arduino IDE, What version of the Arduino IDE? 38 | - Did it work before?, If it worked before, what were the parameters that you modify? 39 | 40 | 41 | **Additional context:** 42 | Add any other context about the problem here that you think will help us to solve your problem. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feedback-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F408 Feddback or requests" 3 | about: Suggest an idea or improvement for this project 4 | title: 'ElectronicCats' 5 | labels: 'enhancement' 6 | --- 7 | 8 | **What idea or improvement has occurred to you?** 9 | 10 | **If you found an error:** 11 | 12 | Please describe clearly and concisely the problem you are aware of. 13 | 14 | 15 | **Have you already found a solution?** 16 | 17 | If you found a way to fix the problem please let us know. 18 | It would be very helpful if you put how it needs to be corrected. 19 | 20 | ***Thanks a lot*** -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: See if your issue is solved before creating a new one. 4 | about: Try to see if ther is an answer for yoru questions before you create a new issue. 5 | url: https://github.com/ElectronicCats/DAP-Cat-Programmer/issues?q=is%3Aissue+is%3Aclosed 6 | - name: ElectronicCats 7 | about: Contact us through our website 8 | url: https://electroniccats.com/contact/ -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 5 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 3 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - Bug 8 | - Quality 9 | - Feedback 10 | - Libraries 11 | - Feature request 12 | # Label to use when marking an issue as stale 13 | staleLabel: First warning 14 | # Comment to post when marking an issue as stale. Set to `false` to disable 15 | markComment: > 16 | This is a message to remind you that your request has been pending for 5 days and awaits your comments. 17 | 18 | Our agent would like to hear from you about your previous request to see if the difficulty 19 | you were facing has been resolved or if we can provide further assistance. 20 | Otherwise, if we do not hear back from you within the next three days, the issue will be closed. 21 | 22 | Kind regards, 23 | Electronic Cats Support Team 24 | # Comment to post when closing a stale issue. Set to `false` to disable 25 | closeComment: false 26 | # Limit to only `issues` or `pulls` 27 | only: issues 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # For PCBs designed using KiCad: http://www.kicad-pcb.org/ 2 | # Format documentation: http://kicad-pcb.org/help/file-formats/ 3 | 4 | # Temporary files 5 | *.000 6 | *.bak 7 | *.bck 8 | *.kicad_pcb-bak 9 | *.sch-bak 10 | *~ 11 | _autosave-* 12 | *.tmp 13 | *-save.pro 14 | *-save.kicad_pcb 15 | fp-info-cache 16 | 17 | # Netlist files (exported from Eeschema) 18 | *.net 19 | 20 | # Autorouter files (exported from Pcbnew) 21 | *.dsn 22 | *.ses 23 | 24 | # Exported BOM files 25 | *.xml 26 | *.csv 27 | 28 | .DS_Store 29 | 30 | hardware/fp-lib-table 31 | 32 | hardware/sym-lib-table 33 | 34 | *.dcm 35 | 36 | hardware/SWD_Cat_Programmer-backups/ 37 | -------------------------------------------------------------------------------- /Docs/Board_manager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronicCats/DAP-Cat-Programmer/2e1909c4d6b3f99846ce201478b7fc10fa055113/Docs/Board_manager.png -------------------------------------------------------------------------------- /Docs/Settings_IDE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronicCats/DAP-Cat-Programmer/2e1909c4d6b3f99846ce201478b7fc10fa055113/Docs/Settings_IDE.png -------------------------------------------------------------------------------- /Docs/dap_cat_programmer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronicCats/DAP-Cat-Programmer/2e1909c4d6b3f99846ce201478b7fc10fa055113/Docs/dap_cat_programmer.jpg -------------------------------------------------------------------------------- /Docs/executingGDB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronicCats/DAP-Cat-Programmer/2e1909c4d6b3f99846ce201478b7fc10fa055113/Docs/executingGDB.png -------------------------------------------------------------------------------- /Docs/flashComplete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronicCats/DAP-Cat-Programmer/2e1909c4d6b3f99846ce201478b7fc10fa055113/Docs/flashComplete.png -------------------------------------------------------------------------------- /Docs/openOCDRunning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronicCats/DAP-Cat-Programmer/2e1909c4d6b3f99846ce201478b7fc10fa055113/Docs/openOCDRunning.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 2.1, February 1999 3 | 4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | [This is the first released version of the Lesser GPL. It also counts 10 | as the successor of the GNU Library Public License, version 2, hence 11 | the version number 2.1.] 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your 16 | freedom to share and change it. By contrast, the GNU General Public 17 | Licenses are intended to guarantee your freedom to share and change 18 | free software--to make sure the software is free for all its users. 19 | 20 | This license, the Lesser General Public License, applies to some 21 | specially designated software packages--typically libraries--of the 22 | Free Software Foundation and other authors who decide to use it. You 23 | can use it too, but we suggest you first think carefully about whether 24 | this license or the ordinary General Public License is the better 25 | strategy to use in any particular case, based on the explanations below. 26 | 27 | When we speak of free software, we are referring to freedom of use, 28 | not price. Our General Public Licenses are designed to make sure that 29 | you have the freedom to distribute copies of free software (and charge 30 | for this service if you wish); that you receive source code or can get 31 | it if you want it; that you can change the software and use pieces of 32 | it in new free programs; and that you are informed that you can do 33 | these things. 34 | 35 | To protect your rights, we need to make restrictions that forbid 36 | distributors to deny you these rights or to ask you to surrender these 37 | rights. These restrictions translate to certain responsibilities for 38 | you if you distribute copies of the library or if you modify it. 39 | 40 | For example, if you distribute copies of the library, whether gratis 41 | or for a fee, you must give the recipients all the rights that we gave 42 | you. You must make sure that they, too, receive or can get the source 43 | code. If you link other code with the library, you must provide 44 | complete object files to the recipients, so that they can relink them 45 | with the library after making changes to the library and recompiling 46 | it. And you must show them these terms so they know their rights. 47 | 48 | We protect your rights with a two-step method: (1) we copyright the 49 | library, and (2) we offer you this license, which gives you legal 50 | permission to copy, distribute and/or modify the library. 51 | 52 | To protect each distributor, we want to make it very clear that 53 | there is no warranty for the free library. Also, if the library is 54 | modified by someone else and passed on, the recipients should know 55 | that what they have is not the original version, so that the original 56 | author's reputation will not be affected by problems that might be 57 | introduced by others. 58 | 59 | Finally, software patents pose a constant threat to the existence of 60 | any free program. We wish to make sure that a company cannot 61 | effectively restrict the users of a free program by obtaining a 62 | restrictive license from a patent holder. Therefore, we insist that 63 | any patent license obtained for a version of the library must be 64 | consistent with the full freedom of use specified in this license. 65 | 66 | Most GNU software, including some libraries, is covered by the 67 | ordinary GNU General Public License. This license, the GNU Lesser 68 | General Public License, applies to certain designated libraries, and 69 | is quite different from the ordinary General Public License. We use 70 | this license for certain libraries in order to permit linking those 71 | libraries into non-free programs. 72 | 73 | When a program is linked with a library, whether statically or using 74 | a shared library, the combination of the two is legally speaking a 75 | combined work, a derivative of the original library. The ordinary 76 | General Public License therefore permits such linking only if the 77 | entire combination fits its criteria of freedom. The Lesser General 78 | Public License permits more lax criteria for linking other code with 79 | the library. 80 | 81 | We call this license the "Lesser" General Public License because it 82 | does Less to protect the user's freedom than the ordinary General 83 | Public License. It also provides other free software developers Less 84 | of an advantage over competing non-free programs. These disadvantages 85 | are the reason we use the ordinary General Public License for many 86 | libraries. However, the Lesser license provides advantages in certain 87 | special circumstances. 88 | 89 | For example, on rare occasions, there may be a special need to 90 | encourage the widest possible use of a certain library, so that it becomes 91 | a de-facto standard. To achieve this, non-free programs must be 92 | allowed to use the library. A more frequent case is that a free 93 | library does the same job as widely used non-free libraries. In this 94 | case, there is little to gain by limiting the free library to free 95 | software only, so we use the Lesser General Public License. 96 | 97 | In other cases, permission to use a particular library in non-free 98 | programs enables a greater number of people to use a large body of 99 | free software. For example, permission to use the GNU C Library in 100 | non-free programs enables many more people to use the whole GNU 101 | operating system, as well as its variant, the GNU/Linux operating 102 | system. 103 | 104 | Although the Lesser General Public License is Less protective of the 105 | users' freedom, it does ensure that the user of a program that is 106 | linked with the Library has the freedom and the wherewithal to run 107 | that program using a modified version of the Library. 108 | 109 | The precise terms and conditions for copying, distribution and 110 | modification follow. Pay close attention to the difference between a 111 | "work based on the library" and a "work that uses the library". The 112 | former contains code derived from the library, whereas the latter must 113 | be combined with the library in order to run. 114 | 115 | GNU LESSER GENERAL PUBLIC LICENSE 116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 117 | 118 | 0. This License Agreement applies to any software library or other 119 | program which contains a notice placed by the copyright holder or 120 | other authorized party saying it may be distributed under the terms of 121 | this Lesser General Public License (also called "this License"). 122 | Each licensee is addressed as "you". 123 | 124 | A "library" means a collection of software functions and/or data 125 | prepared so as to be conveniently linked with application programs 126 | (which use some of those functions and data) to form executables. 127 | 128 | The "Library", below, refers to any such software library or work 129 | which has been distributed under these terms. A "work based on the 130 | Library" means either the Library or any derivative work under 131 | copyright law: that is to say, a work containing the Library or a 132 | portion of it, either verbatim or with modifications and/or translated 133 | straightforwardly into another language. (Hereinafter, translation is 134 | included without limitation in the term "modification".) 135 | 136 | "Source code" for a work means the preferred form of the work for 137 | making modifications to it. For a library, complete source code means 138 | all the source code for all modules it contains, plus any associated 139 | interface definition files, plus the scripts used to control compilation 140 | and installation of the library. 141 | 142 | Activities other than copying, distribution and modification are not 143 | covered by this License; they are outside its scope. The act of 144 | running a program using the Library is not restricted, and output from 145 | such a program is covered only if its contents constitute a work based 146 | on the Library (independent of the use of the Library in a tool for 147 | writing it). Whether that is true depends on what the Library does 148 | and what the program that uses the Library does. 149 | 150 | 1. You may copy and distribute verbatim copies of the Library's 151 | complete source code as you receive it, in any medium, provided that 152 | you conspicuously and appropriately publish on each copy an 153 | appropriate copyright notice and disclaimer of warranty; keep intact 154 | all the notices that refer to this License and to the absence of any 155 | warranty; and distribute a copy of this License along with the 156 | Library. 157 | 158 | You may charge a fee for the physical act of transferring a copy, 159 | and you may at your option offer warranty protection in exchange for a 160 | fee. 161 | 162 | 2. You may modify your copy or copies of the Library or any portion 163 | of it, thus forming a work based on the Library, and copy and 164 | distribute such modifications or work under the terms of Section 1 165 | above, provided that you also meet all of these conditions: 166 | 167 | a) The modified work must itself be a software library. 168 | 169 | b) You must cause the files modified to carry prominent notices 170 | stating that you changed the files and the date of any change. 171 | 172 | c) You must cause the whole of the work to be licensed at no 173 | charge to all third parties under the terms of this License. 174 | 175 | d) If a facility in the modified Library refers to a function or a 176 | table of data to be supplied by an application program that uses 177 | the facility, other than as an argument passed when the facility 178 | is invoked, then you must make a good faith effort to ensure that, 179 | in the event an application does not supply such function or 180 | table, the facility still operates, and performs whatever part of 181 | its purpose remains meaningful. 182 | 183 | (For example, a function in a library to compute square roots has 184 | a purpose that is entirely well-defined independent of the 185 | application. Therefore, Subsection 2d requires that any 186 | application-supplied function or table used by this function must 187 | be optional: if the application does not supply it, the square 188 | root function must still compute square roots.) 189 | 190 | These requirements apply to the modified work as a whole. If 191 | identifiable sections of that work are not derived from the Library, 192 | and can be reasonably considered independent and separate works in 193 | themselves, then this License, and its terms, do not apply to those 194 | sections when you distribute them as separate works. But when you 195 | distribute the same sections as part of a whole which is a work based 196 | on the Library, the distribution of the whole must be on the terms of 197 | this License, whose permissions for other licensees extend to the 198 | entire whole, and thus to each and every part regardless of who wrote 199 | it. 200 | 201 | Thus, it is not the intent of this section to claim rights or contest 202 | your rights to work written entirely by you; rather, the intent is to 203 | exercise the right to control the distribution of derivative or 204 | collective works based on the Library. 205 | 206 | In addition, mere aggregation of another work not based on the Library 207 | with the Library (or with a work based on the Library) on a volume of 208 | a storage or distribution medium does not bring the other work under 209 | the scope of this License. 210 | 211 | 3. You may opt to apply the terms of the ordinary GNU General Public 212 | License instead of this License to a given copy of the Library. To do 213 | this, you must alter all the notices that refer to this License, so 214 | that they refer to the ordinary GNU General Public License, version 2, 215 | instead of to this License. (If a newer version than version 2 of the 216 | ordinary GNU General Public License has appeared, then you can specify 217 | that version instead if you wish.) Do not make any other change in 218 | these notices. 219 | 220 | Once this change is made in a given copy, it is irreversible for 221 | that copy, so the ordinary GNU General Public License applies to all 222 | subsequent copies and derivative works made from that copy. 223 | 224 | This option is useful when you wish to copy part of the code of 225 | the Library into a program that is not a library. 226 | 227 | 4. You may copy and distribute the Library (or a portion or 228 | derivative of it, under Section 2) in object code or executable form 229 | under the terms of Sections 1 and 2 above provided that you accompany 230 | it with the complete corresponding machine-readable source code, which 231 | must be distributed under the terms of Sections 1 and 2 above on a 232 | medium customarily used for software interchange. 233 | 234 | If distribution of object code is made by offering access to copy 235 | from a designated place, then offering equivalent access to copy the 236 | source code from the same place satisfies the requirement to 237 | distribute the source code, even though third parties are not 238 | compelled to copy the source along with the object code. 239 | 240 | 5. A program that contains no derivative of any portion of the 241 | Library, but is designed to work with the Library by being compiled or 242 | linked with it, is called a "work that uses the Library". Such a 243 | work, in isolation, is not a derivative work of the Library, and 244 | therefore falls outside the scope of this License. 245 | 246 | However, linking a "work that uses the Library" with the Library 247 | creates an executable that is a derivative of the Library (because it 248 | contains portions of the Library), rather than a "work that uses the 249 | library". The executable is therefore covered by this License. 250 | Section 6 states terms for distribution of such executables. 251 | 252 | When a "work that uses the Library" uses material from a header file 253 | that is part of the Library, the object code for the work may be a 254 | derivative work of the Library even though the source code is not. 255 | Whether this is true is especially significant if the work can be 256 | linked without the Library, or if the work is itself a library. The 257 | threshold for this to be true is not precisely defined by law. 258 | 259 | If such an object file uses only numerical parameters, data 260 | structure layouts and accessors, and small macros and small inline 261 | functions (ten lines or less in length), then the use of the object 262 | file is unrestricted, regardless of whether it is legally a derivative 263 | work. (Executables containing this object code plus portions of the 264 | Library will still fall under Section 6.) 265 | 266 | Otherwise, if the work is a derivative of the Library, you may 267 | distribute the object code for the work under the terms of Section 6. 268 | Any executables containing that work also fall under Section 6, 269 | whether or not they are linked directly with the Library itself. 270 | 271 | 6. As an exception to the Sections above, you may also combine or 272 | link a "work that uses the Library" with the Library to produce a 273 | work containing portions of the Library, and distribute that work 274 | under terms of your choice, provided that the terms permit 275 | modification of the work for the customer's own use and reverse 276 | engineering for debugging such modifications. 277 | 278 | You must give prominent notice with each copy of the work that the 279 | Library is used in it and that the Library and its use are covered by 280 | this License. You must supply a copy of this License. If the work 281 | during execution displays copyright notices, you must include the 282 | copyright notice for the Library among them, as well as a reference 283 | directing the user to the copy of this License. Also, you must do one 284 | of these things: 285 | 286 | a) Accompany the work with the complete corresponding 287 | machine-readable source code for the Library including whatever 288 | changes were used in the work (which must be distributed under 289 | Sections 1 and 2 above); and, if the work is an executable linked 290 | with the Library, with the complete machine-readable "work that 291 | uses the Library", as object code and/or source code, so that the 292 | user can modify the Library and then relink to produce a modified 293 | executable containing the modified Library. (It is understood 294 | that the user who changes the contents of definitions files in the 295 | Library will not necessarily be able to recompile the application 296 | to use the modified definitions.) 297 | 298 | b) Use a suitable shared library mechanism for linking with the 299 | Library. A suitable mechanism is one that (1) uses at run time a 300 | copy of the library already present on the user's computer system, 301 | rather than copying library functions into the executable, and (2) 302 | will operate properly with a modified version of the library, if 303 | the user installs one, as long as the modified version is 304 | interface-compatible with the version that the work was made with. 305 | 306 | c) Accompany the work with a written offer, valid for at 307 | least three years, to give the same user the materials 308 | specified in Subsection 6a, above, for a charge no more 309 | than the cost of performing this distribution. 310 | 311 | d) If distribution of the work is made by offering access to copy 312 | from a designated place, offer equivalent access to copy the above 313 | specified materials from the same place. 314 | 315 | e) Verify that the user has already received a copy of these 316 | materials or that you have already sent this user a copy. 317 | 318 | For an executable, the required form of the "work that uses the 319 | Library" must include any data and utility programs needed for 320 | reproducing the executable from it. However, as a special exception, 321 | the materials to be distributed need not include anything that is 322 | normally distributed (in either source or binary form) with the major 323 | components (compiler, kernel, and so on) of the operating system on 324 | which the executable runs, unless that component itself accompanies 325 | the executable. 326 | 327 | It may happen that this requirement contradicts the license 328 | restrictions of other proprietary libraries that do not normally 329 | accompany the operating system. Such a contradiction means you cannot 330 | use both them and the Library together in an executable that you 331 | distribute. 332 | 333 | 7. You may place library facilities that are a work based on the 334 | Library side-by-side in a single library together with other library 335 | facilities not covered by this License, and distribute such a combined 336 | library, provided that the separate distribution of the work based on 337 | the Library and of the other library facilities is otherwise 338 | permitted, and provided that you do these two things: 339 | 340 | a) Accompany the combined library with a copy of the same work 341 | based on the Library, uncombined with any other library 342 | facilities. This must be distributed under the terms of the 343 | Sections above. 344 | 345 | b) Give prominent notice with the combined library of the fact 346 | that part of it is a work based on the Library, and explaining 347 | where to find the accompanying uncombined form of the same work. 348 | 349 | 8. You may not copy, modify, sublicense, link with, or distribute 350 | the Library except as expressly provided under this License. Any 351 | attempt otherwise to copy, modify, sublicense, link with, or 352 | distribute the Library is void, and will automatically terminate your 353 | rights under this License. However, parties who have received copies, 354 | or rights, from you under this License will not have their licenses 355 | terminated so long as such parties remain in full compliance. 356 | 357 | 9. You are not required to accept this License, since you have not 358 | signed it. However, nothing else grants you permission to modify or 359 | distribute the Library or its derivative works. These actions are 360 | prohibited by law if you do not accept this License. Therefore, by 361 | modifying or distributing the Library (or any work based on the 362 | Library), you indicate your acceptance of this License to do so, and 363 | all its terms and conditions for copying, distributing or modifying 364 | the Library or works based on it. 365 | 366 | 10. Each time you redistribute the Library (or any work based on the 367 | Library), the recipient automatically receives a license from the 368 | original licensor to copy, distribute, link with or modify the Library 369 | subject to these terms and conditions. You may not impose any further 370 | restrictions on the recipients' exercise of the rights granted herein. 371 | You are not responsible for enforcing compliance by third parties with 372 | this License. 373 | 374 | 11. If, as a consequence of a court judgment or allegation of patent 375 | infringement or for any other reason (not limited to patent issues), 376 | conditions are imposed on you (whether by court order, agreement or 377 | otherwise) that contradict the conditions of this License, they do not 378 | excuse you from the conditions of this License. If you cannot 379 | distribute so as to satisfy simultaneously your obligations under this 380 | License and any other pertinent obligations, then as a consequence you 381 | may not distribute the Library at all. For example, if a patent 382 | license would not permit royalty-free redistribution of the Library by 383 | all those who receive copies directly or indirectly through you, then 384 | the only way you could satisfy both it and this License would be to 385 | refrain entirely from distribution of the Library. 386 | 387 | If any portion of this section is held invalid or unenforceable under any 388 | particular circumstance, the balance of the section is intended to apply, 389 | and the section as a whole is intended to apply in other circumstances. 390 | 391 | It is not the purpose of this section to induce you to infringe any 392 | patents or other property right claims or to contest validity of any 393 | such claims; this section has the sole purpose of protecting the 394 | integrity of the free software distribution system which is 395 | implemented by public license practices. Many people have made 396 | generous contributions to the wide range of software distributed 397 | through that system in reliance on consistent application of that 398 | system; it is up to the author/donor to decide if he or she is willing 399 | to distribute software through any other system and a licensee cannot 400 | impose that choice. 401 | 402 | This section is intended to make thoroughly clear what is believed to 403 | be a consequence of the rest of this License. 404 | 405 | 12. If the distribution and/or use of the Library is restricted in 406 | certain countries either by patents or by copyrighted interfaces, the 407 | original copyright holder who places the Library under this License may add 408 | an explicit geographical distribution limitation excluding those countries, 409 | so that distribution is permitted only in or among countries not thus 410 | excluded. In such case, this License incorporates the limitation as if 411 | written in the body of this License. 412 | 413 | 13. The Free Software Foundation may publish revised and/or new 414 | versions of the Lesser General Public License from time to time. 415 | Such new versions will be similar in spirit to the present version, 416 | but may differ in detail to address new problems or concerns. 417 | 418 | Each version is given a distinguishing version number. If the Library 419 | specifies a version number of this License which applies to it and 420 | "any later version", you have the option of following the terms and 421 | conditions either of that version or of any later version published by 422 | the Free Software Foundation. If the Library does not specify a 423 | license version number, you may choose any version ever published by 424 | the Free Software Foundation. 425 | 426 | 14. If you wish to incorporate parts of the Library into other free 427 | programs whose distribution conditions are incompatible with these, 428 | write to the author to ask for permission. For software which is 429 | copyrighted by the Free Software Foundation, write to the Free 430 | Software Foundation; we sometimes make exceptions for this. Our 431 | decision will be guided by the two goals of preserving the free status 432 | of all derivatives of our free software and of promoting the sharing 433 | and reuse of software generally. 434 | 435 | NO WARRANTY 436 | 437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 446 | 447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 456 | DAMAGES. 457 | 458 | END OF TERMS AND CONDITIONS 459 | 460 | How to Apply These Terms to Your New Libraries 461 | 462 | If you develop a new library, and you want it to be of the greatest 463 | possible use to the public, we recommend making it free software that 464 | everyone can redistribute and change. You can do so by permitting 465 | redistribution under these terms (or, alternatively, under the terms of the 466 | ordinary General Public License). 467 | 468 | To apply these terms, attach the following notices to the library. It is 469 | safest to attach them to the start of each source file to most effectively 470 | convey the exclusion of warranty; and each file should have at least the 471 | "copyright" line and a pointer to where the full notice is found. 472 | 473 | 474 | Copyright (C) 475 | 476 | This library is free software; you can redistribute it and/or 477 | modify it under the terms of the GNU Lesser General Public 478 | License as published by the Free Software Foundation; either 479 | version 2.1 of the License, or (at your option) any later version. 480 | 481 | This library is distributed in the hope that it will be useful, 482 | but WITHOUT ANY WARRANTY; without even the implied warranty of 483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 484 | Lesser General Public License for more details. 485 | 486 | You should have received a copy of the GNU Lesser General Public 487 | License along with this library; if not, write to the Free Software 488 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 489 | USA 490 | 491 | Also add information on how to contact you by electronic and paper mail. 492 | 493 | You should also get your employer (if you work as a programmer) or your 494 | school, if any, to sign a "copyright disclaimer" for the library, if 495 | necessary. Here is a sample; alter the names: 496 | 497 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 498 | library `Frob' (a library for tweaking knobs) written by James Random 499 | Hacker. 500 | 501 | , 1 April 1990 502 | Ty Coon, President of Vice 503 | 504 | That's all there is to it! 505 | -------------------------------------------------------------------------------- /LICENSE_HARDWARE: -------------------------------------------------------------------------------- 1 | CERN Open Hardware Licence v1.2 2 | 3 | Preamble 4 | 5 | Through this CERN Open Hardware Licence ("CERN OHL") version 1.2, CERN 6 | wishes to provide a tool to foster collaboration and sharing among 7 | hardware designers. The CERN OHL is copyright CERN. Anyone is welcome 8 | to use the CERN OHL, in unmodified form only, for the distribution of 9 | their own Open Hardware designs. Any other right is reserved. Release 10 | of hardware designs under the CERN OHL does not constitute an 11 | endorsement of the licensor or its designs nor does it imply any 12 | involvement by CERN in the development of such designs. 13 | 14 | 1. Definitions 15 | 16 | In this Licence, the following terms have the following meanings: 17 | 18 | “Licence” means this CERN OHL. 19 | 20 | “Documentation” means schematic diagrams, designs, circuit or circuit 21 | board layouts, mechanical drawings, flow charts and descriptive text, 22 | and other explanatory material that is explicitly stated as being made 23 | available under the conditions of this Licence. The Documentation may 24 | be in any medium, including but not limited to computer files and 25 | representations on paper, film, or any other media. 26 | 27 | “Documentation Location” means a location where the Licensor has 28 | placed Documentation, and which he believes will be publicly 29 | accessible for at least three years from the first communication to 30 | the public or distribution of Documentation. 31 | 32 | “Product” means either an entire, or any part of a, device built using 33 | the Documentation or the modified Documentation. 34 | 35 | “Licensee” means any natural or legal person exercising rights under 36 | this Licence. 37 | 38 | “Licensor” means any natural or legal person that creates or modifies 39 | Documentation and subsequently communicates to the public and/ or 40 | distributes the resulting Documentation under the terms and conditions 41 | of this Licence. 42 | 43 | A Licensee may at the same time be a Licensor, and vice versa. 44 | 45 | Use of the masculine gender includes the feminine and neuter genders 46 | and is employed solely to facilitate reading. 47 | 48 | 2. Applicability 49 | 50 | 2.1. This Licence governs the use, copying, modification, 51 | communication to the public and distribution of the Documentation, and 52 | the manufacture and distribution of Products. By exercising any right 53 | granted under this Licence, the Licensee irrevocably accepts these 54 | terms and conditions. 55 | 56 | 2.2. This Licence is granted by the Licensor directly to the Licensee, 57 | and shall apply worldwide and without limitation in time. The Licensee 58 | may assign his licence rights or grant sub-licences. 59 | 60 | 2.3. This Licence does not extend to software, firmware, or code 61 | loaded into programmable devices which may be used in conjunction with 62 | the Documentation, the modified Documentation or with Products, unless 63 | such software, firmware, or code is explicitly expressed to be subject 64 | to this Licence. The use of such software, firmware, or code is 65 | otherwise subject to the applicable licence terms and conditions. 66 | 67 | 3. Copying, modification, communication to the public and distribution 68 | of the Documentation 69 | 70 | 3.1. The Licensee shall keep intact all copyright and trademarks 71 | notices, all notices referring to Documentation Location, and all 72 | notices that refer to this Licence and to the disclaimer of warranties 73 | that are included in the Documentation. He shall include a copy 74 | thereof in every copy of the Documentation or, as the case may be, 75 | modified Documentation, that he communicates to the public or 76 | distributes. 77 | 78 | 3.2. The Licensee may copy, communicate to the public and distribute 79 | verbatim copies of the Documentation, in any medium, subject to the 80 | requirements specified in section 3.1. 81 | 82 | 3.3. The Licensee may modify the Documentation or any portion thereof 83 | provided that upon modification of the Documentation, the Licensee 84 | shall make the modified Documentation available from a Documentation 85 | Location such that it can be easily located by an original Licensor 86 | once the Licensee communicates to the public or distributes the 87 | modified Documentation under section 3.4, and, where required by 88 | section 4.1, by a recipient of a Product. However, the Licensor shall 89 | not assert his rights under the foregoing proviso unless or until a 90 | Product is distributed. 91 | 92 | 3.4. The Licensee may communicate to the public and distribute the 93 | modified Documentation (thereby in addition to being a Licensee also 94 | becoming a Licensor), always provided that he shall: 95 | 96 | a) comply with section 3.1; 97 | 98 | b) cause the modified Documentation to carry prominent notices stating 99 | that the Licensee has modified the Documentation, with the date and 100 | description of the modifications; 101 | 102 | c) cause the modified Documentation to carry a new Documentation 103 | Location notice if the original Documentation provided for one; 104 | 105 | d) make available the modified Documentation at the same level of 106 | abstraction as that of the Documentation, in the preferred format for 107 | making modifications to it (e.g. the native format of the CAD tool as 108 | applicable), and in the event that format is proprietary, in a format 109 | viewable with a tool licensed under an OSI-approved license if the 110 | proprietary tool can create it; and 111 | 112 | e) license the modified Documentation under the terms and conditions 113 | of this Licence or, where applicable, a later version of this Licence 114 | as may be issued by CERN. 115 | 116 | 3.5. The Licence includes a non-exclusive licence to those patents or 117 | registered designs that are held by, under the control of, or 118 | sub-licensable by the Licensor, to the extent necessary to make use of 119 | the rights granted under this Licence. The scope of this section 3.5 120 | shall be strictly limited to the parts of the Documentation or 121 | modified Documentation created by the Licensor. 122 | 123 | 4. Manufacture and distribution of Products 124 | 125 | 4.1. The Licensee may manufacture or distribute Products always 126 | provided that, where such manufacture or distribution requires a 127 | licence under this Licence the Licensee provides to each recipient of 128 | such Products an easy means of accessing a copy of the Documentation 129 | or modified Documentation, as applicable, as set out in section 3. 130 | 131 | 4.2. The Licensee is invited to inform any Licensor who has indicated 132 | his wish to receive this information about the type, quantity and 133 | dates of production of Products the Licensee has (had) manufactured 134 | 135 | 5. Warranty and liability 136 | 137 | 5.1. DISCLAIMER – The Documentation and any modified Documentation are 138 | provided "as is" and any express or implied warranties, including, but 139 | not limited to, implied warranties of merchantability, of satisfactory 140 | quality, non-infringement of third party rights, and fitness for a 141 | particular purpose or use are disclaimed in respect of the 142 | Documentation, the modified Documentation or any Product. The Licensor 143 | makes no representation that the Documentation, modified 144 | Documentation, or any Product, does or will not infringe any patent, 145 | copyright, trade secret or other proprietary right. The entire risk as 146 | to the use, quality, and performance of a Product shall be with the 147 | Licensee and not the Licensor. This disclaimer of warranty is an 148 | essential part of this Licence and a condition for the grant of any 149 | rights granted under this Licence. The Licensee warrants that it does 150 | not act in a consumer capacity. 151 | 152 | 5.2. LIMITATION OF LIABILITY – The Licensor shall have no liability 153 | for direct, indirect, special, incidental, consequential, exemplary, 154 | punitive or other damages of any character including, without 155 | limitation, procurement of substitute goods or services, loss of use, 156 | data or profits, or business interruption, however caused and on any 157 | theory of contract, warranty, tort (including negligence), product 158 | liability or otherwise, arising in any way in relation to the 159 | Documentation, modified Documentation and/or the use, manufacture or 160 | distribution of a Product, even if advised of the possibility of such 161 | damages, and the Licensee shall hold the Licensor(s) free and harmless 162 | from any liability, costs, damages, fees and expenses, including 163 | claims by third parties, in relation to such use. 164 | 165 | 6. General 166 | 167 | 6.1. Except for the rights explicitly granted hereunder, this Licence 168 | does not imply or represent any transfer or assignment of intellectual 169 | property rights to the Licensee. 170 | 171 | 6.2. The Licensee shall not use or make reference to any of the names 172 | (including acronyms and abbreviations), images, or logos under which 173 | the Licensor is known, save in so far as required to comply with 174 | section 3. Any such permitted use or reference shall be factual and 175 | shall in no event suggest any kind of endorsement by the Licensor or 176 | its personnel of the modified Documentation or any Product, or any 177 | kind of implication by the Licensor or its personnel in the 178 | preparation of the modified Documentation or Product. 179 | 180 | 6.3. CERN may publish updated versions of this Licence which retain 181 | the same general provisions as this version, but differ in detail so 182 | far this is required and reasonable. New versions will be published 183 | with a unique version number. 184 | 185 | 6.4. This Licence shall terminate with immediate effect, upon written 186 | notice and without involvement of a court if the Licensee fails to 187 | comply with any of its terms and conditions, or if the Licensee 188 | initiates legal action against Licensor in relation to this 189 | Licence. Section 5 shall continue to apply. 190 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CMSIS-DAP Cat Programmer 2 | 3 | 4 |

5 | 6 |

7 |
8 | 9 |

10 | 11 | 12 | 13 | 14 | 15 | 16 |

17 | 18 | ## Description 19 | An Open-Source CMSIS-DAP Debug Probe based on DAPLink. DAP Cat Programmer is a low-cost $5.00 USD debug probe based on the CMSIS-DAP (also known as DAPLink) protocol standard and USB-Serial conversion, and it can realize USB conversion to serial interface. It can be used to program and debug the application software running on Arm Cortex Microcontrollers. 20 | 21 | The probe comes with indicator LEDs, a button to reset the target or trigger the firmware update, a reversible USB-C connector, and an easy-to-use 10-pin 2.54mm Header. 22 | 23 | ## Special Thanks 24 | 25 | - [Deqing Sun](https://github.com/DeqingSun) 26 | - CH552 Group in Telegram 27 | 28 | ## How to contribute 29 | Contributions are welcome! 30 | 31 | Please read the document [**Contribution Manual**](https://github.com/ElectronicCats/electroniccats-cla/blob/main/electroniccats-contribution-manual.md) which will show you how to contribute your changes to the project. 32 | 33 | ✨ Thanks to all our [contributors](https://github.com/ElectronicCats/Cat-Sink/graphs/contributors)! ✨ 34 | 35 | See [**_Electronic Cats CLA_**](https://github.com/ElectronicCats/electroniccats-cla/blob/main/electroniccats-cla.md) for more information. 36 | 37 | See the [**community code of conduct**](https://github.com/ElectronicCats/electroniccats-cla/blob/main/electroniccats-community-code-of-conduct.md) for a vision of the community we want to build and what we expect from it." 38 | 39 | 40 | ## License 41 | LGPL 42 | 43 | Electronic Cats invests time and resources providing this open source design, please support Electronic Cats and open-source hardware by purchasing products from Electronic Cats! 44 | 45 | Designed by Electronic Cats. 46 | 47 | Firmware released under an GNU LGPL v3.0 license. See the LICENSE file for more information. 48 | 49 | Hardware released under an CERN Open Hardware Licence v1.2. See the LICENSE_HARDWARE file for more information. 50 | 51 | Electronic Cats is a registered trademark, please do not use if you sell these PCBs. 52 | 53 | 29 Agu 2020 54 | -------------------------------------------------------------------------------- /firmware/CMSIS_DAP/CMSIS_DAP.ino: -------------------------------------------------------------------------------- 1 | /* 2 | CMSIS_DAP 3 | 4 | Modified form ljbfly's implementation, working but a lot to improve 5 | RST -> P30 6 | SWCLK -> P31 7 | SWDIO -> P32 8 | These pins works in OC mode with pull-up resistor (70K). Should be safe to connect 3.3V part. 9 | 10 | created 2020 11 | by Deqing Sun for use with CH55xduino 12 | 13 | This example code is in the public domain. 14 | 15 | */ 16 | 17 | //For windows user, if you ever played with other HID device with the same PID C55D 18 | //You may need to uninstall the previous driver completely 19 | 20 | 21 | #ifndef USER_USB_RAM 22 | #error "This example needs to be compiled with a USER USB setting" 23 | #endif 24 | 25 | #include "src/CMSIS_DAPusb/DAP.h" 26 | 27 | 28 | extern volatile __xdata uint8_t USBByteCountEP1; 29 | 30 | 31 | void setup() { 32 | USBInit(); 33 | } 34 | 35 | void loop() { 36 | uint8_t dapSendLength = 0; 37 | if (USBByteCountEP1) { 38 | dapSendLength = DAP_Thread(); 39 | USBByteCountEP1 = 0; 40 | 41 | UEP1_CTRL = UEP1_CTRL & ~ MASK_UEP_R_RES | UEP_R_RES_ACK; //enable receive 42 | 43 | UEP1_T_LEN = 64; 44 | UEP1_CTRL = UEP1_CTRL & ~ MASK_UEP_T_RES | UEP_T_RES_ACK; //enable send 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /firmware/CMSIS_DAP/src/CMSIS_DAPusb/DAP.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2017 ARM Limited. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * ---------------------------------------------------------------------- 19 | * 20 | * $Date: 1. December 2017 21 | * $Revision: V2.0.0 22 | * 23 | * Project: CMSIS-DAP Source 24 | * Title: DAP.c CMSIS-DAP Commands 25 | * 26 | *---------------------------------------------------------------------------*/ 27 | 28 | #include "DAP.h" 29 | 30 | // Get DAP Information 31 | // id: info identifier 32 | // info: pointer to info datas 33 | // return: number of bytes in info datas 34 | static uint8_t DAP_Info(uint8_t id, uint8_t *info) 35 | { 36 | uint8_t length = 0U; 37 | 38 | switch (id) 39 | { 40 | case DAP_ID_VENDOR: 41 | length = 0; 42 | break; 43 | case DAP_ID_PRODUCT: 44 | length = 0; 45 | break; 46 | case DAP_ID_SER_NUM: 47 | length = 0; 48 | break; 49 | case DAP_ID_FW_VER: 50 | length = (uint8_t)sizeof(DAP_FW_VER); 51 | memcpy(info, DAP_FW_VER, length); 52 | break; 53 | case DAP_ID_DEVICE_VENDOR: 54 | 55 | break; 56 | case DAP_ID_DEVICE_NAME: 57 | 58 | break; 59 | case DAP_ID_CAPABILITIES: 60 | info[0] = DAP_PORT_SWD; 61 | length = 1U; 62 | break; 63 | case DAP_ID_TIMESTAMP_CLOCK: 64 | 65 | break; 66 | case DAP_ID_SWO_BUFFER_SIZE: 67 | 68 | break; 69 | case DAP_ID_PACKET_SIZE: 70 | info[0] = (uint8_t)(DAP_PACKET_SIZE >> 0); 71 | info[1] = (uint8_t)(DAP_PACKET_SIZE >> 8); 72 | length = 2U; 73 | break; 74 | case DAP_ID_PACKET_COUNT: 75 | info[0] = DAP_PACKET_COUNT; 76 | length = 1U; 77 | break; 78 | default: 79 | break; 80 | } 81 | 82 | return (length); 83 | } 84 | 85 | // Process Delay command and prepare response 86 | // request: pointer to request datas 87 | // response: pointer to response datas 88 | // return: number of bytes in response (lower 16 bits) 89 | // number of bytes in request (upper 16 bits) 90 | static uint8_t DAP_Delay(const uint8_t *req, uint8_t *res) 91 | { 92 | uint16_t delay; 93 | 94 | delay = (uint16_t)(*(req + 0)) | 95 | (uint16_t)(*(req + 1) << 8); 96 | 97 | while (--delay) 98 | { 99 | }; 100 | 101 | *res = DAP_OK; 102 | return 1; 103 | } 104 | 105 | // Process Host Status command and prepare response 106 | // request: pointer to request datas 107 | // response: pointer to response datas 108 | // return: number of bytes in response (lower 16 bits) 109 | // number of bytes in request (upper 16 bits) 110 | static uint8_t DAP_HostStatus(const uint8_t *req, uint8_t *res) 111 | { 112 | 113 | switch (*req) 114 | { 115 | case DAP_DEBUGGER_CONNECTED: 116 | LED = ((*(req + 1) & 1U)); 117 | break; 118 | case DAP_TARGET_RUNNING: 119 | LED = ((*(req + 1) & 1U)); 120 | break; 121 | default: 122 | *res = DAP_ERROR; 123 | return 1; 124 | } 125 | 126 | *res = DAP_OK; 127 | return 1; 128 | } 129 | 130 | // Process Connect command and prepare response 131 | // request: pointer to request datas 132 | // response: pointer to response datas 133 | // return: number of bytes in response (lower 16 bits) 134 | // number of bytes in request (upper 16 bits) 135 | __idata uint8_t debug_port; 136 | static uint8_t DAP_Connect(const uint8_t *req, uint8_t *res) 137 | { 138 | uint8_t port; 139 | 140 | if (*req == DAP_PORT_AUTODETECT) 141 | { 142 | port = DAP_DEFAULT_PORT; 143 | } 144 | else 145 | { 146 | port = *req; 147 | } 148 | 149 | switch (port) 150 | { 151 | case DAP_PORT_SWD: 152 | debug_port = DAP_PORT_SWD; 153 | PORT_SWD_SETUP(); 154 | break; 155 | default: 156 | port = DAP_PORT_DISABLED; 157 | break; 158 | } 159 | 160 | *res = (uint8_t)port; 161 | return 1; 162 | } 163 | 164 | // Process Disconnect command and prepare response 165 | // response: pointer to response datas 166 | // return: number of bytes in response 167 | #define PORT_OFF() PORT_SWD_SETUP() 168 | static uint8_t DAP_Disconnect(uint8_t *res) 169 | { 170 | 171 | debug_port = DAP_PORT_DISABLED; 172 | PORT_OFF(); 173 | 174 | *res = DAP_OK; 175 | return (1U); 176 | } 177 | 178 | // Process Reset Target command and prepare response 179 | // response: pointer to response datas 180 | // return: number of bytes in response 181 | static uint8_t DAP_ResetTarget(uint8_t *res) 182 | { 183 | *(res + 1) = 0; //RESET_TARGET(); 184 | *(res + 0) = DAP_OK; 185 | return 2; 186 | } 187 | 188 | // Process SWJ Pins command and prepare response 189 | // request: pointer to request datas 190 | // response: pointer to response datas 191 | // return: number of bytes in response (lower 16 bits) 192 | // number of bytes in request (upper 16 bits) 193 | static uint8_t DAP_SWJ_Pins(const uint8_t *req, uint8_t *res) 194 | { 195 | uint8_t value; 196 | uint8_t select; 197 | uint16_t wait; 198 | 199 | value = (uint8_t) * (req + 0); 200 | select = (uint8_t) * (req + 1); 201 | wait = (uint16_t)(*(req + 2) << 0) | (uint16_t)(*(req + 3) << 8); 202 | if ((uint8_t)(*(req + 4)) || (uint8_t)(*(req + 5))) 203 | wait |= 0x8000; 204 | 205 | if ((select & DAP_SWJ_SWCLK_TCK_BIT) != 0U) 206 | { 207 | if ((value & DAP_SWJ_SWCLK_TCK_BIT) != 0U) 208 | { 209 | SWK = 1; 210 | } 211 | else 212 | { 213 | SWK = 0; 214 | } 215 | } 216 | if ((select & DAP_SWJ_SWDIO_TMS_BIT) != 0U) 217 | { 218 | if ((value & DAP_SWJ_SWDIO_TMS_BIT) != 0U) 219 | { 220 | SWD = 1; 221 | } 222 | else 223 | { 224 | SWD = 0; 225 | } 226 | } 227 | if ((select & DAP_SWJ_nRESET_BIT) != 0U) 228 | { 229 | RST = value >> DAP_SWJ_nRESET; 230 | } 231 | 232 | if (wait != 0U) 233 | { 234 | 235 | do 236 | { 237 | if ((select & DAP_SWJ_SWCLK_TCK_BIT) != 0U) 238 | { 239 | if ((value >> DAP_SWJ_SWCLK_TCK) ^ SWK) 240 | { 241 | continue; 242 | } 243 | } 244 | if ((select & DAP_SWJ_SWDIO_TMS_BIT) != 0U) 245 | { 246 | if ((value >> DAP_SWJ_SWDIO_TMS) ^ SWD) 247 | { 248 | continue; 249 | } 250 | } 251 | if ((select & DAP_SWJ_nRESET_BIT) != 0U) 252 | { 253 | if ((value >> DAP_SWJ_nRESET) ^ RST) 254 | { 255 | continue; 256 | } 257 | } 258 | break; 259 | } 260 | while (wait--); 261 | } 262 | 263 | value = ((uint8_t)SWK << DAP_SWJ_SWCLK_TCK) | 264 | ((uint8_t)SWD << DAP_SWJ_SWDIO_TMS) | 265 | (0 << DAP_SWJ_TDI) | 266 | (0 << DAP_SWJ_TDO) | 267 | (0 << DAP_SWJ_nTRST) | 268 | ((uint8_t)RST << DAP_SWJ_nRESET); 269 | 270 | *res = (uint8_t)value; 271 | 272 | return 1; 273 | } 274 | 275 | // Process SWJ Clock command and prepare response 276 | // request: pointer to request datas 277 | // response: pointer to response datas 278 | // return: number of bytes in response (lower 16 bits) 279 | // number of bytes in request (upper 16 bits) 280 | __xdata uint32_t fast_clock; 281 | __xdata uint8_t clock_delay; 282 | static uint8_t DAP_SWJ_Clock(const uint8_t *req, uint8_t *res) 283 | { 284 | /**/ 285 | fast_clock = *((uint32_t *)req); 286 | 287 | //Timer0 used for millis, Timer1 used for serial0 288 | //we can only use Timer2 289 | TR2=0; 290 | 291 | RCLK = 0; 292 | TCLK = 0; 293 | C_T2 = 0; 294 | 295 | //bTMR_CLK may be set by uart0, we keep it as is. 296 | T2MOD |= bTMR_CLK | bT2_CLK; //use Fsys for T2 297 | 298 | CP_RL2 = 0; 299 | 300 | if (fast_clock<(2*F_CPU/65536L)){ 301 | RCAP2L=0; 302 | RCAP2H=0; 303 | }else{ 304 | uint16_t reloadValueT2 = (uint16_t)(65536L-((F_CPU/2)/fast_clock)); 305 | RCAP2L = reloadValueT2&0xFF; 306 | RCAP2H = (reloadValueT2>>8)&0xFF; 307 | } 308 | TL2=RCAP2L; 309 | TH2=RCAP2H; 310 | 311 | TF2=0; 312 | TR2=1; 313 | 314 | clock_delay = 0; 315 | 316 | *res = DAP_OK; 317 | return 1; 318 | } 319 | 320 | // Process SWJ Sequence command and prepare response 321 | // request: pointer to request datas 322 | // response: pointer to response datas 323 | // return: number of bytes in response (lower 16 bits) 324 | // number of bytes in request (upper 16 bits) 325 | static uint8_t DAP_SWJ_Sequence(const uint8_t *req, uint8_t *res) 326 | { 327 | uint8_t count; 328 | 329 | count = *req++; 330 | if (count == 0U) 331 | { 332 | count = 255U; 333 | } 334 | 335 | SWJ_Sequence(count, req); 336 | *res = DAP_OK; 337 | 338 | return 1; 339 | } 340 | 341 | // Process SWD Configure command and prepare response 342 | // request: pointer to request datas 343 | // response: pointer to response datas 344 | // return: number of bytes in response (lower 16 bits) 345 | // number of bytes in request (upper 16 bits) 346 | __idata uint8_t turnaround; 347 | __idata uint8_t data_phase; 348 | static uint8_t DAP_SWD_Configure(const uint8_t *req, uint8_t *res) 349 | { 350 | uint8_t value; 351 | 352 | value = *req; 353 | turnaround = (value & 0x03U) + 1U; 354 | data_phase = (value & 0x04U) ? 1U : 0U; 355 | 356 | *res = DAP_OK; 357 | return 1; 358 | } 359 | 360 | // Process SWD Sequence command and prepare response 361 | // request: pointer to request datas 362 | // response: pointer to response datas 363 | // return: number of bytes in response (lower 16 bits) 364 | // number of bytes in request (upper 16 bits) 365 | static uint8_t DAP_SWD_Sequence(const uint8_t *req, uint8_t *res) 366 | { 367 | uint8_t sequence_info; 368 | uint8_t sequence_count; 369 | uint8_t request_count; 370 | uint8_t response_count; 371 | uint8_t count; 372 | 373 | *res++ = DAP_OK; 374 | 375 | request_count = 1U; 376 | response_count = 1U; 377 | 378 | sequence_count = *req++; 379 | while (sequence_count--) 380 | { 381 | sequence_info = *req++; 382 | count = sequence_info & SWD_SEQUENCE_CLK; 383 | if (count == 0U) 384 | { 385 | count = 64U; 386 | } 387 | count = (count + 7U) / 8U; 388 | if ((sequence_info & SWD_SEQUENCE_DIN) != 0U) 389 | { 390 | SWD = 1; 391 | } 392 | else 393 | { 394 | SWD = 1; 395 | } 396 | SWD_Sequence(sequence_info, req, res); 397 | if (sequence_count == 0U) 398 | { 399 | SWD = 1; 400 | } 401 | if ((sequence_info & SWD_SEQUENCE_DIN) != 0U) 402 | { 403 | request_count++; 404 | res += count; 405 | response_count += count; 406 | } 407 | else 408 | { 409 | req += count; 410 | request_count += count + 1U; 411 | } 412 | } 413 | 414 | return response_count; 415 | } 416 | 417 | // Process Transfer Configure command and prepare response 418 | // request: pointer to request datas 419 | // response: pointer to response datas 420 | // return: number of bytes in response (lower 16 bits) 421 | // number of bytes in request (upper 16 bits) 422 | __idata uint8_t idle_cycles; 423 | __idata uint16_t retry_count; 424 | __idata uint16_t match_retry; 425 | static uint8_t DAP_TransferConfigure(const uint8_t *req, uint8_t *res) 426 | { 427 | 428 | idle_cycles = *(req + 0); 429 | retry_count = (uint16_t) * (req + 1) | 430 | (uint16_t)(*(req + 2) << 8); 431 | match_retry = (uint16_t) * (req + 3) | 432 | (uint16_t)(*(req + 4) << 8); 433 | 434 | *res = DAP_OK; 435 | return 1; 436 | } 437 | 438 | // Process SWD Transfer command and prepare response 439 | // request: pointer to request datas 440 | // response: pointer to response datas 441 | // return: number of bytes in response (lower 16 bits) 442 | // number of bytes in request (upper 16 bits) 443 | 444 | __xdata uint8_t datas[4]; 445 | __idata uint8_t match_mask[4]; 446 | __idata uint8_t match_value[4]; 447 | __idata uint8_t DAP_TransferAbort = 0U; 448 | __idata uint8_t request_count; 449 | __idata uint8_t request_value; 450 | __idata uint8_t response_count; 451 | __idata uint8_t response_value; 452 | __idata uint16_t retry; 453 | static uint8_t DAP_SWD_Transfer(const uint8_t *req, uint8_t *res) 454 | { 455 | const uint8_t *request_head; 456 | uint8_t *response_head; 457 | 458 | uint8_t post_read; 459 | uint8_t check_write; 460 | 461 | request_head = req; 462 | 463 | response_count = 0U; 464 | response_value = 0U; 465 | response_head = res; 466 | res += 2; 467 | 468 | DAP_TransferAbort = 0U; 469 | 470 | post_read = 0U; 471 | check_write = 0U; 472 | 473 | req++; // Ignore DAP index 474 | 475 | request_count = *req++; 476 | for (; request_count != 0U; request_count--) 477 | { 478 | request_value = *req++; 479 | if ((request_value & DAP_TRANSFER_RnW) != 0U) 480 | { 481 | // Read registers 482 | if (post_read) 483 | { 484 | // Read was posted before 485 | retry = retry_count; 486 | if ((request_value & (DAP_TRANSFER_APnDP | DAP_TRANSFER_MATCH_VALUE)) == DAP_TRANSFER_APnDP) 487 | { 488 | // Read previous AP datas and post next AP read 489 | do 490 | { 491 | response_value = SWD_Transfer(request_value, datas); 492 | } 493 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 494 | } 495 | else 496 | { 497 | // Read previous AP datas 498 | do 499 | { 500 | response_value = SWD_Transfer(DP_RDBUFF | DAP_TRANSFER_RnW, datas); 501 | } 502 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 503 | post_read = 0U; 504 | } 505 | if (response_value != DAP_TRANSFER_OK) 506 | { 507 | break; 508 | } 509 | // Store previous AP datas 510 | *res++ = (uint8_t)datas[0]; 511 | *res++ = (uint8_t)datas[1]; 512 | *res++ = (uint8_t)datas[2]; 513 | *res++ = (uint8_t)datas[3]; 514 | } 515 | if ((request_value & DAP_TRANSFER_MATCH_VALUE) != 0U) 516 | { 517 | // Read with value match 518 | match_value[0] = (uint8_t)(*(req + 0)); 519 | match_value[1] = (uint8_t)(*(req + 1)); 520 | match_value[2] = (uint8_t)(*(req + 2)); 521 | match_value[3] = (uint8_t)(*(req + 3)); 522 | req += 4; 523 | match_retry = match_retry; 524 | if ((request_value & DAP_TRANSFER_APnDP) != 0U) 525 | { 526 | // Post AP read 527 | retry = retry_count; 528 | do 529 | { 530 | response_value = SWD_Transfer(request_value, NULL); 531 | } 532 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 533 | if (response_value != DAP_TRANSFER_OK) 534 | { 535 | break; 536 | } 537 | } 538 | do 539 | { 540 | // Read registers until its value matches or retry counter expires 541 | retry = retry_count; 542 | do 543 | { 544 | response_value = SWD_Transfer(request_value, datas); 545 | } 546 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 547 | if (response_value != DAP_TRANSFER_OK) 548 | { 549 | break; 550 | } 551 | } 552 | while (((datas[0] & match_mask[0]) != match_value[0] || 553 | (datas[1] & match_mask[1]) != match_value[1] || 554 | (datas[2] & match_mask[2]) != match_value[2] || 555 | (datas[3] & match_mask[3]) != match_value[3]) && 556 | match_retry-- && !DAP_TransferAbort); 557 | if ((datas[0] & match_mask[0]) != match_value[0] || 558 | (datas[1] & match_mask[1]) != match_value[1] || 559 | (datas[2] & match_mask[2]) != match_value[2] || 560 | (datas[3] & match_mask[3]) != match_value[3]) 561 | { 562 | response_value |= DAP_TRANSFER_MISMATCH; 563 | } 564 | if (response_value != DAP_TRANSFER_OK) 565 | { 566 | break; 567 | } 568 | } 569 | else 570 | { 571 | // Normal read 572 | retry = retry_count; 573 | if ((request_value & DAP_TRANSFER_APnDP) != 0U) 574 | { 575 | // Read AP registers 576 | if (post_read == 0U) 577 | { 578 | // Post AP read 579 | do 580 | { 581 | response_value = SWD_Transfer(request_value, NULL); 582 | } 583 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 584 | if (response_value != DAP_TRANSFER_OK) 585 | { 586 | break; 587 | } 588 | post_read = 1U; 589 | } 590 | } 591 | else 592 | { 593 | // Read DP register 594 | do 595 | { 596 | response_value = SWD_Transfer(request_value, datas); 597 | } 598 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 599 | if (response_value != DAP_TRANSFER_OK) 600 | { 601 | break; 602 | } 603 | 604 | // Store datas 605 | *res++ = datas[0]; 606 | *res++ = datas[1]; 607 | *res++ = datas[2]; 608 | *res++ = datas[3]; 609 | } 610 | } 611 | check_write = 0U; 612 | } 613 | else 614 | { 615 | // Write register 616 | if (post_read) 617 | { 618 | // Read previous datas 619 | retry = retry_count; 620 | do 621 | { 622 | response_value = SWD_Transfer(DP_RDBUFF | DAP_TRANSFER_RnW, datas); 623 | } 624 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 625 | if (response_value != DAP_TRANSFER_OK) 626 | { 627 | break; 628 | } 629 | // Store previous datas 630 | *res++ = datas[0]; 631 | *res++ = datas[1]; 632 | *res++ = datas[2]; 633 | *res++ = datas[3]; 634 | post_read = 0U; 635 | } 636 | // Load datas 637 | datas[0] = (uint8_t)(*(req + 0)); 638 | datas[1] = (uint8_t)(*(req + 1)); 639 | datas[2] = (uint8_t)(*(req + 2)); 640 | datas[3] = (uint8_t)(*(req + 3)); 641 | req += 4; 642 | if ((request_value & DAP_TRANSFER_MATCH_MASK) != 0U) 643 | { 644 | // Write match mask 645 | match_mask[0] = datas[0]; 646 | match_mask[1] = datas[1]; 647 | match_mask[2] = datas[2]; 648 | match_mask[3] = datas[3]; 649 | response_value = DAP_TRANSFER_OK; 650 | } 651 | else 652 | { 653 | // Write DP/AP register 654 | retry = retry_count; 655 | do 656 | { 657 | response_value = SWD_Transfer(request_value, datas); 658 | } 659 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 660 | if (response_value != DAP_TRANSFER_OK) 661 | { 662 | break; 663 | } 664 | 665 | check_write = 1U; 666 | } 667 | } 668 | response_count++; 669 | if (DAP_TransferAbort) 670 | { 671 | break; 672 | } 673 | } 674 | 675 | for (; request_count != 0U; request_count--) 676 | { 677 | // Process canceled requests 678 | request_value = *req++; 679 | if ((request_value & DAP_TRANSFER_RnW) != 0U) 680 | { 681 | // Read register 682 | if ((request_value & DAP_TRANSFER_MATCH_VALUE) != 0U) 683 | { 684 | // Read with value match 685 | req += 4; 686 | } 687 | } 688 | else 689 | { 690 | // Write register 691 | req += 4; 692 | } 693 | } 694 | 695 | if (response_value == DAP_TRANSFER_OK) 696 | { 697 | if (post_read) 698 | { 699 | // Read previous datas 700 | retry = retry_count; 701 | do 702 | { 703 | response_value = SWD_Transfer(DP_RDBUFF | DAP_TRANSFER_RnW, datas); 704 | } 705 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 706 | if (response_value != DAP_TRANSFER_OK) 707 | { 708 | goto end; 709 | } 710 | // Store previous datas 711 | *res++ = (uint8_t)datas[0]; 712 | *res++ = (uint8_t)datas[1]; 713 | *res++ = (uint8_t)datas[2]; 714 | *res++ = (uint8_t)datas[3]; 715 | } 716 | else if (check_write) 717 | { 718 | // Check last write 719 | retry = retry_count; 720 | do 721 | { 722 | response_value = SWD_Transfer(DP_RDBUFF | DAP_TRANSFER_RnW, NULL); 723 | } 724 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 725 | } 726 | } 727 | 728 | end: 729 | *(response_head + 0) = (uint8_t)response_count; 730 | *(response_head + 1) = (uint8_t)response_value; 731 | 732 | return ((uint8_t)(res - response_head)); 733 | } 734 | 735 | // Process Dummy Transfer command and prepare response 736 | // request: pointer to request datas 737 | // response: pointer to response datas 738 | // return: number of bytes in response (lower 16 bits) 739 | // number of bytes in request (upper 16 bits) 740 | //static uint8_t DAP_Dummy_Transfer(const uint8_t *req, uint8_t *res) 741 | //{ 742 | // uint8_t *request_head; 743 | // uint8_t request_count; 744 | // uint8_t request_value; 745 | 746 | // request_head = req; 747 | 748 | // req++; // Ignore DAP index 749 | 750 | // request_count = *req++; 751 | 752 | // for (; request_count != 0U; request_count--) 753 | // { 754 | // // Process dummy requests 755 | // request_value = *req++; 756 | // if ((request_value & DAP_TRANSFER_RnW) != 0U) 757 | // { 758 | // // Read registers 759 | // if ((request_value & DAP_TRANSFER_MATCH_VALUE) != 0U) 760 | // { 761 | // // Read with value match 762 | // req += 4; 763 | // } 764 | // } 765 | // else 766 | // { 767 | // // Write registers 768 | // req += 4; 769 | // } 770 | // } 771 | 772 | // *(res + 0) = 0U; // res count 773 | // *(res + 1) = 0U; // res value 774 | 775 | // return 2; 776 | //} 777 | 778 | // Process Transfer command and prepare response 779 | // request: pointer to request datas 780 | // response: pointer to response datas 781 | // return: number of bytes in response (lower 16 bits) 782 | // number of bytes in request (upper 16 bits) 783 | static uint8_t DAP_Transfer(const uint8_t *req, uint8_t *res) 784 | { 785 | uint8_t num = 0; 786 | 787 | // switch (debug_port) 788 | // { 789 | // case DAP_PORT_SWD: 790 | num = DAP_SWD_Transfer(req, res); 791 | // break; 792 | // default: 793 | // num = DAP_Dummy_Transfer(req, res); 794 | // break; 795 | // } 796 | 797 | return (num); 798 | } 799 | 800 | // Process SWD Transfer Block command and prepare response 801 | // request: pointer to request datas 802 | // response: pointer to response datas 803 | // return: number of bytes in response 804 | static uint8_t DAP_SWD_TransferBlock(const uint8_t *req, uint8_t *res) 805 | { 806 | 807 | uint8_t *response_head; 808 | response_count = 0U; 809 | response_value = 0U; 810 | response_head = res; 811 | res += 3; 812 | 813 | DAP_TransferAbort = 0U; 814 | 815 | req++; // Ignore DAP index 816 | 817 | request_count = (uint16_t)(*(req + 0) << 0) | 818 | (uint16_t)(*(req + 1) << 8); 819 | req += 2; 820 | if (request_count == 0U) 821 | { 822 | goto end; 823 | } 824 | 825 | request_value = *req++; 826 | if ((request_value & DAP_TRANSFER_RnW) != 0U) 827 | { 828 | // Read register block 829 | if ((request_value & DAP_TRANSFER_APnDP) != 0U) 830 | { 831 | // Post AP read 832 | retry = retry_count; 833 | do 834 | { 835 | response_value = SWD_Transfer(request_value, NULL); 836 | } 837 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 838 | if (response_value != DAP_TRANSFER_OK) 839 | { 840 | goto end; 841 | } 842 | } 843 | while (request_count--) 844 | { 845 | // Read DP/AP register 846 | if ((request_count == 0U) && ((request_value & DAP_TRANSFER_APnDP) != 0U)) 847 | { 848 | // Last AP read 849 | request_value = DP_RDBUFF | DAP_TRANSFER_RnW; 850 | } 851 | retry = retry_count; 852 | do 853 | { 854 | response_value = SWD_Transfer(request_value, datas); 855 | } 856 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 857 | if (response_value != DAP_TRANSFER_OK) 858 | { 859 | goto end; 860 | } 861 | // Store datas 862 | *res++ = (uint8_t)datas[0]; 863 | *res++ = (uint8_t)datas[1]; 864 | *res++ = (uint8_t)datas[2]; 865 | *res++ = (uint8_t)datas[3]; 866 | response_count++; 867 | } 868 | } 869 | else 870 | { 871 | // Write register block 872 | while (request_count--) 873 | { 874 | // Load datas 875 | datas[0] = (uint8_t)(*(req + 0)); 876 | datas[1] = (uint8_t)(*(req + 1)); 877 | datas[2] = (uint8_t)(*(req + 2)); 878 | datas[3] = (uint8_t)(*(req + 3)); 879 | 880 | req += 4; 881 | // Write DP/AP register 882 | retry = retry_count; 883 | do 884 | { 885 | response_value = SWD_Transfer(request_value, datas); 886 | } 887 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 888 | if (response_value != DAP_TRANSFER_OK) 889 | { 890 | goto end; 891 | } 892 | response_count++; 893 | } 894 | // Check last write 895 | retry = retry_count; 896 | do 897 | { 898 | response_value = SWD_Transfer(DP_RDBUFF | DAP_TRANSFER_RnW, NULL); 899 | } 900 | while ((response_value == DAP_TRANSFER_WAIT) && retry-- && !DAP_TransferAbort); 901 | } 902 | 903 | end: 904 | *(response_head + 0) = (uint8_t)(response_count >> 0); 905 | *(response_head + 1) = (uint8_t)(response_count >> 8); 906 | *(response_head + 2) = (uint8_t)response_value; 907 | 908 | return ((uint8_t)(res - response_head)); 909 | } 910 | 911 | // Process Transfer Block command and prepare response 912 | // request: pointer to request datas 913 | // response: pointer to response datas 914 | // return: number of bytes in response (lower 16 bits) 915 | // number of bytes in request (upper 16 bits) 916 | static uint8_t DAP_TransferBlock(const uint8_t *req, uint8_t *res) 917 | { 918 | uint8_t num; 919 | 920 | switch (debug_port) 921 | { 922 | case DAP_PORT_SWD: 923 | num = DAP_SWD_TransferBlock(req, res); 924 | break; 925 | 926 | default: 927 | *(res + 0) = 0U; // res count [7:0] 928 | *(res + 1) = 0U; // res count[15:8] 929 | *(res + 2) = 0U; // res value 930 | num = 3U; 931 | break; 932 | } 933 | 934 | if ((*(req + 3) & DAP_TRANSFER_RnW) != 0U) 935 | { 936 | // Read registers block 937 | num |= 4U << 16; 938 | } 939 | else 940 | { 941 | // Write registers block 942 | num |= (4U + (((uint8_t)(*(req + 1)) | (uint8_t)(*(req + 2) << 8)) * 4)) << 16; 943 | } 944 | 945 | return (num); 946 | } 947 | 948 | // Process SWD Write ABORT command and prepare response 949 | // request: pointer to request datas 950 | // response: pointer to response datas 951 | // return: number of bytes in response 952 | static uint8_t DAP_SWD_WriteAbort(const uint8_t *req, uint8_t *res) 953 | { 954 | // Load datas (Ignore DAP index) 955 | datas[0] = (uint8_t)(*(req + 1)); 956 | datas[1] = (uint8_t)(*(req + 2)); 957 | datas[2] = (uint8_t)(*(req + 3)); 958 | datas[3] = (uint8_t)(*(req + 4)); 959 | 960 | // Write Abort register 961 | SWD_Transfer(DP_ABORT, datas); 962 | 963 | *res = DAP_OK; 964 | return (1U); 965 | } 966 | 967 | // Process Write ABORT command and prepare response 968 | // request: pointer to request datas 969 | // response: pointer to response datas 970 | // return: number of bytes in response (lower 16 bits) 971 | // number of bytes in request (upper 16 bits) 972 | static uint8_t DAP_WriteAbort(const uint8_t *req, uint8_t *res) 973 | { 974 | uint8_t num; 975 | 976 | switch (debug_port) 977 | { 978 | case DAP_PORT_SWD: 979 | num = DAP_SWD_WriteAbort(req, res); 980 | break; 981 | 982 | default: 983 | *res = DAP_ERROR; 984 | num = 1U; 985 | break; 986 | } 987 | return num; 988 | } 989 | 990 | // DAP Thread. 991 | uint8_t DAP_Thread(void) 992 | { 993 | uint8_t num; 994 | uint8_t returnVal = 0; 995 | 996 | if (1) 997 | { 998 | uint8_t __xdata *req = &Ep1Buffer[0]; 999 | uint8_t __xdata *res = &Ep1Buffer[64]; 1000 | 1001 | *res++ = *req; 1002 | switch (*req++) 1003 | { 1004 | case ID_DAP_Transfer: 1005 | num = DAP_Transfer(req, res); 1006 | break; 1007 | 1008 | case ID_DAP_TransferBlock: 1009 | num = DAP_TransferBlock(req, res); 1010 | break; 1011 | 1012 | case ID_DAP_Info: 1013 | num = DAP_Info(*req, res + 1); 1014 | *res = (uint8_t)num; 1015 | num++; 1016 | break; 1017 | 1018 | case ID_DAP_HostStatus: 1019 | num = DAP_HostStatus(req, res); 1020 | break; 1021 | 1022 | case ID_DAP_Connect: 1023 | num = DAP_Connect(req, res); 1024 | break; 1025 | 1026 | case ID_DAP_Disconnect: 1027 | num = DAP_Disconnect(res); 1028 | break; 1029 | 1030 | case ID_DAP_Delay: 1031 | num = DAP_Delay(req, res); 1032 | break; 1033 | 1034 | case ID_DAP_ResetTarget: 1035 | num = DAP_ResetTarget(res); 1036 | break; 1037 | 1038 | case ID_DAP_SWJ_Pins: 1039 | num = DAP_SWJ_Pins(req, res); 1040 | break; 1041 | 1042 | case ID_DAP_SWJ_Clock: 1043 | num = DAP_SWJ_Clock(req, res); 1044 | break; 1045 | 1046 | case ID_DAP_SWJ_Sequence: 1047 | num = DAP_SWJ_Sequence(req, res); 1048 | break; 1049 | 1050 | case ID_DAP_SWD_Configure: 1051 | num = DAP_SWD_Configure(req, res); 1052 | break; 1053 | 1054 | case ID_DAP_SWD_Sequence: 1055 | num = DAP_SWD_Sequence(req, res); 1056 | break; 1057 | 1058 | case ID_DAP_TransferConfigure: 1059 | num = DAP_TransferConfigure(req, res); 1060 | break; 1061 | 1062 | case ID_DAP_WriteABORT: 1063 | num = DAP_WriteAbort(req, res); 1064 | break; 1065 | 1066 | case ID_DAP_ExecuteCommands: 1067 | case ID_DAP_QueueCommands: 1068 | default: 1069 | *(res - 1) = ID_DAP_Invalid; 1070 | num = 1; 1071 | break; 1072 | } 1073 | 1074 | returnVal = num + 1; 1075 | } 1076 | 1077 | return returnVal; 1078 | } 1079 | -------------------------------------------------------------------------------- /firmware/CMSIS_DAP/src/CMSIS_DAPusb/DAP.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2017 ARM Limited. All rights reserved. 3 | * 4 | * SPDX-License-Identifier: Apache-2.0 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * ---------------------------------------------------------------------- 19 | * 20 | * $Date: 1. December 2017 21 | * $Revision: V2.0.0 22 | * 23 | * Project: CMSIS-DAP Include 24 | * Title: DAP.h Definitions 25 | * 26 | *---------------------------------------------------------------------------*/ 27 | 28 | #ifndef __DAP_H__ 29 | #define __DAP_H__ 30 | 31 | #include "include/ch554.h" 32 | #include 33 | #include 34 | #include 35 | 36 | // DAP Firmware Version 37 | #define DAP_FW_VER "1.0.0" 38 | 39 | // DAP Command IDs 40 | #define ID_DAP_Info 0x00U 41 | #define ID_DAP_HostStatus 0x01U 42 | #define ID_DAP_Connect 0x02U 43 | #define ID_DAP_Disconnect 0x03U 44 | #define ID_DAP_TransferConfigure 0x04U 45 | #define ID_DAP_Transfer 0x05U 46 | #define ID_DAP_TransferBlock 0x06U 47 | #define ID_DAP_TransferAbort 0x07U 48 | #define ID_DAP_WriteABORT 0x08U 49 | #define ID_DAP_Delay 0x09U 50 | #define ID_DAP_ResetTarget 0x0AU 51 | #define ID_DAP_SWJ_Pins 0x10U 52 | #define ID_DAP_SWJ_Clock 0x11U 53 | #define ID_DAP_SWJ_Sequence 0x12U 54 | #define ID_DAP_SWD_Configure 0x13U 55 | #define ID_DAP_SWD_Sequence 0x1DU 56 | #define ID_DAP_JTAG_Sequence 0x14U 57 | #define ID_DAP_JTAG_Configure 0x15U 58 | #define ID_DAP_JTAG_IDCODE 0x16U 59 | #define ID_DAP_SWO_Transport 0x17U 60 | #define ID_DAP_SWO_Mode 0x18U 61 | #define ID_DAP_SWO_Baudrate 0x19U 62 | #define ID_DAP_SWO_Control 0x1AU 63 | #define ID_DAP_SWO_Status 0x1BU 64 | #define ID_DAP_SWO_ExtendedStatus 0x1EU 65 | #define ID_DAP_SWO_Data 0x1CU 66 | 67 | #define ID_DAP_QueueCommands 0x7EU 68 | #define ID_DAP_ExecuteCommands 0x7FU 69 | 70 | // DAP Vendor Command IDs 71 | #define ID_DAP_Vendor0 0x80U 72 | #define ID_DAP_Vendor1 0x81U 73 | #define ID_DAP_Vendor2 0x82U 74 | #define ID_DAP_Vendor3 0x83U 75 | #define ID_DAP_Vendor4 0x84U 76 | #define ID_DAP_Vendor5 0x85U 77 | #define ID_DAP_Vendor6 0x86U 78 | #define ID_DAP_Vendor7 0x87U 79 | #define ID_DAP_Vendor8 0x88U 80 | #define ID_DAP_Vendor9 0x89U 81 | #define ID_DAP_Vendor10 0x8AU 82 | #define ID_DAP_Vendor11 0x8BU 83 | #define ID_DAP_Vendor12 0x8CU 84 | #define ID_DAP_Vendor13 0x8DU 85 | #define ID_DAP_Vendor14 0x8EU 86 | #define ID_DAP_Vendor15 0x8FU 87 | #define ID_DAP_Vendor16 0x90U 88 | #define ID_DAP_Vendor17 0x91U 89 | #define ID_DAP_Vendor18 0x92U 90 | #define ID_DAP_Vendor19 0x93U 91 | #define ID_DAP_Vendor20 0x94U 92 | #define ID_DAP_Vendor21 0x95U 93 | #define ID_DAP_Vendor22 0x96U 94 | #define ID_DAP_Vendor23 0x97U 95 | #define ID_DAP_Vendor24 0x98U 96 | #define ID_DAP_Vendor25 0x99U 97 | #define ID_DAP_Vendor26 0x9AU 98 | #define ID_DAP_Vendor27 0x9BU 99 | #define ID_DAP_Vendor28 0x9CU 100 | #define ID_DAP_Vendor29 0x9DU 101 | #define ID_DAP_Vendor30 0x9EU 102 | #define ID_DAP_Vendor31 0x9FU 103 | 104 | #define ID_DAP_Invalid 0xFFU 105 | 106 | // DAP Status Code 107 | #define DAP_OK 0U 108 | #define DAP_ERROR 0xFFU 109 | 110 | // DAP ID 111 | #define DAP_ID_VENDOR 1U 112 | #define DAP_ID_PRODUCT 2U 113 | #define DAP_ID_SER_NUM 3U 114 | #define DAP_ID_FW_VER 4U 115 | #define DAP_ID_DEVICE_VENDOR 5U 116 | #define DAP_ID_DEVICE_NAME 6U 117 | #define DAP_ID_CAPABILITIES 0xF0U 118 | #define DAP_ID_TIMESTAMP_CLOCK 0xF1U 119 | #define DAP_ID_SWO_BUFFER_SIZE 0xFDU 120 | #define DAP_ID_PACKET_COUNT 0xFEU 121 | #define DAP_ID_PACKET_SIZE 0xFFU 122 | 123 | // DAP Host Status 124 | #define DAP_DEBUGGER_CONNECTED 0U 125 | #define DAP_TARGET_RUNNING 1U 126 | 127 | // DAP Port 128 | #define DAP_PORT_AUTODETECT 0U // Autodetect Port 129 | #define DAP_PORT_DISABLED 0U // Port Disabled (I/O pins in High-Z) 130 | #define DAP_PORT_SWD 1U // SWD Port (SWCLK, SWDIO) + nRESET 131 | #define DAP_PORT_JTAG 2U // JTAG Port (TCK, TMS, TDI, TDO, nTRST) + nRESET 132 | 133 | // DAP SWJ Pins 134 | #define DAP_SWJ_SWCLK_TCK 0 // SWCLK/TCK 135 | #define DAP_SWJ_SWDIO_TMS 1 // SWDIO/TMS 136 | #define DAP_SWJ_TDI 2 // TDI 137 | #define DAP_SWJ_TDO 3 // TDO 138 | #define DAP_SWJ_nTRST 5 // nTRST 139 | #define DAP_SWJ_nRESET 7 // nRESET 140 | 141 | #define DAP_SWJ_SWCLK_TCK_BIT 0x01 // SWCLK/TCK 142 | #define DAP_SWJ_SWDIO_TMS_BIT 0x02 // SWDIO/TMS 143 | #define DAP_SWJ_TDI_BIT 0x04 // TDI 144 | #define DAP_SWJ_TDO_BIT 0x08 // TDO 145 | #define DAP_SWJ_nTRST_BIT 0x20 // nTRST 146 | #define DAP_SWJ_nRESET_BIT 0x80 // nRESET 147 | 148 | // DAP Transfer Request 149 | #define DAP_TRANSFER_APnDP (1U << 0) 150 | #define DAP_TRANSFER_RnW (1U << 1) 151 | #define DAP_TRANSFER_A2 (1U << 2) 152 | #define DAP_TRANSFER_A3 (1U << 3) 153 | #define DAP_TRANSFER_MATCH_VALUE (1U << 4) 154 | #define DAP_TRANSFER_MATCH_MASK (1U << 5) 155 | #define DAP_TRANSFER_TIMESTAMP (1U << 7) 156 | 157 | // DAP Transfer Response 158 | #define DAP_TRANSFER_OK (1U << 0) 159 | #define DAP_TRANSFER_WAIT (1U << 1) 160 | #define DAP_TRANSFER_FAULT (1U << 2) 161 | #define DAP_TRANSFER_ERROR (1U << 3) 162 | #define DAP_TRANSFER_MISMATCH (1U << 4) 163 | 164 | // DAP SWO Trace Mode 165 | #define DAP_SWO_OFF 0U 166 | #define DAP_SWO_UART 1U 167 | #define DAP_SWO_MANCHESTER 2U 168 | 169 | // DAP SWO Trace Status 170 | #define DAP_SWO_CAPTURE_ACTIVE (1U << 0) 171 | #define DAP_SWO_CAPTURE_PAUSED (1U << 1) 172 | #define DAP_SWO_STREAM_ERROR (1U << 6) 173 | #define DAP_SWO_BUFFER_OVERRUN (1U << 7) 174 | 175 | // Debug Port Register Addresses 176 | #define DP_IDCODE 0x00U // IDCODE Register (SW Read only) 177 | #define DP_ABORT 0x00U // Abort Register (SW Write only) 178 | #define DP_CTRL_STAT 0x04U // Control & Status 179 | #define DP_WCR 0x04U // Wire Control Register (SW Only) 180 | #define DP_SELECT 0x08U // Select Register (JTAG R/W & SW W) 181 | #define DP_RESEND 0x08U // Resend (SW Read Only) 182 | #define DP_RDBUFF 0x0CU // Read Buffer (Read Only) 183 | 184 | // JTAG IR Codes 185 | #define JTAG_ABORT 0x08U 186 | #define JTAG_DPACC 0x0AU 187 | #define JTAG_APACC 0x0BU 188 | #define JTAG_IDCODE 0x0EU 189 | #define JTAG_BYPASS 0x0FU 190 | 191 | // JTAG Sequence Info 192 | #define JTAG_SEQUENCE_TCK 0x3FU // TCK count 193 | #define JTAG_SEQUENCE_TMS 0x40U // TMS value 194 | #define JTAG_SEQUENCE_TDO 0x80U // TDO capture 195 | 196 | // SWD Sequence Info 197 | #define SWD_SEQUENCE_CLK 0x3FU // SWCLK count 198 | #define SWD_SEQUENCE_DIN 0x80U // SWDIO capture 199 | 200 | #define DAP_PACKET_COUNT 1 201 | #define DAP_PACKET_SIZE 64 //THIS_ENDP0_SIZE 202 | #define DAP_DEFAULT_PORT DAP_PORT_SWD 203 | 204 | #define RST P3_0 205 | #define SWK P3_1 206 | #define SWD P3_2 207 | #define LED P3_3 208 | 209 | extern __xdata uint8_t Ep0Buffer[]; 210 | extern __xdata uint8_t Ep1Buffer[]; 211 | 212 | extern __idata uint8_t turnaround; 213 | extern __idata uint8_t data_phase; 214 | extern __idata uint8_t idle_cycles; 215 | 216 | extern uint8_t DAP_Thread(void); 217 | extern void PORT_SWD_SETUP(void); 218 | extern uint8_t SWD_Transfer(uint8_t reqI, uint8_t __xdata *datas); 219 | extern void SWJ_Sequence(uint8_t count, const uint8_t *datas); 220 | extern void SWD_Sequence(uint8_t info, const uint8_t *swdo, uint8_t *swdi); 221 | 222 | #endif /* __DAP_H__ */ 223 | -------------------------------------------------------------------------------- /firmware/CMSIS_DAP/src/CMSIS_DAPusb/SW_DP.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronicCats/DAP-Cat-Programmer/2e1909c4d6b3f99846ce201478b7fc10fa055113/firmware/CMSIS_DAP/src/CMSIS_DAPusb/SW_DP.c -------------------------------------------------------------------------------- /firmware/CMSIS_DAP/src/CMSIS_DAPusb/USBHID.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "include/ch554.h" 4 | #include "include/ch554_usb.h" 5 | #include "USBconstant.h" 6 | #include "USBhandler.h" 7 | 8 | extern __xdata uint8_t Ep0Buffer[]; 9 | extern __xdata uint8_t Ep1Buffer[]; 10 | 11 | volatile __xdata uint8_t USBByteCountEP1 = 0; //Bytes of received data on USB endpoint 12 | 13 | void USBInit(){ 14 | USBDeviceCfg(); //Device mode configuration 15 | USBDeviceEndPointCfg(); //Endpoint configuration 16 | USBDeviceIntCfg(); //Interrupt configuration 17 | UEP0_T_LEN = 0; 18 | UEP1_T_LEN = 0; //Pre-use send length must be cleared 19 | UEP2_T_LEN = 0; 20 | } 21 | 22 | 23 | void USB_EP1_IN(){ 24 | UEP1_T_LEN = 0; // No data to send anymore 25 | UEP1_CTRL = UEP1_CTRL & ~ MASK_UEP_T_RES | UEP_T_RES_NAK; //Respond NAK by default 26 | 27 | } 28 | 29 | void USB_EP1_OUT(){ 30 | if ( U_TOG_OK ){ // Discard unsynchronized packets 31 | USBByteCountEP1 = USB_RX_LEN; 32 | if (USBByteCountEP1){ 33 | UEP1_CTRL = UEP1_CTRL & ~ MASK_UEP_R_RES | UEP_R_RES_NAK; //Respond NAK after a packet. Let main code change response after handling. 34 | } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /firmware/CMSIS_DAP/src/CMSIS_DAPusb/USBHID.h: -------------------------------------------------------------------------------- 1 | #ifndef __USB_HID_H__ 2 | #define __USB_HID_H__ 3 | 4 | #include 5 | #include "include/ch554.h" 6 | #include "include/ch554_usb.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | void USBInit(void); 13 | 14 | #ifdef __cplusplus 15 | } // extern "C" 16 | #endif 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /firmware/CMSIS_DAP/src/CMSIS_DAPusb/USBconstant.c: -------------------------------------------------------------------------------- 1 | #include "USBconstant.h" 2 | 3 | 4 | //Device descriptor 5 | __code uint8_t DevDesc[] = { 6 | 0x12,0x01, 7 | 0x10,0x01, //USB spec release number in BCD format, USB1.1 (0x10, 0x01). 8 | 0x00,0x00,0x00, //bDeviceClass, bDeviceSubClass, bDeviceProtocol 9 | DEFAULT_ENDP0_SIZE, //PACKET_SIZE 10 | 0x09,0x12,0x5D,0xC5, // VID PID 11 | 0x00,0x01, //version 12 | 0x01,0x02,0x03, //bString 13 | 0x01 //bNumConfigurations 14 | }; 15 | 16 | __code uint16_t DevDescLen = sizeof(DevDesc); 17 | 18 | __code uint8_t CfgDesc[] ={ 19 | 0x09,0x02,sizeof(CfgDesc) & 0xff,sizeof(CfgDesc) >> 8, 20 | 0x01, /* bNumInterfaces */ 21 | 0x01, /* bConfigurationValue */ 22 | 0x00, /* iConfiguration */ 23 | 0x80, /* bmAttributes */ 24 | 0x64, /* MaxPower */ 25 | 26 | 27 | /* I/F descr: HID */ 28 | 0x09, /* bLength */ 29 | 0x04, /* bDescriptorType */ 30 | 0x00, /* bInterfaceNumber */ 31 | 0x00, /* bAlternateSetting */ 32 | 0x02, /* bNumEndpoints */ 33 | 0x03, /* bInterfaceClass */ 34 | 0x00, /* bInterfaceSubClass */ 35 | 0x00, /* bInterfaceProtocol */ 36 | 0x00, /* iInterface */ 37 | 38 | /* HID Descriptor */ 39 | 0x09, /* Size of this descriptor in UINT8s. */ 40 | 0x21, /* HID descriptor type. */ 41 | 0x10, 0x01, /* HID Class Spec. release number. */ 42 | 0x00, /* H/W target country. */ 43 | 0x01, /* Number of HID class descriptors to follow. */ 44 | 0x22, /* Descriptor type. */ 45 | sizeof(ReportDesc) & 0xff,sizeof(ReportDesc) >> 8, /* Total length of report descriptor. */ 46 | 47 | /* EP Descriptor: interrupt in. */ 48 | 0x07, /* bLength */ 49 | 0x05, /* bDescriptorType */ 50 | 0x01, /* bEndpointAddress */ 51 | 0x03, /* bmAttributes */ 52 | 0x40, 0x00, /* wMaxPacketSize */ 53 | 1, /* bInterval */ 54 | 55 | /* EP Descriptor: interrupt out. */ 56 | 0x07, /* bLength */ 57 | 0x05, /* bDescriptorType */ 58 | 0x81, /* bEndpointAddress */ 59 | 0x03, /* bmAttributes */ 60 | 0x40, 0x00, /* wMaxPacketSize */ 61 | 1 /* bInterval */ 62 | 63 | 64 | }; 65 | 66 | 67 | __code uint16_t ReportDescLen = sizeof(ReportDesc); 68 | 69 | __code uint8_t ReportDesc[] ={ 70 | 0x06, 0x00, 0xFF, // Usage Page = 0xFF00 (Vendor Defined Page 1) 71 | 0x09, 0x01, // Usage (Vendor Usage 1) 72 | 0xA1, 0x01, // Collection (Application) 73 | 0x19, 0x01, // Usage Minimum 74 | 0x29, 0x40, // Usage Maximum //64 input usages total (0x01 to 0x40) 75 | 0x15, 0x00, // Logical Minimum (data bytes in the report may have minimum value = 0x00) 76 | 0x26, 0xFF, 0x00, // Logical Maximum (data bytes in the report may have maximum value = 0x00FF = unsigned 255) 77 | 0x75, 0x08, // Report Size: 8-bit field size 78 | 0x95, 0x40, // Report Count: Make sixty-four 8-bit fields (the next time the parser hits an "Input", "Output", or "Feature" item) 79 | 0x81, 0x00, // Input (Data, Array, Abs): Instantiates input packet fields based on the above report size, count, logical min/max, and usage. 80 | 0x19, 0x01, // Usage Minimum 81 | 0x29, 0x40, // Usage Maximum //64 output usages total (0x01 to 0x40) 82 | 0x91, 0x00, // Output (Data, Array, Abs): Instantiates output packet fields. Uses same report size and count as "Input" fields, since nothing new/different was specified to the parser since the "Input" item. 83 | 0xC0 // End Collection 84 | }; 85 | 86 | __code uint16_t CfgDescLen = sizeof(CfgDesc); 87 | 88 | //String Descriptors 89 | __code uint8_t LangDes[]={0x04,0x03,0x09,0x04}; //Language Descriptor 90 | __code uint16_t LangDesLen = sizeof(LangDes); 91 | __code uint8_t SerDes[]={ //Serial String Descriptor 92 | 0x0C,0x03, 93 | 'C',0x00,'H',0x00,'5',0x00,'5',0x00,'x',0x00 94 | }; 95 | __code uint16_t SerDesLen = sizeof(SerDes); 96 | __code uint8_t Prod_Des[]={ //Produce String Descriptor 97 | 0x20,0x03, 98 | 'C',0x00,'H',0x00,'5',0x00,'5',0x00,'x',0x00,' ',0x00, 99 | 'C',0x00,'M',0x00,'S',0x00,'I',0x00,'S',0x00,'-',0x00 100 | ,'D',0x00,'A',0x00, 'P',0x00 101 | }; 102 | __code uint16_t Prod_DesLen = sizeof(Prod_Des); 103 | 104 | __code uint8_t Manuf_Des[]={ 105 | 0x1E,0x03, 106 | 'E',0x00,'l',0x00,'e',0x00,'c',0x00,'t',0x00,'r',0x00,'o',0x00,'n',0x00,'i',0x00,'c',0x00,'C',0x00,'a',0x00,'t',0x00,'s',0x00, 107 | }; 108 | __code uint16_t Manuf_DesLen = sizeof(Manuf_Des); 109 | -------------------------------------------------------------------------------- /firmware/CMSIS_DAP/src/CMSIS_DAPusb/USBconstant.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONST_DATA_H__ 2 | #define __CONST_DATA_H__ 3 | 4 | #include 5 | #include "include/ch554.h" 6 | #include "include/ch554_usb.h" 7 | 8 | #define EP0_ADDR 0 9 | #define EP1_ADDR 10 10 | #define EP2_ADDR 20 11 | 12 | extern __code uint8_t DevDesc[]; 13 | extern __code uint8_t CfgDesc[]; 14 | extern __code uint8_t LangDes[]; 15 | extern __code uint8_t ReportDesc[]; 16 | extern __code uint8_t SerDes[]; 17 | extern __code uint8_t Prod_Des[]; 18 | extern __code uint8_t Manuf_Des[]; 19 | 20 | extern __code uint16_t DevDescLen; 21 | extern __code uint16_t CfgDescLen; 22 | extern __code uint16_t LangDesLen; 23 | extern __code uint16_t ReportDescLen; 24 | extern __code uint16_t SerDesLen; 25 | extern __code uint16_t Prod_DesLen; 26 | extern __code uint16_t Manuf_DesLen; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /firmware/CMSIS_DAP/src/CMSIS_DAPusb/USBhandler.c: -------------------------------------------------------------------------------- 1 | #include "USBhandler.h" 2 | 3 | #include "USBconstant.h" 4 | 5 | //HID functions: 6 | void USB_EP1_IN(); 7 | void USB_EP1_OUT(); 8 | 9 | __xdata __at (EP0_ADDR) uint8_t Ep0Buffer[8]; 10 | __xdata __at (EP1_ADDR) uint8_t Ep1Buffer[128]; //on page 47 of data sheet, the receive buffer need to be min(possible packet size+2,64) //IN and OUT buffer, must be even address 11 | 12 | #if (EP1_ADDR+128) > USER_USB_RAM 13 | #error "This example needs more USB ram. Increase this setting in menu." 14 | #endif 15 | 16 | uint16_t SetupLen; 17 | uint8_t SetupReq,UsbConfig; 18 | 19 | __code uint8_t *pDescr; 20 | 21 | volatile uint8_t usbMsgFlags=0; // uint8_t usbMsgFlags copied from VUSB 22 | 23 | inline void NOP_Process(void) {} 24 | 25 | void USB_EP0_SETUP(){ 26 | uint8_t len = USB_RX_LEN; 27 | if(len == (sizeof(USB_SETUP_REQ))) 28 | { 29 | SetupLen = ((uint16_t)UsbSetupBuf->wLengthH<<8) | (UsbSetupBuf->wLengthL); 30 | len = 0; // Default is success and upload 0 length 31 | SetupReq = UsbSetupBuf->bRequest; 32 | usbMsgFlags = 0; 33 | if ( ( UsbSetupBuf->bRequestType & USB_REQ_TYP_MASK ) != USB_REQ_TYP_STANDARD )//Not standard request 34 | { 35 | 36 | //here is the commnunication starts, refer to usbFunctionSetup of USBtiny 37 | //or usb_setup in usbtiny 38 | 39 | switch( ( UsbSetupBuf->bRequestType & USB_REQ_TYP_MASK )) 40 | { 41 | case USB_REQ_TYP_VENDOR: 42 | { 43 | switch( SetupReq ) 44 | { 45 | default: 46 | len = 0xFF; //command not supported 47 | break; 48 | } 49 | break; 50 | } 51 | case USB_REQ_TYP_CLASS: 52 | { 53 | switch( SetupReq ) 54 | { 55 | default: 56 | len = 0xFF; //command not supported 57 | break; 58 | } 59 | break; 60 | } 61 | default: 62 | len = 0xFF; //command not supported 63 | break; 64 | } 65 | 66 | } 67 | else //Standard request 68 | { 69 | switch(SetupReq) //Request ccfType 70 | { 71 | case USB_GET_DESCRIPTOR: 72 | switch(UsbSetupBuf->wValueH) 73 | { 74 | case 1: //Device Descriptor 75 | pDescr = DevDesc; //Put Device Descriptor into outgoing buffer 76 | len = DevDescLen; 77 | break; 78 | case 2: //Configure Descriptor 79 | pDescr = CfgDesc; 80 | len = CfgDescLen; 81 | break; 82 | case 3: 83 | if(UsbSetupBuf->wValueL == 0) 84 | { 85 | pDescr = LangDes; 86 | len = LangDesLen; 87 | } 88 | else if(UsbSetupBuf->wValueL == 1) 89 | { 90 | pDescr = Manuf_Des; 91 | len = Manuf_DesLen; 92 | } 93 | else if(UsbSetupBuf->wValueL == 2) 94 | { 95 | pDescr = Prod_Des; 96 | len = Prod_DesLen; 97 | } 98 | else if(UsbSetupBuf->wValueL == 3) 99 | { 100 | pDescr = SerDes; 101 | len = SerDesLen; 102 | } 103 | else 104 | { 105 | pDescr = SerDes; 106 | len = SerDesLen; 107 | } 108 | break; 109 | case 0x22: 110 | if(UsbSetupBuf->wValueL == 0){ 111 | pDescr = ReportDesc; 112 | len = ReportDescLen; 113 | } 114 | else 115 | { 116 | len = 0xff; 117 | } 118 | break; 119 | default: 120 | len = 0xff; // Unsupported descriptors or error 121 | break; 122 | } 123 | if (len != 0xff){ 124 | if ( SetupLen > len ) 125 | { 126 | SetupLen = len; // Limit length 127 | } 128 | len = SetupLen >= DEFAULT_ENDP0_SIZE ? DEFAULT_ENDP0_SIZE : SetupLen; //transmit length for this packet 129 | for (uint8_t i=0;iwValueL; // Save the assigned address 138 | break; 139 | case USB_GET_CONFIGURATION: 140 | Ep0Buffer[0] = UsbConfig; 141 | if ( SetupLen >= 1 ) 142 | { 143 | len = 1; 144 | } 145 | break; 146 | case USB_SET_CONFIGURATION: 147 | UsbConfig = UsbSetupBuf->wValueL; 148 | break; 149 | case USB_GET_INTERFACE: 150 | break; 151 | case USB_SET_INTERFACE: 152 | break; 153 | case USB_CLEAR_FEATURE: //Clear Feature 154 | if( ( UsbSetupBuf->bRequestType & 0x1F ) == USB_REQ_RECIP_DEVICE ) // Clear the device featuee. 155 | { 156 | if( ( ( ( uint16_t )UsbSetupBuf->wValueH << 8 ) | UsbSetupBuf->wValueL ) == 0x01 ) 157 | { 158 | if( CfgDesc[ 7 ] & 0x20 ) 159 | { 160 | // wake up 161 | } 162 | else 163 | { 164 | len = 0xFF; //Failed 165 | } 166 | } 167 | else 168 | { 169 | len = 0xFF; //Failed 170 | } 171 | } 172 | else if ( ( UsbSetupBuf->bRequestType & USB_REQ_RECIP_MASK ) == USB_REQ_RECIP_ENDP )// endpoint 173 | { 174 | switch( UsbSetupBuf->wIndexL ) 175 | { 176 | case 0x84: 177 | UEP4_CTRL = UEP4_CTRL & ~ ( bUEP_T_TOG | MASK_UEP_T_RES ) | UEP_T_RES_NAK; 178 | break; 179 | case 0x04: 180 | UEP4_CTRL = UEP4_CTRL & ~ ( bUEP_R_TOG | MASK_UEP_R_RES ) | UEP_R_RES_ACK; 181 | break; 182 | case 0x83: 183 | UEP3_CTRL = UEP3_CTRL & ~ ( bUEP_T_TOG | MASK_UEP_T_RES ) | UEP_T_RES_NAK; 184 | break; 185 | case 0x03: 186 | UEP3_CTRL = UEP3_CTRL & ~ ( bUEP_R_TOG | MASK_UEP_R_RES ) | UEP_R_RES_ACK; 187 | break; 188 | case 0x82: 189 | UEP2_CTRL = UEP2_CTRL & ~ ( bUEP_T_TOG | MASK_UEP_T_RES ) | UEP_T_RES_NAK; 190 | break; 191 | case 0x02: 192 | UEP2_CTRL = UEP2_CTRL & ~ ( bUEP_R_TOG | MASK_UEP_R_RES ) | UEP_R_RES_ACK; 193 | break; 194 | case 0x81: 195 | UEP1_CTRL = UEP1_CTRL & ~ ( bUEP_T_TOG | MASK_UEP_T_RES ) | UEP_T_RES_NAK; 196 | break; 197 | case 0x01: 198 | UEP1_CTRL = UEP1_CTRL & ~ ( bUEP_R_TOG | MASK_UEP_R_RES ) | UEP_R_RES_ACK; 199 | break; 200 | default: 201 | len = 0xFF; // Unsupported endpoint 202 | break; 203 | } 204 | } 205 | else 206 | { 207 | len = 0xFF; // Unsupported for non-endpoint 208 | } 209 | break; 210 | case USB_SET_FEATURE: // Set Feature 211 | if( ( UsbSetupBuf->bRequestType & 0x1F ) == USB_REQ_RECIP_DEVICE ) // Set the device featuee. 212 | { 213 | if( ( ( ( uint16_t )UsbSetupBuf->wValueH << 8 ) | UsbSetupBuf->wValueL ) == 0x01 ) 214 | { 215 | if( CfgDesc[ 7 ] & 0x20 ) 216 | { 217 | // suspend 218 | 219 | //while ( XBUS_AUX & bUART0_TX ); //Wait till uart0 sending complete 220 | //SAFE_MOD = 0x55; 221 | //SAFE_MOD = 0xAA; 222 | //WAKE_CTRL = bWAK_BY_USB | bWAK_RXD0_LO | bWAK_RXD1_LO; //wake up by USB or RXD0/1 signal 223 | //PCON |= PD; //sleep 224 | //SAFE_MOD = 0x55; 225 | //SAFE_MOD = 0xAA; 226 | //WAKE_CTRL = 0x00; 227 | } 228 | else 229 | { 230 | len = 0xFF; // Failed 231 | } 232 | } 233 | else 234 | { 235 | len = 0xFF; // Failed 236 | } 237 | } 238 | else if( ( UsbSetupBuf->bRequestType & 0x1F ) == USB_REQ_RECIP_ENDP ) //endpoint 239 | { 240 | if( ( ( ( uint16_t )UsbSetupBuf->wValueH << 8 ) | UsbSetupBuf->wValueL ) == 0x00 ) 241 | { 242 | switch( ( ( uint16_t )UsbSetupBuf->wIndexH << 8 ) | UsbSetupBuf->wIndexL ) 243 | { 244 | case 0x84: 245 | UEP4_CTRL = UEP4_CTRL & (~bUEP_T_TOG) | UEP_T_RES_STALL;// Set endpoint4 IN STALL 246 | break; 247 | case 0x04: 248 | UEP4_CTRL = UEP4_CTRL & (~bUEP_R_TOG) | UEP_R_RES_STALL;// Set endpoint4 OUT Stall 249 | break; 250 | case 0x83: 251 | UEP3_CTRL = UEP3_CTRL & (~bUEP_T_TOG) | UEP_T_RES_STALL;// Set endpoint3 IN STALL 252 | break; 253 | case 0x03: 254 | UEP3_CTRL = UEP3_CTRL & (~bUEP_R_TOG) | UEP_R_RES_STALL;// Set endpoint3 OUT Stall 255 | break; 256 | case 0x82: 257 | UEP2_CTRL = UEP2_CTRL & (~bUEP_T_TOG) | UEP_T_RES_STALL;// Set endpoint2 IN STALL 258 | break; 259 | case 0x02: 260 | UEP2_CTRL = UEP2_CTRL & (~bUEP_R_TOG) | UEP_R_RES_STALL;// Set endpoint2 OUT Stall 261 | break; 262 | case 0x81: 263 | UEP1_CTRL = UEP1_CTRL & (~bUEP_T_TOG) | UEP_T_RES_STALL;// Set endpoint1 IN STALL 264 | break; 265 | case 0x01: 266 | UEP1_CTRL = UEP1_CTRL & (~bUEP_R_TOG) | UEP_R_RES_STALL;// Set endpoint1 OUT Stall 267 | default: 268 | len = 0xFF; // Failed 269 | break; 270 | } 271 | } 272 | else 273 | { 274 | len = 0xFF; // Failed 275 | } 276 | } 277 | else 278 | { 279 | len = 0xFF; // Failed 280 | } 281 | break; 282 | case USB_GET_STATUS: 283 | Ep0Buffer[0] = 0x00; 284 | Ep0Buffer[1] = 0x00; 285 | if ( SetupLen >= 2 ) 286 | { 287 | len = 2; 288 | } 289 | else 290 | { 291 | len = SetupLen; 292 | } 293 | break; 294 | default: 295 | len = 0xff; // Failed 296 | break; 297 | } 298 | } 299 | } 300 | else 301 | { 302 | len = 0xff; //Wrong packet length 303 | } 304 | if(len == 0xff) 305 | { 306 | SetupReq = 0xFF; 307 | UEP0_CTRL = bUEP_R_TOG | bUEP_T_TOG | UEP_R_RES_STALL | UEP_T_RES_STALL;//STALL 308 | } 309 | else if(len <= DEFAULT_ENDP0_SIZE) // Tx data to host or send 0-length packet 310 | { 311 | UEP0_T_LEN = len; 312 | UEP0_CTRL = bUEP_R_TOG | bUEP_T_TOG | UEP_R_RES_ACK | UEP_T_RES_ACK;//Expect DATA1, Answer ACK 313 | } 314 | else 315 | { 316 | UEP0_T_LEN = 0; // Tx data to host or send 0-length packet 317 | UEP0_CTRL = bUEP_R_TOG | bUEP_T_TOG | UEP_R_RES_ACK | UEP_T_RES_ACK;//Expect DATA1, Answer ACK 318 | } 319 | } 320 | 321 | void USB_EP0_IN(){ 322 | switch(SetupReq) 323 | { 324 | case USB_GET_DESCRIPTOR: 325 | { 326 | uint8_t len = SetupLen >= DEFAULT_ENDP0_SIZE ? DEFAULT_ENDP0_SIZE : SetupLen; //send length 327 | for (uint8_t i=0;i 5 | #include "include/ch554.h" 6 | #include "include/ch554_usb.h" 7 | #include "USBconstant.h" 8 | 9 | extern uint16_t SetupLen; 10 | extern uint8_t SetupReq,UsbConfig; 11 | extern const __code uint8_t *pDescr; 12 | 13 | 14 | #define UsbSetupBuf ((PUSB_SETUP_REQ)Ep0Buffer) 15 | 16 | // Out 17 | #define EP0_OUT_Callback USB_EP0_OUT 18 | #define EP1_OUT_Callback USB_EP1_OUT 19 | #define EP2_OUT_Callback NOP_Process 20 | #define EP3_OUT_Callback NOP_Process 21 | #define EP4_OUT_Callback NOP_Process 22 | 23 | // SOF 24 | #define EP0_SOF_Callback NOP_Process 25 | #define EP1_SOF_Callback NOP_Process 26 | #define EP2_SOF_Callback NOP_Process 27 | #define EP3_SOF_Callback NOP_Process 28 | #define EP4_SOF_Callback NOP_Process 29 | 30 | // IN 31 | #define EP0_IN_Callback USB_EP0_IN 32 | #define EP1_IN_Callback USB_EP1_IN 33 | #define EP2_IN_Callback NOP_Process 34 | #define EP3_IN_Callback NOP_Process 35 | #define EP4_IN_Callback NOP_Process 36 | 37 | // SETUP 38 | #define EP0_SETUP_Callback USB_EP0_SETUP 39 | #define EP1_SETUP_Callback NOP_Process 40 | #define EP2_SETUP_Callback NOP_Process 41 | #define EP3_SETUP_Callback NOP_Process 42 | #define EP4_SETUP_Callback NOP_Process 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | void USBInterrupt(void); 49 | void USBDeviceCfg(); 50 | void USBDeviceIntCfg(); 51 | void USBDeviceEndPointCfg(); 52 | 53 | #ifdef __cplusplus 54 | } // extern "C" 55 | #endif 56 | 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /firmware/UsbSerialAdaptor/UsbSerialAdaptor.ino: -------------------------------------------------------------------------------- 1 | /* 2 | UsbSerialAdaptor 3 | 4 | A simple example turns CH552 to a serial adaptor, 5 | relaying data between USB serial and Serial0. 6 | 7 | Baudrate of Serial0 is determined by USB serial's rate. 8 | 9 | created 2020 10 | by Deqing Sun for use with CH55xduino 11 | 12 | This example code is in the public domain. 13 | 14 | */ 15 | 16 | extern __xdata uint8_t LineCoding[]; //lineCoding of CDC is located in this array 17 | __xdata uint32_t oldBaudRate = 9600; 18 | 19 | void setup() { 20 | Serial0_begin(9600); 21 | } 22 | 23 | void loop() { 24 | while (USBSerial_available()) { 25 | char serialChar = USBSerial_read(); 26 | Serial0_write(serialChar); 27 | } 28 | while (Serial0_available()) { 29 | char serialChar = Serial0_read(); 30 | USBSerial_write(serialChar); 31 | } 32 | 33 | __xdata uint32_t currentBaudRate = *((__xdata uint32_t *)LineCoding); //both linecoding and sdcc are little-endian 34 | 35 | if (oldBaudRate != currentBaudRate) { 36 | oldBaudRate = currentBaudRate; 37 | Serial0_begin(currentBaudRate); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /hardware/KiCad/TS-1088R-02026.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | #SamacSys ECAD Model TS-1088R-02026 4 | #/7833497/297937/2.47/2/4/Switch 5 | DEF TS-1088R-02026 S 0 30 Y Y 1 F N 6 | F0 "S" 750 300 50 H V L CNN 7 | F1 "TS-1088R-02026" 750 200 50 H V L CNN 8 | F2 "TS1088R02026" 750 100 50 H I L CNN 9 | F3 "https://datasheet.lcsc.com/szlcsc/1912111437_XUNPU-TS-1088R-02026_C455280.pdf" 750 0 50 H I L CNN 10 | F4 "SMD,3x4x2.0mm Tactile Switches" 750 -100 50 H I L CNN "Description" 11 | F5 "2.2" 750 -200 50 H I L CNN "Height" 12 | F6 "XUNPU" 750 -300 50 H I L CNN "Manufacturer_Name" 13 | F7 "TS-1088R-02026" 750 -400 50 H I L CNN "Manufacturer_Part_Number" 14 | F8 "TS-1088R-02026" 750 -500 50 H I L CNN "Arrow Part Number" 15 | F9 "" 750 -600 50 H I L CNN "Arrow Price/Stock" 16 | F10 "" 750 -700 50 H I L CNN "Mouser Part Number" 17 | F11 "" 750 -800 50 H I L CNN "Mouser Price/Stock" 18 | DRAW 19 | X COM 1 0 0 200 R 50 50 0 0 P 20 | X NC 2 0 -100 200 R 50 50 0 0 N 21 | P 5 0 1 6 200 100 700 100 700 -200 200 -200 200 100 N 22 | ENDDRAW 23 | ENDDEF 24 | # 25 | #End Library 26 | -------------------------------------------------------------------------------- /hardware/KiCad/TS-1088R-02026.mod: -------------------------------------------------------------------------------- 1 | PCBNEW-LibModule-V1 2020-08-06 21:21:37 2 | # encoding utf-8 3 | Units mm 4 | $INDEX 5 | TS1088R02026 6 | $EndINDEX 7 | $MODULE TS1088R02026 8 | Po 0 0 0 15 5f2c6651 00000000 ~~ 9 | Li TS1088R02026 10 | Cd TS-1088R-02026-1 11 | Kw Switch 12 | Sc 0 13 | At SMD 14 | AR 15 | Op 0 0 0 16 | T0 0.000 -0 1.27 1.27 0 0.254 N V 21 N "S**" 17 | T1 0.000 -0 1.27 1.27 0 0.254 N I 21 N "TS1088R02026" 18 | DS -1.95 -1.465 1.95 -1.465 0.2 24 19 | DS 1.95 -1.465 1.95 1.465 0.2 24 20 | DS 1.95 1.465 -1.95 1.465 0.2 24 21 | DS -1.95 1.465 -1.95 -1.465 0.2 24 22 | DS -3.75 -2.465 3.75 -2.465 0.1 24 23 | DS 3.75 -2.465 3.75 2.465 0.1 24 24 | DS 3.75 2.465 -3.75 2.465 0.1 24 25 | DS -3.75 2.465 -3.75 -2.465 0.1 24 26 | DS -2 -1.465 1.95 -1.465 0.1 21 27 | DS -1.95 1.465 2 1.465 0.1 21 28 | $PAD 29 | Po -2.225 -0 30 | Sh "1" R 1.050 2.000 0 0 0 31 | At SMD N 00888000 32 | Ne 0 "" 33 | $EndPAD 34 | $PAD 35 | Po 2.225 -0 36 | Sh "2" R 1.050 2.000 0 0 0 37 | At SMD N 00888000 38 | Ne 0 "" 39 | $EndPAD 40 | $EndMODULE TS1088R02026 41 | $EndLIBRARY 42 | -------------------------------------------------------------------------------- /hardware/KiCad/TS1088R02026.kicad_mod: -------------------------------------------------------------------------------- 1 | (module "TS1088R02026" (layer F.Cu) 2 | (descr "TS-1088R-02026-1") 3 | (tags "Switch") 4 | (attr smd) 5 | (fp_text reference S** (at 0.000 -0) (layer F.SilkS) 6 | (effects (font (size 1.27 1.27) (thickness 0.254))) 7 | ) 8 | (fp_text user %R (at 0.000 -0) (layer F.Fab) 9 | (effects (font (size 1.27 1.27) (thickness 0.254))) 10 | ) 11 | (fp_text value "TS1088R02026" (at 0.000 -0) (layer F.SilkS) hide 12 | (effects (font (size 1.27 1.27) (thickness 0.254))) 13 | ) 14 | (fp_line (start -1.95 -1.465) (end 1.95 -1.465) (layer F.Fab) (width 0.2)) 15 | (fp_line (start 1.95 -1.465) (end 1.95 1.465) (layer F.Fab) (width 0.2)) 16 | (fp_line (start 1.95 1.465) (end -1.95 1.465) (layer F.Fab) (width 0.2)) 17 | (fp_line (start -1.95 1.465) (end -1.95 -1.465) (layer F.Fab) (width 0.2)) 18 | (fp_line (start -3.75 -2.465) (end 3.75 -2.465) (layer F.CrtYd) (width 0.1)) 19 | (fp_line (start 3.75 -2.465) (end 3.75 2.465) (layer F.CrtYd) (width 0.1)) 20 | (fp_line (start 3.75 2.465) (end -3.75 2.465) (layer F.CrtYd) (width 0.1)) 21 | (fp_line (start -3.75 2.465) (end -3.75 -2.465) (layer F.CrtYd) (width 0.1)) 22 | (fp_line (start -2 -1.465) (end 1.95 -1.465) (layer F.SilkS) (width 0.1)) 23 | (fp_line (start -1.95 1.465) (end 2 1.465) (layer F.SilkS) (width 0.1)) 24 | (pad 1 smd rect (at -2.225 -0 0) (size 1.050 2.000) (layers F.Cu F.Paste F.Mask)) 25 | (pad 2 smd rect (at 2.225 -0 0) (size 1.050 2.000) (layers F.Cu F.Paste F.Mask)) 26 | (model TS-1088R-02026.stp 27 | (at (xyz 0 0 0)) 28 | (scale (xyz 1 1 1)) 29 | (rotate (xyz 0 0 0)) 30 | ) 31 | ) 32 | -------------------------------------------------------------------------------- /hardware/SWD_Cat_Programmer-cache.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # Connector_Generic_Conn_01x05 5 | # 6 | DEF Connector_Generic_Conn_01x05 J 0 40 Y N 1 F N 7 | F0 "J" 0 300 50 H V C CNN 8 | F1 "Connector_Generic_Conn_01x05" 0 -300 50 H V C CNN 9 | F2 "" 0 0 50 H I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | $FPLIST 12 | Connector*:*_1x??_* 13 | $ENDFPLIST 14 | DRAW 15 | S -50 -195 0 -205 1 1 6 N 16 | S -50 -95 0 -105 1 1 6 N 17 | S -50 5 0 -5 1 1 6 N 18 | S -50 105 0 95 1 1 6 N 19 | S -50 205 0 195 1 1 6 N 20 | S -50 250 50 -250 1 1 10 f 21 | X Pin_1 1 -200 200 150 R 50 50 1 1 P 22 | X Pin_2 2 -200 100 150 R 50 50 1 1 P 23 | X Pin_3 3 -200 0 150 R 50 50 1 1 P 24 | X Pin_4 4 -200 -100 150 R 50 50 1 1 P 25 | X Pin_5 5 -200 -200 150 R 50 50 1 1 P 26 | ENDDRAW 27 | ENDDEF 28 | # 29 | # Connector_USB_C_Plug_USB2.0 30 | # 31 | DEF Connector_USB_C_Plug_USB2.0 P 0 40 Y Y 1 F N 32 | F0 "P" -400 750 50 H V L CNN 33 | F1 "Connector_USB_C_Plug_USB2.0" 500 750 50 H V R CNN 34 | F2 "" 150 0 50 H I C CNN 35 | F3 "" 150 0 50 H I C CNN 36 | $FPLIST 37 | USB*C*Plug* 38 | $ENDFPLIST 39 | DRAW 40 | A -275 -150 75 -1799 -1 0 1 20 N -350 -150 -200 -150 41 | A -275 -150 25 -1799 -1 0 1 10 N -300 -150 -250 -150 42 | A -275 -150 25 -1799 -1 0 1 10 F -300 -150 -250 -150 43 | A -275 150 25 1 1799 0 1 10 F -250 150 -300 150 44 | A -275 150 25 1 1799 0 1 10 N -250 150 -300 150 45 | A -275 150 75 1 1799 0 1 20 N -200 150 -350 150 46 | C -100 45 25 0 1 10 F 47 | C 0 -230 50 0 1 0 F 48 | S -10 -700 10 -660 0 0 0 N 49 | S 400 -90 360 -110 0 0 0 N 50 | S 400 110 360 90 0 0 0 N 51 | S 400 310 360 290 0 0 0 N 52 | S 400 410 360 390 0 0 0 N 53 | S 400 610 360 590 0 0 0 N 54 | S -400 700 400 -700 0 1 10 f 55 | S -300 -150 -250 150 0 1 10 F 56 | S 75 70 125 120 0 1 10 F 57 | P 2 0 1 20 -350 -150 -350 150 N 58 | P 2 0 1 20 -200 150 -200 -150 N 59 | P 2 0 1 20 0 -230 0 170 N 60 | P 3 0 1 20 0 -130 -100 -30 -100 20 N 61 | P 3 0 1 20 0 -80 100 20 100 70 N 62 | P 4 0 1 10 -50 170 0 270 50 170 -50 170 F 63 | X GND A1 0 -900 200 U 50 50 1 1 W 64 | X GND A12 0 -900 200 U 50 50 1 1 P N 65 | X VBUS A4 600 600 200 L 50 50 1 1 W 66 | X CC A5 600 400 200 L 50 50 1 1 B 67 | X D+ A6 600 -100 200 L 50 50 1 1 B 68 | X D- A7 600 100 200 L 50 50 1 1 B 69 | X VBUS A9 600 600 200 L 50 50 1 1 P N 70 | X GND B1 0 -900 200 U 50 50 1 1 P N 71 | X GND B12 0 -900 200 U 50 50 1 1 P N 72 | X VBUS B4 600 600 200 L 50 50 1 1 P N 73 | X VCONN B5 600 300 200 L 50 50 1 1 B 74 | X VBUS B9 600 600 200 L 50 50 1 1 P N 75 | X SHIELD S1 -300 -900 200 U 50 50 1 1 P 76 | ENDDRAW 77 | ENDDEF 78 | # 79 | # Device_C_Small 80 | # 81 | DEF Device_C_Small C 0 10 N N 1 F N 82 | F0 "C" 10 70 50 H V L CNN 83 | F1 "Device_C_Small" 10 -80 50 H V L CNN 84 | F2 "" 0 0 50 H I C CNN 85 | F3 "" 0 0 50 H I C CNN 86 | $FPLIST 87 | C_* 88 | $ENDFPLIST 89 | DRAW 90 | P 2 0 1 13 -60 -20 60 -20 N 91 | P 2 0 1 12 -60 20 60 20 N 92 | X ~ 1 0 100 80 D 50 50 1 1 P 93 | X ~ 2 0 -100 80 U 50 50 1 1 P 94 | ENDDRAW 95 | ENDDEF 96 | # 97 | # Device_LED 98 | # 99 | DEF Device_LED D 0 40 N N 1 F N 100 | F0 "D" 0 100 50 H V C CNN 101 | F1 "Device_LED" 0 -100 50 H V C CNN 102 | F2 "" 0 0 50 H I C CNN 103 | F3 "" 0 0 50 H I C CNN 104 | $FPLIST 105 | LED* 106 | LED_SMD:* 107 | LED_THT:* 108 | $ENDFPLIST 109 | DRAW 110 | P 2 0 1 10 -50 -50 -50 50 N 111 | P 2 0 1 0 -50 0 50 0 N 112 | P 4 0 1 10 50 -50 50 50 -50 0 50 -50 N 113 | P 5 0 1 0 -120 -30 -180 -90 -150 -90 -180 -90 -180 -60 N 114 | P 5 0 1 0 -70 -30 -130 -90 -100 -90 -130 -90 -130 -60 N 115 | X K 1 -150 0 100 R 50 50 1 1 P 116 | X A 2 150 0 100 L 50 50 1 1 P 117 | ENDDRAW 118 | ENDDEF 119 | # 120 | # Device_R_Small 121 | # 122 | DEF Device_R_Small R 0 10 N N 1 F N 123 | F0 "R" 30 20 50 H V L CNN 124 | F1 "Device_R_Small" 30 -40 50 H V L CNN 125 | F2 "" 0 0 50 H I C CNN 126 | F3 "" 0 0 50 H I C CNN 127 | $FPLIST 128 | R_* 129 | $ENDFPLIST 130 | DRAW 131 | S -30 70 30 -70 0 1 8 N 132 | X ~ 1 0 100 30 D 50 50 1 1 P 133 | X ~ 2 0 -100 30 U 50 50 1 1 P 134 | ENDDRAW 135 | ENDDEF 136 | # 137 | # Jumper_Jumper_3_Bridged12 138 | # 139 | DEF Jumper_Jumper_3_Bridged12 JP 0 0 Y N 1 F N 140 | F0 "JP" -100 -100 50 H V C CNN 141 | F1 "Jumper_Jumper_3_Bridged12" 0 110 50 H V C CNN 142 | F2 "" 0 0 50 H I C CNN 143 | F3 "" 0 0 50 H I C CNN 144 | $FPLIST 145 | Jumper* 146 | TestPoint*3Pads* 147 | TestPoint*Bridge* 148 | $ENDFPLIST 149 | DRAW 150 | A -65 -50 89 1282 518 0 1 0 N -120 20 -10 20 151 | C -130 0 20 0 0 0 N 152 | C 0 0 20 0 0 0 N 153 | C 130 0 20 0 0 0 N 154 | P 2 0 1 0 0 -50 0 -20 N 155 | X A 1 -250 0 100 R 50 50 1 1 P 156 | X C 2 0 -150 100 U 50 50 1 1 I 157 | X B 3 250 0 100 L 50 50 1 1 P 158 | ENDDRAW 159 | ENDDEF 160 | # 161 | # Regulator_Linear_AP2112K-3.3 162 | # 163 | DEF Regulator_Linear_AP2112K-3.3 U 0 10 Y Y 1 F N 164 | F0 "U" -200 225 50 H V L CNN 165 | F1 "Regulator_Linear_AP2112K-3.3" 0 225 50 H V L CNN 166 | F2 "Package_TO_SOT_SMD:SOT-23-5" 0 325 50 H I C CNN 167 | F3 "" 0 100 50 H I C CNN 168 | ALIAS AP2204K-1.8 AP2204K-2.5 AP2204K-2.8 AP2204K-3.0 AP2204K-3.3 AP2204K-5.0 AP2127K-1.0 AP2127K-1.2 AP2127K-1.5 AP2127K-1.8 AP2127K-2.5 AP2127K-2.8 AP2127K-3.0 AP2127K-3.3 AP2127K-4.2 AP2127K-4.75 AP2112K-1.2 AP2112K-1.8 AP2112K-2.5 AP2112K-2.6 AP2112K-3.3 169 | $FPLIST 170 | SOT?23?5* 171 | $ENDFPLIST 172 | DRAW 173 | S -200 175 200 -200 0 1 10 f 174 | X VIN 1 -300 100 100 R 50 50 1 1 W 175 | X GND 2 0 -300 100 U 50 50 1 1 W 176 | X EN 3 -300 0 100 R 50 50 1 1 I 177 | X NC 4 300 0 100 L 50 50 1 1 N N 178 | X VOUT 5 300 100 100 L 50 50 1 1 w 179 | ENDDRAW 180 | ENDDEF 181 | # 182 | # SWD_Cat_Programmer-rescue_CH552G-Electronic_Cats-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue 183 | # 184 | DEF SWD_Cat_Programmer-rescue_CH552G-Electronic_Cats-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue U 0 40 Y Y 1 F N 185 | F0 "U" -150 -1050 50 H V C CNN 186 | F1 "SWD_Cat_Programmer-rescue_CH552G-Electronic_Cats-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue" 100 300 50 H V C CNN 187 | F2 "" 0 0 50 H I C CNN 188 | F3 "" 0 0 50 H I C CNN 189 | DRAW 190 | S -200 250 250 -1000 0 1 0 f 191 | X P3.2 1 350 -750 100 L 50 50 1 1 I 192 | X P3.3 10 350 -650 100 L 50 50 1 1 I 193 | X P3.4 11 350 -550 100 L 50 50 1 1 I 194 | X P3.6 12 350 -450 100 L 50 50 1 1 I 195 | X P3.7 13 350 -350 100 L 50 50 1 1 I 196 | X GND 14 -300 -850 100 R 50 50 1 1 I 197 | X VCC 15 -300 -300 100 R 50 50 1 1 I 198 | X V33 16 -300 -50 100 R 50 50 1 1 I 199 | X P1.4 2 350 -100 100 L 50 50 1 1 I 200 | X P1.5 3 350 0 100 L 50 50 1 1 I 201 | X P1.6 4 350 100 100 L 50 50 1 1 I 202 | X P1.7 5 350 200 100 L 50 50 1 1 I 203 | X RST 6 -300 200 100 R 50 50 1 1 I 204 | X P3.1 7 350 -850 100 L 50 50 1 1 I 205 | X P3.0 8 350 -950 100 L 50 50 1 1 I 206 | X P1.1 9 350 -200 100 L 50 50 1 1 I 207 | ENDDRAW 208 | ENDDEF 209 | # 210 | # Switch_SW_Push 211 | # 212 | DEF Switch_SW_Push SW 0 40 N N 1 F N 213 | F0 "SW" 50 100 50 H V L CNN 214 | F1 "Switch_SW_Push" 0 -60 50 H V C CNN 215 | F2 "" 0 200 50 H I C CNN 216 | F3 "" 0 200 50 H I C CNN 217 | DRAW 218 | C -80 0 20 0 1 0 N 219 | C 80 0 20 0 1 0 N 220 | P 2 0 1 0 0 50 0 120 N 221 | P 2 0 1 0 100 50 -100 50 N 222 | X 1 1 -200 0 100 R 50 50 0 1 P 223 | X 2 2 200 0 100 L 50 50 0 1 P 224 | ENDDRAW 225 | ENDDEF 226 | # 227 | # power_+3V3 228 | # 229 | DEF power_+3V3 #PWR 0 0 Y Y 1 F P 230 | F0 "#PWR" 0 -150 50 H I C CNN 231 | F1 "power_+3V3" 0 140 50 H V C CNN 232 | F2 "" 0 0 50 H I C CNN 233 | F3 "" 0 0 50 H I C CNN 234 | ALIAS +3.3V 235 | DRAW 236 | P 2 0 1 0 -30 50 0 100 N 237 | P 2 0 1 0 0 0 0 100 N 238 | P 2 0 1 0 0 100 30 50 N 239 | X +3V3 1 0 0 0 U 50 50 1 1 W N 240 | ENDDRAW 241 | ENDDEF 242 | # 243 | # power_+5V 244 | # 245 | DEF power_+5V #PWR 0 0 Y Y 1 F P 246 | F0 "#PWR" 0 -150 50 H I C CNN 247 | F1 "power_+5V" 0 140 50 H V C CNN 248 | F2 "" 0 0 50 H I C CNN 249 | F3 "" 0 0 50 H I C CNN 250 | DRAW 251 | P 2 0 1 0 -30 50 0 100 N 252 | P 2 0 1 0 0 0 0 100 N 253 | P 2 0 1 0 0 100 30 50 N 254 | X +5V 1 0 0 0 U 50 50 1 1 W N 255 | ENDDRAW 256 | ENDDEF 257 | # 258 | # power_GND 259 | # 260 | DEF power_GND #PWR 0 0 Y Y 1 F P 261 | F0 "#PWR" 0 -250 50 H I C CNN 262 | F1 "power_GND" 0 -150 50 H V C CNN 263 | F2 "" 0 0 50 H I C CNN 264 | F3 "" 0 0 50 H I C CNN 265 | DRAW 266 | P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N 267 | X GND 1 0 0 0 D 50 50 1 1 W N 268 | ENDDRAW 269 | ENDDEF 270 | # 271 | #End Library 272 | -------------------------------------------------------------------------------- /hardware/SWD_Cat_Programmer-rescue.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # AP2112K-3.3-Regulator_Linear 5 | # 6 | DEF AP2112K-3.3-Regulator_Linear U 0 10 Y Y 1 F N 7 | F0 "U" -200 225 50 H V L CNN 8 | F1 "AP2112K-3.3-Regulator_Linear" 0 225 50 H V L CNN 9 | F2 "Package_TO_SOT_SMD:SOT-23-5" 0 325 50 H I C CNN 10 | F3 "" 0 100 50 H I C CNN 11 | $FPLIST 12 | SOT?23?5* 13 | $ENDFPLIST 14 | DRAW 15 | S -200 175 200 -200 0 1 10 f 16 | X VIN 1 -300 100 100 R 50 50 1 1 W 17 | X GND 2 0 -300 100 U 50 50 1 1 W 18 | X EN 3 -300 0 100 R 50 50 1 1 I 19 | X NC 4 300 0 100 L 50 50 1 1 N N 20 | X VOUT 5 300 100 100 L 50 50 1 1 w 21 | ENDDRAW 22 | ENDDEF 23 | # 24 | # CH552G-Electronic_Cats-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue 25 | # 26 | DEF CH552G-Electronic_Cats-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue U 0 40 Y Y 1 F N 27 | F0 "U" -150 -1050 50 H V C CNN 28 | F1 "CH552G-Electronic_Cats-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue" 100 300 50 H V C CNN 29 | F2 "" 0 0 50 H I C CNN 30 | F3 "" 0 0 50 H I C CNN 31 | DRAW 32 | S -200 250 250 -1000 0 1 0 f 33 | X P3.2 1 350 -750 100 L 50 50 1 1 I 34 | X P3.3 10 350 -650 100 L 50 50 1 1 I 35 | X P3.4 11 350 -550 100 L 50 50 1 1 I 36 | X P3.6 12 350 -450 100 L 50 50 1 1 I 37 | X P3.7 13 350 -350 100 L 50 50 1 1 I 38 | X GND 14 -300 -850 100 R 50 50 1 1 I 39 | X VCC 15 -300 -300 100 R 50 50 1 1 I 40 | X V33 16 -300 -50 100 R 50 50 1 1 I 41 | X P1.4 2 350 -100 100 L 50 50 1 1 I 42 | X P1.5 3 350 0 100 L 50 50 1 1 I 43 | X P1.6 4 350 100 100 L 50 50 1 1 I 44 | X P1.7 5 350 200 100 L 50 50 1 1 I 45 | X RST 6 -300 200 100 R 50 50 1 1 I 46 | X P3.1 7 350 -850 100 L 50 50 1 1 I 47 | X P3.0 8 350 -950 100 L 50 50 1 1 I 48 | X P1.1 9 350 -200 100 L 50 50 1 1 I 49 | ENDDRAW 50 | ENDDEF 51 | # 52 | # Jumper_3_Bridged12-Jumper 53 | # 54 | DEF Jumper_3_Bridged12-Jumper JP 0 0 Y N 1 F N 55 | F0 "JP" -100 -100 50 H V C CNN 56 | F1 "Jumper_3_Bridged12-Jumper" 0 110 50 H V C CNN 57 | F2 "" 0 0 50 H I C CNN 58 | F3 "" 0 0 50 H I C CNN 59 | $FPLIST 60 | Jumper* 61 | TestPoint*3Pads* 62 | TestPoint*Bridge* 63 | $ENDFPLIST 64 | DRAW 65 | C -130 0 20 0 0 0 N 66 | C 0 0 20 0 0 0 N 67 | C 130 0 20 0 0 0 N 68 | A -65 -50 89 518 1282 0 1 0 N -10 20 -120 20 69 | P 2 0 1 0 0 -50 0 -20 N 70 | X A 1 -250 0 100 R 50 50 1 1 P 71 | X C 2 0 -150 100 U 50 50 1 1 I 72 | X B 3 250 0 100 L 50 50 1 1 P 73 | ENDDRAW 74 | ENDDEF 75 | # 76 | # USB_C_Plug_USB2.0-Connector 77 | # 78 | DEF USB_C_Plug_USB2.0-Connector P 0 40 Y Y 1 F N 79 | F0 "P" -400 750 50 H V L CNN 80 | F1 "USB_C_Plug_USB2.0-Connector" 500 750 50 H V R CNN 81 | F2 "" 150 0 50 H I C CNN 82 | F3 "" 150 0 50 H I C CNN 83 | $FPLIST 84 | USB*C*Plug* 85 | $ENDFPLIST 86 | DRAW 87 | S -10 -700 10 -660 0 0 0 N 88 | S 400 -90 360 -110 0 0 0 N 89 | S 400 110 360 90 0 0 0 N 90 | S 400 310 360 290 0 0 0 N 91 | S 400 410 360 390 0 0 0 N 92 | S 400 610 360 590 0 0 0 N 93 | S -400 700 400 -700 0 1 10 f 94 | A -275 -150 75 -1799 -1 0 1 20 N -350 -150 -200 -150 95 | A -275 -150 25 -1799 -1 0 1 10 N -300 -150 -250 -150 96 | A -275 -150 25 -1799 -1 0 1 10 F -300 -150 -250 -150 97 | S -300 -150 -250 150 0 1 10 F 98 | A -275 150 25 1 1799 0 1 10 N -250 150 -300 150 99 | A -275 150 25 1 1799 0 1 10 F -250 150 -300 150 100 | A -275 150 75 1 1799 0 1 20 N -200 150 -350 150 101 | C -100 45 25 0 1 10 F 102 | C 0 -230 50 0 1 0 F 103 | P 2 0 1 20 -350 -150 -350 150 N 104 | P 2 0 1 20 -200 150 -200 -150 N 105 | P 2 0 1 20 0 -230 0 170 N 106 | P 3 0 1 20 0 -130 -100 -30 -100 20 N 107 | P 3 0 1 20 0 -80 100 20 100 70 N 108 | P 4 0 1 10 -50 170 0 270 50 170 -50 170 F 109 | S 75 70 125 120 0 1 10 F 110 | X GND A1 0 -900 200 U 50 50 1 1 W 111 | X GND A12 0 -900 200 U 50 50 1 1 P N 112 | X VBUS A4 600 600 200 L 50 50 1 1 W 113 | X CC A5 600 400 200 L 50 50 1 1 B 114 | X D+ A6 600 -100 200 L 50 50 1 1 B 115 | X D- A7 600 100 200 L 50 50 1 1 B 116 | X VBUS A9 600 600 200 L 50 50 1 1 P N 117 | X GND B1 0 -900 200 U 50 50 1 1 P N 118 | X GND B12 0 -900 200 U 50 50 1 1 P N 119 | X VBUS B4 600 600 200 L 50 50 1 1 P N 120 | X VCONN B5 600 300 200 L 50 50 1 1 B 121 | X VBUS B9 600 600 200 L 50 50 1 1 P N 122 | X SHIELD S1 -300 -900 200 U 50 50 1 1 P 123 | ENDDRAW 124 | ENDDEF 125 | # 126 | #End Library 127 | -------------------------------------------------------------------------------- /hardware/SWD_Cat_Programmer.kicad_prl: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "active_layer": 0, 4 | "active_layer_preset": "All Layers", 5 | "auto_track_width": true, 6 | "hidden_nets": [], 7 | "high_contrast_mode": 0, 8 | "net_color_mode": 1, 9 | "opacity": { 10 | "pads": 1.0, 11 | "tracks": 1.0, 12 | "vias": 1.0, 13 | "zones": 0.6 14 | }, 15 | "ratsnest_display_mode": 0, 16 | "selection_filter": { 17 | "dimensions": true, 18 | "footprints": true, 19 | "graphics": true, 20 | "keepouts": true, 21 | "lockedItems": true, 22 | "otherItems": true, 23 | "pads": true, 24 | "text": true, 25 | "tracks": true, 26 | "vias": true, 27 | "zones": true 28 | }, 29 | "visible_items": [ 30 | 0, 31 | 1, 32 | 2, 33 | 3, 34 | 4, 35 | 5, 36 | 8, 37 | 9, 38 | 10, 39 | 11, 40 | 12, 41 | 13, 42 | 14, 43 | 15, 44 | 16, 45 | 17, 46 | 18, 47 | 19, 48 | 20, 49 | 21, 50 | 22, 51 | 23, 52 | 24, 53 | 25, 54 | 26, 55 | 27, 56 | 28, 57 | 29, 58 | 30, 59 | 32, 60 | 33, 61 | 34, 62 | 35, 63 | 36 64 | ], 65 | "visible_layers": "fffffff_ffffffff", 66 | "zone_display_mode": 0 67 | }, 68 | "meta": { 69 | "filename": "SWD_Cat_Programmer.kicad_prl", 70 | "version": 3 71 | }, 72 | "project": { 73 | "files": [] 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /hardware/SWD_Cat_Programmer.kicad_pro: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "design_settings": { 4 | "defaults": { 5 | "board_outline_line_width": 0.049999999999999996, 6 | "copper_line_width": 0.19999999999999998, 7 | "copper_text_italic": false, 8 | "copper_text_size_h": 1.5, 9 | "copper_text_size_v": 1.5, 10 | "copper_text_thickness": 0.3, 11 | "copper_text_upright": false, 12 | "courtyard_line_width": 0.049999999999999996, 13 | "dimension_precision": 4, 14 | "dimension_units": 3, 15 | "dimensions": { 16 | "arrow_length": 1270000, 17 | "extension_offset": 500000, 18 | "keep_text_aligned": true, 19 | "suppress_zeroes": false, 20 | "text_position": 0, 21 | "units_format": 1 22 | }, 23 | "fab_line_width": 0.09999999999999999, 24 | "fab_text_italic": false, 25 | "fab_text_size_h": 1.0, 26 | "fab_text_size_v": 1.0, 27 | "fab_text_thickness": 0.15, 28 | "fab_text_upright": false, 29 | "other_line_width": 0.09999999999999999, 30 | "other_text_italic": false, 31 | "other_text_size_h": 1.0, 32 | "other_text_size_v": 1.0, 33 | "other_text_thickness": 0.15, 34 | "other_text_upright": false, 35 | "pads": { 36 | "drill": 0.762, 37 | "height": 1.524, 38 | "width": 1.524 39 | }, 40 | "silk_line_width": 0.12, 41 | "silk_text_italic": false, 42 | "silk_text_size_h": 1.0, 43 | "silk_text_size_v": 1.0, 44 | "silk_text_thickness": 0.15, 45 | "silk_text_upright": false, 46 | "zones": { 47 | "45_degree_only": false, 48 | "min_clearance": 0.508 49 | } 50 | }, 51 | "diff_pair_dimensions": [], 52 | "drc_exclusions": [], 53 | "meta": { 54 | "filename": "board_design_settings.json", 55 | "version": 2 56 | }, 57 | "rule_severities": { 58 | "annular_width": "error", 59 | "clearance": "error", 60 | "copper_edge_clearance": "error", 61 | "courtyards_overlap": "error", 62 | "diff_pair_gap_out_of_range": "error", 63 | "diff_pair_uncoupled_length_too_long": "error", 64 | "drill_out_of_range": "error", 65 | "duplicate_footprints": "warning", 66 | "extra_footprint": "warning", 67 | "footprint_type_mismatch": "error", 68 | "hole_clearance": "error", 69 | "hole_near_hole": "error", 70 | "invalid_outline": "error", 71 | "item_on_disabled_layer": "error", 72 | "items_not_allowed": "error", 73 | "length_out_of_range": "error", 74 | "malformed_courtyard": "error", 75 | "microvia_drill_out_of_range": "error", 76 | "missing_courtyard": "ignore", 77 | "missing_footprint": "warning", 78 | "net_conflict": "warning", 79 | "npth_inside_courtyard": "ignore", 80 | "padstack": "error", 81 | "pth_inside_courtyard": "ignore", 82 | "shorting_items": "error", 83 | "silk_over_copper": "warning", 84 | "silk_overlap": "warning", 85 | "skew_out_of_range": "error", 86 | "through_hole_pad_without_hole": "error", 87 | "too_many_vias": "error", 88 | "track_dangling": "warning", 89 | "track_width": "error", 90 | "tracks_crossing": "error", 91 | "unconnected_items": "error", 92 | "unresolved_variable": "error", 93 | "via_dangling": "warning", 94 | "zone_has_empty_net": "error", 95 | "zones_intersect": "error" 96 | }, 97 | "rule_severitieslegacy_courtyards_overlap": true, 98 | "rule_severitieslegacy_no_courtyard_defined": false, 99 | "rules": { 100 | "allow_blind_buried_vias": false, 101 | "allow_microvias": false, 102 | "max_error": 0.005, 103 | "min_clearance": 0.0, 104 | "min_copper_edge_clearance": 0.024999999999999998, 105 | "min_hole_clearance": 0.25, 106 | "min_hole_to_hole": 0.25, 107 | "min_microvia_diameter": 0.19999999999999998, 108 | "min_microvia_drill": 0.09999999999999999, 109 | "min_silk_clearance": 0.0, 110 | "min_through_hole_diameter": 0.3, 111 | "min_track_width": 0.19999999999999998, 112 | "min_via_annular_width": 0.049999999999999996, 113 | "min_via_diameter": 0.39999999999999997, 114 | "use_height_for_length_calcs": true 115 | }, 116 | "track_widths": [ 117 | 0.0, 118 | 0.2, 119 | 0.5, 120 | 0.75 121 | ], 122 | "via_dimensions": [], 123 | "zones_allow_external_fillets": false, 124 | "zones_use_no_outline": true 125 | }, 126 | "layer_presets": [] 127 | }, 128 | "boards": [], 129 | "cvpcb": { 130 | "equivalence_files": [] 131 | }, 132 | "erc": { 133 | "erc_exclusions": [], 134 | "meta": { 135 | "version": 0 136 | }, 137 | "pin_map": [ 138 | [ 139 | 0, 140 | 0, 141 | 0, 142 | 0, 143 | 0, 144 | 0, 145 | 1, 146 | 0, 147 | 0, 148 | 0, 149 | 0, 150 | 2 151 | ], 152 | [ 153 | 0, 154 | 2, 155 | 0, 156 | 1, 157 | 0, 158 | 0, 159 | 1, 160 | 0, 161 | 2, 162 | 2, 163 | 2, 164 | 2 165 | ], 166 | [ 167 | 0, 168 | 0, 169 | 0, 170 | 0, 171 | 0, 172 | 0, 173 | 1, 174 | 0, 175 | 1, 176 | 0, 177 | 1, 178 | 2 179 | ], 180 | [ 181 | 0, 182 | 1, 183 | 0, 184 | 0, 185 | 0, 186 | 0, 187 | 1, 188 | 1, 189 | 2, 190 | 1, 191 | 1, 192 | 2 193 | ], 194 | [ 195 | 0, 196 | 0, 197 | 0, 198 | 0, 199 | 0, 200 | 0, 201 | 1, 202 | 0, 203 | 0, 204 | 0, 205 | 0, 206 | 2 207 | ], 208 | [ 209 | 0, 210 | 0, 211 | 0, 212 | 0, 213 | 0, 214 | 0, 215 | 0, 216 | 0, 217 | 0, 218 | 0, 219 | 0, 220 | 2 221 | ], 222 | [ 223 | 1, 224 | 1, 225 | 1, 226 | 1, 227 | 1, 228 | 0, 229 | 1, 230 | 1, 231 | 1, 232 | 1, 233 | 1, 234 | 2 235 | ], 236 | [ 237 | 0, 238 | 0, 239 | 0, 240 | 1, 241 | 0, 242 | 0, 243 | 1, 244 | 0, 245 | 0, 246 | 0, 247 | 0, 248 | 2 249 | ], 250 | [ 251 | 0, 252 | 2, 253 | 1, 254 | 2, 255 | 0, 256 | 0, 257 | 1, 258 | 0, 259 | 2, 260 | 2, 261 | 2, 262 | 2 263 | ], 264 | [ 265 | 0, 266 | 2, 267 | 0, 268 | 1, 269 | 0, 270 | 0, 271 | 1, 272 | 0, 273 | 2, 274 | 0, 275 | 0, 276 | 2 277 | ], 278 | [ 279 | 0, 280 | 2, 281 | 1, 282 | 1, 283 | 0, 284 | 0, 285 | 1, 286 | 0, 287 | 2, 288 | 0, 289 | 0, 290 | 2 291 | ], 292 | [ 293 | 2, 294 | 2, 295 | 2, 296 | 2, 297 | 2, 298 | 2, 299 | 2, 300 | 2, 301 | 2, 302 | 2, 303 | 2, 304 | 2 305 | ] 306 | ], 307 | "rule_severities": { 308 | "bus_definition_conflict": "error", 309 | "bus_entry_needed": "error", 310 | "bus_label_syntax": "error", 311 | "bus_to_bus_conflict": "error", 312 | "bus_to_net_conflict": "error", 313 | "different_unit_footprint": "error", 314 | "different_unit_net": "error", 315 | "duplicate_reference": "error", 316 | "duplicate_sheet_names": "error", 317 | "extra_units": "error", 318 | "global_label_dangling": "warning", 319 | "hier_label_mismatch": "error", 320 | "label_dangling": "error", 321 | "lib_symbol_issues": "warning", 322 | "multiple_net_names": "warning", 323 | "net_not_bus_member": "warning", 324 | "no_connect_connected": "warning", 325 | "no_connect_dangling": "warning", 326 | "pin_not_connected": "error", 327 | "pin_not_driven": "error", 328 | "pin_to_pin": "warning", 329 | "power_pin_not_driven": "error", 330 | "similar_labels": "warning", 331 | "unannotated": "error", 332 | "unit_value_mismatch": "error", 333 | "unresolved_variable": "error", 334 | "wire_dangling": "error" 335 | } 336 | }, 337 | "libraries": { 338 | "pinned_footprint_libs": [], 339 | "pinned_symbol_libs": [] 340 | }, 341 | "meta": { 342 | "filename": "SWD_Cat_Programmer.kicad_pro", 343 | "version": 1 344 | }, 345 | "net_settings": { 346 | "classes": [ 347 | { 348 | "bus_width": 12.0, 349 | "clearance": 0.2, 350 | "diff_pair_gap": 0.25, 351 | "diff_pair_via_gap": 0.25, 352 | "diff_pair_width": 0.2, 353 | "line_style": 0, 354 | "microvia_diameter": 0.3, 355 | "microvia_drill": 0.1, 356 | "name": "Default", 357 | "pcb_color": "rgba(0, 0, 0, 0.000)", 358 | "schematic_color": "rgba(0, 0, 0, 0.000)", 359 | "track_width": 0.25, 360 | "via_diameter": 0.8, 361 | "via_drill": 0.4, 362 | "wire_width": 6.0 363 | } 364 | ], 365 | "meta": { 366 | "version": 2 367 | }, 368 | "net_colors": null 369 | }, 370 | "pcbnew": { 371 | "last_paths": { 372 | "gencad": "", 373 | "idf": "", 374 | "netlist": "", 375 | "specctra_dsn": "", 376 | "step": "", 377 | "vrml": "" 378 | }, 379 | "page_layout_descr_file": "" 380 | }, 381 | "schematic": { 382 | "annotate_start_num": 0, 383 | "drawing": { 384 | "default_line_thickness": 6.0, 385 | "default_text_size": 50.0, 386 | "field_names": [], 387 | "intersheets_ref_own_page": false, 388 | "intersheets_ref_prefix": "", 389 | "intersheets_ref_short": false, 390 | "intersheets_ref_show": false, 391 | "intersheets_ref_suffix": "", 392 | "junction_size_choice": 3, 393 | "label_size_ratio": 0.25, 394 | "pin_symbol_size": 0.0, 395 | "text_offset_ratio": 0.08 396 | }, 397 | "legacy_lib_dir": "", 398 | "legacy_lib_list": [], 399 | "meta": { 400 | "version": 1 401 | }, 402 | "net_format_name": "Pcbnew", 403 | "ngspice": { 404 | "fix_include_paths": true, 405 | "fix_passive_vals": false, 406 | "meta": { 407 | "version": 0 408 | }, 409 | "model_mode": 0, 410 | "workbook_filename": "" 411 | }, 412 | "page_layout_descr_file": "", 413 | "plot_directory": "", 414 | "spice_adjust_passive_values": false, 415 | "spice_external_command": "spice \"%I\"", 416 | "subpart_first_id": 65, 417 | "subpart_id_separator": 0 418 | }, 419 | "sheets": [ 420 | [ 421 | "0bd16843-c23e-4a81-a9bf-f065dfb80a6e", 422 | "" 423 | ] 424 | ], 425 | "text_variables": {} 426 | } 427 | -------------------------------------------------------------------------------- /hardware/SWD_Cat_Programmer.pro: -------------------------------------------------------------------------------- 1 | update=06/08/2020 07:14:12 p. m. 2 | version=1 3 | last_client=kicad 4 | [general] 5 | version=1 6 | RootSch= 7 | BoardNm= 8 | [cvpcb] 9 | version=1 10 | NetIExt=net 11 | [eeschema] 12 | version=1 13 | LibDir= 14 | [eeschema/libraries] 15 | [pcbnew] 16 | version=1 17 | PageLayoutDescrFile= 18 | LastNetListRead= 19 | CopperLayerCount=2 20 | BoardThickness=1.6 21 | AllowMicroVias=0 22 | AllowBlindVias=0 23 | RequireCourtyardDefinitions=0 24 | ProhibitOverlappingCourtyards=1 25 | MinTrackWidth=0.2 26 | MinViaDiameter=0.4 27 | MinViaDrill=0.3 28 | MinMicroViaDiameter=0.2 29 | MinMicroViaDrill=0.09999999999999999 30 | MinHoleToHole=0.25 31 | TrackWidth1=0.25 32 | TrackWidth2=0.2 33 | TrackWidth3=0.5 34 | TrackWidth4=0.75 35 | ViaDiameter1=0.8 36 | ViaDrill1=0.4 37 | dPairWidth1=0.2 38 | dPairGap1=0.25 39 | dPairViaGap1=0.25 40 | SilkLineWidth=0.12 41 | SilkTextSizeV=1 42 | SilkTextSizeH=1 43 | SilkTextSizeThickness=0.15 44 | SilkTextItalic=0 45 | SilkTextUpright=1 46 | CopperLineWidth=0.2 47 | CopperTextSizeV=1.5 48 | CopperTextSizeH=1.5 49 | CopperTextThickness=0.3 50 | CopperTextItalic=0 51 | CopperTextUpright=1 52 | EdgeCutLineWidth=0.05 53 | CourtyardLineWidth=0.05 54 | OthersLineWidth=0.15 55 | OthersTextSizeV=1 56 | OthersTextSizeH=1 57 | OthersTextSizeThickness=0.15 58 | OthersTextItalic=0 59 | OthersTextUpright=1 60 | SolderMaskClearance=0.05 61 | SolderMaskMinWidth=0 62 | SolderPasteClearance=0 63 | SolderPasteRatio=-0 64 | [pcbnew/Layer.F.Cu] 65 | Name=F.Cu 66 | Type=0 67 | Enabled=1 68 | [pcbnew/Layer.In1.Cu] 69 | Name=In1.Cu 70 | Type=0 71 | Enabled=0 72 | [pcbnew/Layer.In2.Cu] 73 | Name=In2.Cu 74 | Type=0 75 | Enabled=0 76 | [pcbnew/Layer.In3.Cu] 77 | Name=In3.Cu 78 | Type=0 79 | Enabled=0 80 | [pcbnew/Layer.In4.Cu] 81 | Name=In4.Cu 82 | Type=0 83 | Enabled=0 84 | [pcbnew/Layer.In5.Cu] 85 | Name=In5.Cu 86 | Type=0 87 | Enabled=0 88 | [pcbnew/Layer.In6.Cu] 89 | Name=In6.Cu 90 | Type=0 91 | Enabled=0 92 | [pcbnew/Layer.In7.Cu] 93 | Name=In7.Cu 94 | Type=0 95 | Enabled=0 96 | [pcbnew/Layer.In8.Cu] 97 | Name=In8.Cu 98 | Type=0 99 | Enabled=0 100 | [pcbnew/Layer.In9.Cu] 101 | Name=In9.Cu 102 | Type=0 103 | Enabled=0 104 | [pcbnew/Layer.In10.Cu] 105 | Name=In10.Cu 106 | Type=0 107 | Enabled=0 108 | [pcbnew/Layer.In11.Cu] 109 | Name=In11.Cu 110 | Type=0 111 | Enabled=0 112 | [pcbnew/Layer.In12.Cu] 113 | Name=In12.Cu 114 | Type=0 115 | Enabled=0 116 | [pcbnew/Layer.In13.Cu] 117 | Name=In13.Cu 118 | Type=0 119 | Enabled=0 120 | [pcbnew/Layer.In14.Cu] 121 | Name=In14.Cu 122 | Type=0 123 | Enabled=0 124 | [pcbnew/Layer.In15.Cu] 125 | Name=In15.Cu 126 | Type=0 127 | Enabled=0 128 | [pcbnew/Layer.In16.Cu] 129 | Name=In16.Cu 130 | Type=0 131 | Enabled=0 132 | [pcbnew/Layer.In17.Cu] 133 | Name=In17.Cu 134 | Type=0 135 | Enabled=0 136 | [pcbnew/Layer.In18.Cu] 137 | Name=In18.Cu 138 | Type=0 139 | Enabled=0 140 | [pcbnew/Layer.In19.Cu] 141 | Name=In19.Cu 142 | Type=0 143 | Enabled=0 144 | [pcbnew/Layer.In20.Cu] 145 | Name=In20.Cu 146 | Type=0 147 | Enabled=0 148 | [pcbnew/Layer.In21.Cu] 149 | Name=In21.Cu 150 | Type=0 151 | Enabled=0 152 | [pcbnew/Layer.In22.Cu] 153 | Name=In22.Cu 154 | Type=0 155 | Enabled=0 156 | [pcbnew/Layer.In23.Cu] 157 | Name=In23.Cu 158 | Type=0 159 | Enabled=0 160 | [pcbnew/Layer.In24.Cu] 161 | Name=In24.Cu 162 | Type=0 163 | Enabled=0 164 | [pcbnew/Layer.In25.Cu] 165 | Name=In25.Cu 166 | Type=0 167 | Enabled=0 168 | [pcbnew/Layer.In26.Cu] 169 | Name=In26.Cu 170 | Type=0 171 | Enabled=0 172 | [pcbnew/Layer.In27.Cu] 173 | Name=In27.Cu 174 | Type=0 175 | Enabled=0 176 | [pcbnew/Layer.In28.Cu] 177 | Name=In28.Cu 178 | Type=0 179 | Enabled=0 180 | [pcbnew/Layer.In29.Cu] 181 | Name=In29.Cu 182 | Type=0 183 | Enabled=0 184 | [pcbnew/Layer.In30.Cu] 185 | Name=In30.Cu 186 | Type=0 187 | Enabled=0 188 | [pcbnew/Layer.B.Cu] 189 | Name=B.Cu 190 | Type=0 191 | Enabled=1 192 | [pcbnew/Layer.B.Adhes] 193 | Enabled=1 194 | [pcbnew/Layer.F.Adhes] 195 | Enabled=1 196 | [pcbnew/Layer.B.Paste] 197 | Enabled=1 198 | [pcbnew/Layer.F.Paste] 199 | Enabled=1 200 | [pcbnew/Layer.B.SilkS] 201 | Enabled=1 202 | [pcbnew/Layer.F.SilkS] 203 | Enabled=1 204 | [pcbnew/Layer.B.Mask] 205 | Enabled=1 206 | [pcbnew/Layer.F.Mask] 207 | Enabled=1 208 | [pcbnew/Layer.Dwgs.User] 209 | Enabled=1 210 | [pcbnew/Layer.Cmts.User] 211 | Enabled=1 212 | [pcbnew/Layer.Eco1.User] 213 | Enabled=1 214 | [pcbnew/Layer.Eco2.User] 215 | Enabled=1 216 | [pcbnew/Layer.Edge.Cuts] 217 | Enabled=1 218 | [pcbnew/Layer.Margin] 219 | Enabled=1 220 | [pcbnew/Layer.B.CrtYd] 221 | Enabled=1 222 | [pcbnew/Layer.F.CrtYd] 223 | Enabled=1 224 | [pcbnew/Layer.B.Fab] 225 | Enabled=1 226 | [pcbnew/Layer.F.Fab] 227 | Enabled=1 228 | [pcbnew/Layer.Rescue] 229 | Enabled=0 230 | [pcbnew/Netclasses] 231 | [pcbnew/Netclasses/Default] 232 | Name=Default 233 | Clearance=0.2 234 | TrackWidth=0.25 235 | ViaDiameter=0.8 236 | ViaDrill=0.4 237 | uViaDiameter=0.3 238 | uViaDrill=0.1 239 | dPairWidth=0.2 240 | dPairGap=0.25 241 | dPairViaGap=0.25 242 | [schematic_editor] 243 | version=1 244 | PageLayoutDescrFile= 245 | PlotDirectoryName= 246 | SubpartIdSeparator=0 247 | SubpartFirstId=65 248 | NetFmtName=Pcbnew 249 | SpiceAjustPassiveValues=0 250 | LabSize=50 251 | ERC_TestSimilarLabels=1 252 | -------------------------------------------------------------------------------- /hardware/SWD_Cat_Programmer.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 4 2 | EELAYER 30 0 3 | EELAYER END 4 | $Descr A4 11693 8268 5 | encoding utf-8 6 | Sheet 1 1 7 | Title "CMIS DAP Cat Programmer" 8 | Date "2020-09-01" 9 | Rev "1.1" 10 | Comp "Electronic Cats" 11 | Comment1 "" 12 | Comment2 "Eduaro Contreras" 13 | Comment3 "Felipe Islas" 14 | Comment4 "Andres Sabas" 15 | $EndDescr 16 | $Comp 17 | L Connector:USB_C_Plug_USB2.0 P1 18 | U 1 1 5F2667BA 19 | P 1680 2310 20 | F 0 "P1" H 1787 3177 50 0000 C CNN 21 | F 1 "USB_C_Plug_USB2.0" H 1787 3086 50 0000 C CNN 22 | F 2 "Connectors:C393939" H 1830 2310 50 0001 C CNN 23 | F 3 "https://datasheet.lcsc.com/szlcsc/1912111437_SHOU-HAN-TYPE-C16PIN_C393939.pdf" H 1830 2310 50 0001 C CNN 24 | F 4 "C393939" H 1680 2310 50 0001 C CNN "manf#" 25 | 1 1680 2310 26 | 1 0 0 -1 27 | $EndComp 28 | $Comp 29 | L Device:C_Small C3 30 | U 1 1 5F2692FE 31 | P 8760 1855 32 | F 0 "C3" H 8852 1901 50 0000 L CNN 33 | F 1 "0.1uF" H 8852 1810 50 0000 L CNN 34 | F 2 "Capacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 8760 1855 50 0001 C CNN 35 | F 3 "https://datasheet.lcsc.com/szlcsc/1810101813_YAGEO-CC0805KRX7R9BB104_C49678.pdf" H 8760 1855 50 0001 C CNN 36 | F 4 "C49678" H 8760 1855 50 0001 C CNN "manf#" 37 | 1 8760 1855 38 | 1 0 0 -1 39 | $EndComp 40 | $Comp 41 | L Device:R_Small R1 42 | U 1 1 5F2697C0 43 | P 2470 1910 44 | F 0 "R1" V 2405 1855 50 0000 C CNN 45 | F 1 "5.1K" V 2405 2000 50 0000 C CNN 46 | F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 2470 1910 50 0001 C CNN 47 | F 3 "https://datasheet.lcsc.com/szlcsc/1810311431_YAGEO-RC0805JR-075K1L_C105874.pdf" H 2470 1910 50 0001 C CNN 48 | F 4 "C105874" V 2470 1910 50 0001 C CNN "manf#" 49 | 1 2470 1910 50 | 0 1 1 0 51 | $EndComp 52 | $Comp 53 | L SWD_Cat_Programmer-rescue:CH552G-Electronic_Cats-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue-SWD_Cat_Programmer-rescue U1 54 | U 1 1 5F26B9A6 55 | P 5030 2390 56 | F 0 "U1" H 5055 2815 50 0000 C CNN 57 | F 1 "CH552G" H 5055 2724 50 0000 C CNN 58 | F 2 "Package_SO:SOP-16_4.55x10.3mm_P1.27mm" H 5030 2390 50 0001 C CNN 59 | F 3 "https://datasheet.lcsc.com/szlcsc/2008191734_WCH-Jiangsu-Qin-Heng-CH552G_C111292.pdf" H 5030 2390 50 0001 C CNN 60 | F 4 "C111292" H 5030 2390 50 0001 C CNN "manf#" 61 | 1 5030 2390 62 | 1 0 0 -1 63 | $EndComp 64 | Wire Wire Line 65 | 5380 2740 5500 2740 66 | Wire Wire Line 67 | 5380 2840 5510 2840 68 | Wire Wire Line 69 | 4730 2190 4565 2190 70 | Wire Wire Line 71 | 4730 2440 4580 2440 72 | Wire Wire Line 73 | 4455 2440 4455 2405 74 | Wire Wire Line 75 | 4730 2690 4365 2690 76 | $Comp 77 | L power:+3V3 #PWR06 78 | U 1 1 5F26D013 79 | P 4455 2405 80 | F 0 "#PWR06" H 4455 2255 50 0001 C CNN 81 | F 1 "+3V3" H 4470 2578 50 0000 C CNN 82 | F 2 "" H 4455 2405 50 0001 C CNN 83 | F 3 "" H 4455 2405 50 0001 C CNN 84 | 1 4455 2405 85 | 1 0 0 -1 86 | $EndComp 87 | $Comp 88 | L power:+5V #PWR04 89 | U 1 1 5F26D6C6 90 | P 3835 2315 91 | F 0 "#PWR04" H 3835 2165 50 0001 C CNN 92 | F 1 "+5V" H 3850 2488 50 0000 C CNN 93 | F 2 "" H 3835 2315 50 0001 C CNN 94 | F 3 "" H 3835 2315 50 0001 C CNN 95 | 1 3835 2315 96 | 1 0 0 -1 97 | $EndComp 98 | $Comp 99 | L power:GND #PWR08 100 | U 1 1 5F26DE50 101 | P 4580 3300 102 | F 0 "#PWR08" H 4580 3050 50 0001 C CNN 103 | F 1 "GND" H 4585 3127 50 0000 C CNN 104 | F 2 "" H 4580 3300 50 0001 C CNN 105 | F 3 "" H 4580 3300 50 0001 C CNN 106 | 1 4580 3300 107 | 1 0 0 -1 108 | $EndComp 109 | Wire Wire Line 110 | 4730 3240 4580 3240 111 | Wire Wire Line 112 | 4580 3240 4580 3300 113 | $Comp 114 | L Device:C_Small C1 115 | U 1 1 5F26E74E 116 | P 4365 2790 117 | F 0 "C1" H 4190 2820 50 0000 L CNN 118 | F 1 "0.1uF" H 4115 2715 50 0000 L CNN 119 | F 2 "Capacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 4365 2790 50 0001 C CNN 120 | F 3 "https://datasheet.lcsc.com/szlcsc/1810101813_YAGEO-CC0805KRX7R9BB104_C49678.pdf" H 4365 2790 50 0001 C CNN 121 | F 4 "C49678" H 4365 2790 50 0001 C CNN "manf#" 122 | 1 4365 2790 123 | 1 0 0 -1 124 | $EndComp 125 | Connection ~ 4365 2690 126 | Wire Wire Line 127 | 4365 2690 4215 2690 128 | Wire Wire Line 129 | 4365 2890 4365 2925 130 | $Comp 131 | L Device:C_Small C2 132 | U 1 1 5F26F54A 133 | P 4580 2540 134 | F 0 "C2" H 4415 2550 50 0000 L CNN 135 | F 1 "0.1uF" H 4355 2480 50 0000 L CNN 136 | F 2 "Capacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 4580 2540 50 0001 C CNN 137 | F 3 "https://datasheet.lcsc.com/szlcsc/1810101813_YAGEO-CC0805KRX7R9BB104_C49678.pdf" H 4580 2540 50 0001 C CNN 138 | F 4 "C49678" H 4580 2540 50 0001 C CNN "manf#" 139 | 1 4580 2540 140 | 1 0 0 -1 141 | $EndComp 142 | Connection ~ 4580 2440 143 | Wire Wire Line 144 | 4580 2440 4465 2440 145 | Wire Wire Line 146 | 4580 2640 4580 2930 147 | $Comp 148 | L power:GND #PWR07 149 | U 1 1 5F270281 150 | P 4580 2930 151 | F 0 "#PWR07" H 4580 2680 50 0001 C CNN 152 | F 1 "GND" H 4585 2757 50 0000 C CNN 153 | F 2 "" H 4580 2930 50 0001 C CNN 154 | F 3 "" H 4580 2930 50 0001 C CNN 155 | 1 4580 2930 156 | 1 0 0 -1 157 | $EndComp 158 | $Comp 159 | L power:GND #PWR05 160 | U 1 1 5F2708CA 161 | P 4365 2925 162 | F 0 "#PWR05" H 4365 2675 50 0001 C CNN 163 | F 1 "GND" H 4370 2752 50 0000 C CNN 164 | F 2 "" H 4365 2925 50 0001 C CNN 165 | F 3 "" H 4365 2925 50 0001 C CNN 166 | 1 4365 2925 167 | 1 0 0 -1 168 | $EndComp 169 | Text Label 4565 2190 0 50 ~ 0 170 | RST 171 | $Comp 172 | L Device:R_Small R2 173 | U 1 1 5F2721DC 174 | P 2470 2010 175 | F 0 "R2" V 2540 1940 50 0000 C CNN 176 | F 1 "5.1K" V 2535 2100 50 0000 C CNN 177 | F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 2470 2010 50 0001 C CNN 178 | F 3 "https://datasheet.lcsc.com/szlcsc/1810311431_YAGEO-RC0805JR-075K1L_C105874.pdf" H 2470 2010 50 0001 C CNN 179 | F 4 "C105874" V 2470 2010 50 0001 C CNN "manf#" 180 | 1 2470 2010 181 | 0 1 1 0 182 | $EndComp 183 | Wire Wire Line 184 | 2280 1910 2370 1910 185 | Wire Wire Line 186 | 2280 2010 2370 2010 187 | Wire Wire Line 188 | 1680 3210 1680 3245 189 | $Comp 190 | L power:GND #PWR01 191 | U 1 1 5F2742EE 192 | P 1680 3270 193 | F 0 "#PWR01" H 1680 3020 50 0001 C CNN 194 | F 1 "GND" H 1685 3097 50 0000 C CNN 195 | F 2 "" H 1680 3270 50 0001 C CNN 196 | F 3 "" H 1680 3270 50 0001 C CNN 197 | 1 1680 3270 198 | 1 0 0 -1 199 | $EndComp 200 | Wire Wire Line 201 | 9395 4060 9525 4060 202 | $Comp 203 | L Device:R_Small R7 204 | U 1 1 5F275B65 205 | P 9625 4060 206 | F 0 "R7" V 9485 4050 50 0000 C CNN 207 | F 1 "1K" V 9550 4055 50 0000 C CNN 208 | F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 9625 4060 50 0001 C CNN 209 | F 3 "https://datasheet.lcsc.com/szlcsc/1809140835_UNI-ROYAL-Uniroyal-Elec-0805W8J0102T5E_C25623.pdf" H 9625 4060 50 0001 C CNN 210 | F 4 "C25623" V 9625 4060 50 0001 C CNN "manf#" 211 | 1 9625 4060 212 | 0 1 1 0 213 | $EndComp 214 | $Comp 215 | L Device:LED D1 216 | U 1 1 5F2768D1 217 | P 9920 4060 218 | F 0 "D1" H 9915 3960 50 0000 C CNN 219 | F 1 "LED" H 9910 4165 50 0000 C CNN 220 | F 2 "LED_SMD:LED_0805_2012Metric" H 9920 4060 50 0001 C CNN 221 | F 3 "https://datasheet.lcsc.com/szlcsc/1808272351_Everlight-Elec-17-21SURC-S530-A2-TR8_C131244.pdf" H 9920 4060 50 0001 C CNN 222 | F 4 "C131244" H 9920 4060 50 0001 C CNN "manf#" 223 | 1 9920 4060 224 | -1 0 0 1 225 | $EndComp 226 | Wire Wire Line 227 | 9725 4060 9770 4060 228 | Wire Wire Line 229 | 10070 4060 10140 4060 230 | Wire Wire Line 231 | 10140 4060 10140 4085 232 | $Comp 233 | L power:GND #PWR015 234 | U 1 1 5F277D50 235 | P 10140 4085 236 | F 0 "#PWR015" H 10140 3835 50 0001 C CNN 237 | F 1 "GND" H 10145 3912 50 0000 C CNN 238 | F 2 "" H 10140 4085 50 0001 C CNN 239 | F 3 "" H 10140 4085 50 0001 C CNN 240 | 1 10140 4085 241 | 1 0 0 -1 242 | $EndComp 243 | Text Label 5500 2740 0 50 ~ 0 244 | D- 245 | Text Label 5510 2840 0 50 ~ 0 246 | D+ 247 | Text Label 2280 2210 0 50 ~ 0 248 | D- 249 | Text Label 2280 2410 0 50 ~ 0 250 | D+ 251 | $Comp 252 | L Switch:SW_Push SW1 253 | U 1 1 5F279575 254 | P 7815 3865 255 | F 0 "SW1" H 7815 4150 50 0000 C CNN 256 | F 1 "RST" H 7815 4059 50 0000 C CNN 257 | F 2 "KiCad:TS1088R02026" H 7815 4065 50 0001 C CNN 258 | F 3 "https://datasheet.lcsc.com/szlcsc/1912111437_XUNPU-TS-1088R-02526_C455281.pdf" H 7815 4065 50 0001 C CNN 259 | F 4 "C455281" H 7815 3865 50 0001 C CNN "manf#" 260 | 1 7815 3865 261 | 1 0 0 -1 262 | $EndComp 263 | $Comp 264 | L Switch:SW_Push SW2 265 | U 1 1 5F279C62 266 | P 7835 4265 267 | F 0 "SW2" H 7835 4550 50 0000 C CNN 268 | F 1 "BOOT" H 7835 4459 50 0000 C CNN 269 | F 2 "KiCad:TS1088R02026" H 7835 4465 50 0001 C CNN 270 | F 3 "https://datasheet.lcsc.com/szlcsc/1912111437_XUNPU-TS-1088R-02526_C455281.pdf" H 7835 4465 50 0001 C CNN 271 | F 4 "C455281" H 7835 4265 50 0001 C CNN "manf#" 272 | 1 7835 4265 273 | 1 0 0 -1 274 | $EndComp 275 | Wire Wire Line 276 | 8015 3865 8110 3865 277 | Wire Wire Line 278 | 8035 4265 8125 4265 279 | Wire Wire Line 280 | 7635 4265 7310 4265 281 | Wire Wire Line 282 | 7310 4265 7310 3865 283 | Wire Wire Line 284 | 7615 3865 7310 3865 285 | Connection ~ 7310 3865 286 | Wire Wire Line 287 | 7310 3865 7310 3605 288 | $Comp 289 | L power:+5V #PWR09 290 | U 1 1 5F27B9C6 291 | P 7310 3605 292 | F 0 "#PWR09" H 7310 3455 50 0001 C CNN 293 | F 1 "+5V" H 7325 3778 50 0000 C CNN 294 | F 2 "" H 7310 3605 50 0001 C CNN 295 | F 3 "" H 7310 3605 50 0001 C CNN 296 | 1 7310 3605 297 | 1 0 0 -1 298 | $EndComp 299 | $Comp 300 | L Device:R_Small R6 301 | U 1 1 5F27C15F 302 | P 8225 4265 303 | F 0 "R6" V 8029 4265 50 0000 C CNN 304 | F 1 "20K" V 8120 4265 50 0000 C CNN 305 | F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 8225 4265 50 0001 C CNN 306 | F 3 "https://datasheet.lcsc.com/szlcsc/2007131613_HKR-Hong-Kong-Resistors-RCT0520KFLF_C702832.pdf" H 8225 4265 50 0001 C CNN 307 | F 4 "C702832" V 8225 4265 50 0001 C CNN "manf#" 308 | 1 8225 4265 309 | 0 1 1 0 310 | $EndComp 311 | Wire Wire Line 312 | 8325 4265 8390 4265 313 | Text Label 8390 4265 0 50 ~ 0 314 | D+ 315 | Text Label 8110 3865 0 50 ~ 0 316 | RST 317 | Text Label 9405 1780 2 50 ~ 0 318 | SWDIO 319 | Text Label 9405 1880 2 50 ~ 0 320 | SWCLK 321 | Text Label 9405 2080 2 50 ~ 0 322 | RESET 323 | $Comp 324 | L power:GND #PWR013 325 | U 1 1 5F27EA9C 326 | P 9100 2125 327 | F 0 "#PWR013" H 9100 1875 50 0001 C CNN 328 | F 1 "GND" H 9105 1952 50 0000 C CNN 329 | F 2 "" H 9100 2125 50 0001 C CNN 330 | F 3 "" H 9100 2125 50 0001 C CNN 331 | 1 9100 2125 332 | 1 0 0 -1 333 | $EndComp 334 | Wire Wire Line 335 | 5380 3340 5530 3340 336 | Wire Wire Line 337 | 5380 3240 5530 3240 338 | Wire Wire Line 339 | 5380 3140 5535 3140 340 | Text Label 6265 3140 0 50 ~ 0 341 | SWDIO 342 | Text Label 6260 3240 0 50 ~ 0 343 | SWCLK_TX 344 | $Comp 345 | L Device:R_Small R5 346 | U 1 1 5F2835E9 347 | P 5635 3140 348 | F 0 "R5" V 5565 3185 50 0000 C CNN 349 | F 1 "150" V 5635 3145 50 0000 C CNN 350 | F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 5635 3140 50 0001 C CNN 351 | F 3 "https://datasheet.lcsc.com/szlcsc/1811081415_RALEC-RTT051500FTP_C103997.pdf" H 5635 3140 50 0001 C CNN 352 | F 4 "C103997" V 5635 3140 50 0001 C CNN "manf#" 353 | 1 5635 3140 354 | 0 1 1 0 355 | $EndComp 356 | $Comp 357 | L Device:R_Small R3 358 | U 1 1 5F284106 359 | P 5630 3240 360 | F 0 "R3" V 5595 3360 50 0000 C CNN 361 | F 1 "150" V 5635 3240 50 0000 C CNN 362 | F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 5630 3240 50 0001 C CNN 363 | F 3 "https://datasheet.lcsc.com/szlcsc/1811081415_RALEC-RTT051500FTP_C103997.pdf" H 5630 3240 50 0001 C CNN 364 | F 4 "C103997" V 5630 3240 50 0001 C CNN "manf#" 365 | 1 5630 3240 366 | 0 1 1 0 367 | $EndComp 368 | $Comp 369 | L Device:R_Small R4 370 | U 1 1 5F284591 371 | P 5630 3340 372 | F 0 "R4" V 5675 3460 50 0000 C CNN 373 | F 1 "150" V 5700 3340 50 0000 C CNN 374 | F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 5630 3340 50 0001 C CNN 375 | F 3 "https://datasheet.lcsc.com/szlcsc/1811081415_RALEC-RTT051500FTP_C103997.pdf" H 5630 3340 50 0001 C CNN 376 | F 4 "C103997" V 5630 3340 50 0001 C CNN "manf#" 377 | 1 5630 3340 378 | 0 1 1 0 379 | $EndComp 380 | Wire Wire Line 381 | 5380 3040 5535 3040 382 | Text Label 5535 3040 0 50 ~ 0 383 | LED 384 | Text Label 9395 4060 0 50 ~ 0 385 | LED 386 | NoConn ~ 5380 2190 387 | NoConn ~ 5380 2290 388 | NoConn ~ 5380 2390 389 | NoConn ~ 5380 2490 390 | NoConn ~ 5380 2590 391 | $Comp 392 | L Device:C_Small C4 393 | U 1 1 5F293E2A 394 | P 9045 5645 395 | F 0 "C4" H 9137 5691 50 0000 L CNN 396 | F 1 "1uF" H 9137 5600 50 0000 L CNN 397 | F 2 "Capacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 9045 5645 50 0001 C CNN 398 | F 3 "https://datasheet.lcsc.com/szlcsc/1810191216_Samsung-Electro-Mechanics-CL21B105KBFNNNE_C28323.pdf" H 9045 5645 50 0001 C CNN 399 | F 4 "C28323" H 9045 5645 50 0001 C CNN "manf#" 400 | 1 9045 5645 401 | 1 0 0 -1 402 | $EndComp 403 | $Comp 404 | L Device:C_Small C5 405 | U 1 1 5F2946A6 406 | P 10095 5595 407 | F 0 "C5" H 10187 5641 50 0000 L CNN 408 | F 1 "1uF" H 10187 5550 50 0000 L CNN 409 | F 2 "Capacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 10095 5595 50 0001 C CNN 410 | F 3 "https://datasheet.lcsc.com/szlcsc/1810191216_Samsung-Electro-Mechanics-CL21B105KBFNNNE_C28323.pdf" H 10095 5595 50 0001 C CNN 411 | F 4 "C28323" H 10095 5595 50 0001 C CNN "manf#" 412 | 1 10095 5595 413 | 1 0 0 -1 414 | $EndComp 415 | Wire Wire Line 416 | 9395 5495 9290 5495 417 | Wire Wire Line 418 | 8770 5495 8770 5465 419 | Wire Wire Line 420 | 9045 5545 9045 5495 421 | Connection ~ 9045 5495 422 | Wire Wire Line 423 | 9045 5495 8770 5495 424 | Wire Wire Line 425 | 9995 5495 10095 5495 426 | Wire Wire Line 427 | 10315 5495 10315 5435 428 | Connection ~ 10095 5495 429 | Wire Wire Line 430 | 10095 5495 10315 5495 431 | Wire Wire Line 432 | 10095 5695 10095 5740 433 | Wire Wire Line 434 | 9045 5745 9045 5785 435 | $Comp 436 | L power:GND #PWR011 437 | U 1 1 5F29B13D 438 | P 9045 5785 439 | F 0 "#PWR011" H 9045 5535 50 0001 C CNN 440 | F 1 "GND" H 9050 5612 50 0000 C CNN 441 | F 2 "" H 9045 5785 50 0001 C CNN 442 | F 3 "" H 9045 5785 50 0001 C CNN 443 | 1 9045 5785 444 | 1 0 0 -1 445 | $EndComp 446 | Wire Wire Line 447 | 9695 5895 9695 5935 448 | $Comp 449 | L power:GND #PWR014 450 | U 1 1 5F29C266 451 | P 9695 5935 452 | F 0 "#PWR014" H 9695 5685 50 0001 C CNN 453 | F 1 "GND" H 9700 5762 50 0000 C CNN 454 | F 2 "" H 9695 5935 50 0001 C CNN 455 | F 3 "" H 9695 5935 50 0001 C CNN 456 | 1 9695 5935 457 | 1 0 0 -1 458 | $EndComp 459 | $Comp 460 | L power:GND #PWR016 461 | U 1 1 5F29C965 462 | P 10095 5740 463 | F 0 "#PWR016" H 10095 5490 50 0001 C CNN 464 | F 1 "GND" H 10100 5567 50 0000 C CNN 465 | F 2 "" H 10095 5740 50 0001 C CNN 466 | F 3 "" H 10095 5740 50 0001 C CNN 467 | 1 10095 5740 468 | 1 0 0 -1 469 | $EndComp 470 | Wire Wire Line 471 | 9395 5595 9290 5595 472 | Wire Wire Line 473 | 9290 5595 9290 5495 474 | Connection ~ 9290 5495 475 | Wire Wire Line 476 | 9290 5495 9045 5495 477 | $Comp 478 | L power:+3V3 #PWR017 479 | U 1 1 5F29E271 480 | P 10315 5435 481 | F 0 "#PWR017" H 10315 5285 50 0001 C CNN 482 | F 1 "+3V3" H 10330 5608 50 0000 C CNN 483 | F 2 "" H 10315 5435 50 0001 C CNN 484 | F 3 "" H 10315 5435 50 0001 C CNN 485 | 1 10315 5435 486 | 1 0 0 -1 487 | $EndComp 488 | $Comp 489 | L power:+5V #PWR010 490 | U 1 1 5F29EC4C 491 | P 8770 5465 492 | F 0 "#PWR010" H 8770 5315 50 0001 C CNN 493 | F 1 "+5V" H 8785 5638 50 0000 C CNN 494 | F 2 "" H 8770 5465 50 0001 C CNN 495 | F 3 "" H 8770 5465 50 0001 C CNN 496 | 1 8770 5465 497 | 1 0 0 -1 498 | $EndComp 499 | $Comp 500 | L power:+5V #PWR02 501 | U 1 1 5F29F5C4 502 | P 2405 1630 503 | F 0 "#PWR02" H 2405 1480 50 0001 C CNN 504 | F 1 "+5V" H 2420 1803 50 0000 C CNN 505 | F 2 "" H 2405 1630 50 0001 C CNN 506 | F 3 "" H 2405 1630 50 0001 C CNN 507 | 1 2405 1630 508 | 1 0 0 -1 509 | $EndComp 510 | NoConn ~ 5380 2940 511 | $Comp 512 | L power:+3V3 #PWR012 513 | U 1 1 5F2A3F1C 514 | P 9175 1640 515 | F 0 "#PWR012" H 9175 1490 50 0001 C CNN 516 | F 1 "+3V3" H 9190 1813 50 0000 C CNN 517 | F 2 "" H 9175 1640 50 0001 C CNN 518 | F 3 "" H 9175 1640 50 0001 C CNN 519 | 1 9175 1640 520 | 1 0 0 -1 521 | $EndComp 522 | Wire Wire Line 523 | 8760 1690 8760 1755 524 | Wire Wire Line 525 | 8760 1955 8760 2065 526 | Wire Notes Line 527 | 3255 7770 3255 475 528 | Wire Notes Line 529 | 3255 475 3250 475 530 | Wire Notes Line 531 | 6980 6535 6980 475 532 | Wire Notes Line 533 | 6980 475 6975 475 534 | Wire Notes Line 535 | 3245 4105 480 4105 536 | Wire Notes Line 537 | 6975 3020 11225 3020 538 | Wire Notes Line 539 | 11225 3020 11225 3030 540 | Wire Notes Line 541 | 11205 4615 6975 4615 542 | Wire Notes Line 543 | 6975 4615 6975 4645 544 | Text Notes 8650 680 0 89 ~ 0 545 | SWD CONNECTOR 546 | Text Notes 8720 3205 0 89 ~ 0 547 | BUTTONS & LED 548 | Text Notes 9030 4785 0 89 ~ 0 549 | REGULATOR 550 | Text Notes 4455 795 0 89 ~ 0 551 | MICROCONTROLLER 552 | Text Notes 1470 620 0 89 ~ 0 553 | USB C 554 | Wire Wire Line 555 | 2570 1910 2755 1910 556 | Wire Wire Line 557 | 2755 1910 2755 2010 558 | Wire Wire Line 559 | 2570 2010 2755 2010 560 | Connection ~ 2755 2010 561 | Wire Wire Line 562 | 2755 2010 2755 2130 563 | $Comp 564 | L power:GND #PWR03 565 | U 1 1 5F2C8F1B 566 | P 2755 2130 567 | F 0 "#PWR03" H 2755 1880 50 0001 C CNN 568 | F 1 "GND" H 2760 1957 50 0000 C CNN 569 | F 2 "" H 2755 2130 50 0001 C CNN 570 | F 3 "" H 2755 2130 50 0001 C CNN 571 | 1 2755 2130 572 | 1 0 0 -1 573 | $EndComp 574 | Wire Wire Line 575 | 9405 3570 9535 3570 576 | $Comp 577 | L Device:R_Small R8 578 | U 1 1 5F2A19DA 579 | P 9635 3570 580 | F 0 "R8" V 9495 3560 50 0000 C CNN 581 | F 1 "1K" V 9560 3565 50 0000 C CNN 582 | F 2 "Resistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder" H 9635 3570 50 0001 C CNN 583 | F 3 "https://datasheet.lcsc.com/szlcsc/1809140835_UNI-ROYAL-Uniroyal-Elec-0805W8J0102T5E_C25623.pdf" H 9635 3570 50 0001 C CNN 584 | F 4 "C25623" V 9635 3570 50 0001 C CNN "manf#" 585 | 1 9635 3570 586 | 0 1 1 0 587 | $EndComp 588 | $Comp 589 | L Device:LED D2 590 | U 1 1 5F2A19E0 591 | P 9930 3570 592 | F 0 "D2" H 9925 3470 50 0000 C CNN 593 | F 1 "LED" H 9920 3675 50 0000 C CNN 594 | F 2 "LED_SMD:LED_0805_2012Metric" H 9930 3570 50 0001 C CNN 595 | F 3 "https://datasheet.lcsc.com/szlcsc/1808272351_Everlight-Elec-17-21SURC-S530-A2-TR8_C131244.pdf" H 9930 3570 50 0001 C CNN 596 | F 4 "C131244" H 9930 3570 50 0001 C CNN "manf#" 597 | 1 9930 3570 598 | -1 0 0 1 599 | $EndComp 600 | Wire Wire Line 601 | 9735 3570 9780 3570 602 | Wire Wire Line 603 | 10080 3570 10150 3570 604 | Wire Wire Line 605 | 10150 3570 10150 3595 606 | $Comp 607 | L power:GND #PWR0101 608 | U 1 1 5F2A19E9 609 | P 10150 3595 610 | F 0 "#PWR0101" H 10150 3345 50 0001 C CNN 611 | F 1 "GND" H 10155 3422 50 0000 C CNN 612 | F 2 "" H 10150 3595 50 0001 C CNN 613 | F 3 "" H 10150 3595 50 0001 C CNN 614 | 1 10150 3595 615 | 1 0 0 -1 616 | $EndComp 617 | Text Label 9405 3570 2 50 ~ 0 618 | LED2 619 | Text Label 2475 1710 0 50 ~ 0 620 | LED2 621 | Wire Wire Line 622 | 2280 1710 2405 1710 623 | Wire Wire Line 624 | 2405 1630 2405 1710 625 | Connection ~ 2405 1710 626 | Wire Wire Line 627 | 2405 1710 2475 1710 628 | Wire Wire Line 629 | 1380 3210 1380 3245 630 | Wire Wire Line 631 | 1380 3245 1680 3245 632 | Connection ~ 1680 3245 633 | Wire Wire Line 634 | 1680 3245 1680 3270 635 | $Comp 636 | L Device:R_Small R9 637 | U 1 1 5F37508C 638 | P 5890 3000 639 | F 0 "R9" V 5820 3045 50 0000 C CNN 640 | F 1 "70" V 5880 3000 50 0000 C CNN 641 | F 2 "Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder" H 5890 3000 50 0001 C CNN 642 | F 3 "~" H 5890 3000 50 0001 C CNN 643 | F 4 "C429431" V 5890 3000 50 0001 C CNN "manf#" 644 | 1 5890 3000 645 | -1 0 0 1 646 | $EndComp 647 | $Comp 648 | L Device:R_Small R10 649 | U 1 1 5F3755BC 650 | P 6035 3000 651 | F 0 "R10" V 5965 3045 50 0000 C CNN 652 | F 1 "70" V 6025 3000 50 0000 C CNN 653 | F 2 "Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder" H 6035 3000 50 0001 C CNN 654 | F 3 "~" H 6035 3000 50 0001 C CNN 655 | F 4 "C429431" V 6035 3000 50 0001 C CNN "manf#" 656 | 1 6035 3000 657 | -1 0 0 1 658 | $EndComp 659 | $Comp 660 | L Device:R_Small R11 661 | U 1 1 5F375902 662 | P 6180 3000 663 | F 0 "R11" V 6110 3045 50 0000 C CNN 664 | F 1 "70" V 6170 3000 50 0000 C CNN 665 | F 2 "Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder" H 6180 3000 50 0001 C CNN 666 | F 3 "~" H 6180 3000 50 0001 C CNN 667 | F 4 "C429431" V 6180 3000 50 0001 C CNN "manf#" 668 | 1 6180 3000 669 | -1 0 0 1 670 | $EndComp 671 | Wire Wire Line 672 | 5735 3140 5890 3140 673 | Wire Wire Line 674 | 5730 3240 6035 3240 675 | Wire Wire Line 676 | 5730 3340 6180 3340 677 | Wire Wire Line 678 | 5890 3100 5890 3140 679 | Connection ~ 5890 3140 680 | Wire Wire Line 681 | 5890 3140 6265 3140 682 | Wire Wire Line 683 | 6035 3100 6035 3240 684 | Connection ~ 6035 3240 685 | Wire Wire Line 686 | 6035 3240 6260 3240 687 | Wire Wire Line 688 | 6180 3100 6180 3340 689 | Connection ~ 6180 3340 690 | Wire Wire Line 691 | 6180 3340 6265 3340 692 | $Comp 693 | L power:+3V3 #PWR018 694 | U 1 1 5F387CBC 695 | P 6035 2745 696 | F 0 "#PWR018" H 6035 2595 50 0001 C CNN 697 | F 1 "+3V3" H 6050 2918 50 0000 C CNN 698 | F 2 "" H 6035 2745 50 0001 C CNN 699 | F 3 "" H 6035 2745 50 0001 C CNN 700 | 1 6035 2745 701 | 1 0 0 -1 702 | $EndComp 703 | Wire Wire Line 704 | 5890 2900 5890 2795 705 | Wire Wire Line 706 | 5890 2795 6035 2795 707 | Wire Wire Line 708 | 6180 2795 6180 2900 709 | Connection ~ 6035 2795 710 | Wire Wire Line 711 | 6035 2795 6180 2795 712 | Wire Wire Line 713 | 6035 2795 6035 2745 714 | Wire Wire Line 715 | 6035 2795 6035 2900 716 | $Comp 717 | L Jumper:Jumper_3_Bridged12 JP1 718 | U 1 1 5F2F87B3 719 | P 4215 2440 720 | F 0 "JP1" H 4215 2644 50 0000 C CNN 721 | F 1 "Jumper" H 4215 2553 50 0000 C CNN 722 | F 2 "Jumper:SolderJumper-3_P1.3mm_Bridged12_RoundedPad1.0x1.5mm" H 4215 2440 50 0001 C CNN 723 | F 3 "~" H 4215 2440 50 0001 C CNN 724 | 1 4215 2440 725 | -1 0 0 -1 726 | $EndComp 727 | Connection ~ 4465 2440 728 | Wire Wire Line 729 | 4465 2440 4455 2440 730 | Wire Wire Line 731 | 4215 2590 4215 2690 732 | Wire Wire Line 733 | 3965 2440 3835 2440 734 | Wire Wire Line 735 | 3835 2440 3835 2315 736 | $Comp 737 | L Regulator_Linear:AP2112K-3.3 U2 738 | U 1 1 5F4DC1B0 739 | P 9695 5595 740 | F 0 "U2" H 9695 5937 50 0000 C CNN 741 | F 1 "AP2112K-3.3" H 9695 5846 50 0000 C CNN 742 | F 2 "Package_TO_SOT_SMD:SOT-23-5" H 9695 5920 50 0001 C CNN 743 | F 3 "https://www.mouser.mx/datasheet/2/115/AP2112-271550.pdf" H 9695 5695 50 0001 C CNN 744 | F 4 "621-AP2112K-3.3TRG1" H 9695 5595 50 0001 C CNN "manf#" 745 | 1 9695 5595 746 | 1 0 0 -1 747 | $EndComp 748 | $Comp 749 | L Connector_Generic:Conn_01x05 J1 750 | U 1 1 5F4EF801 751 | P 9605 1880 752 | F 0 "J1" H 9685 1922 50 0000 L CNN 753 | F 1 "DEBUG_OUTPUT" H 9325 2230 50 0000 L CNN 754 | F 2 "Connector_PinHeader_2.54mm:PinHeader_1x05_P2.54mm_Horizontal" H 9605 1880 50 0001 C CNN 755 | F 3 "~" H 9605 1880 50 0001 C CNN 756 | F 4 "-" H 9605 1880 50 0001 C CNN "manf#" 757 | 1 9605 1880 758 | 1 0 0 -1 759 | $EndComp 760 | Wire Wire Line 761 | 9405 1680 9175 1680 762 | Wire Wire Line 763 | 9175 1680 9175 1640 764 | Wire Wire Line 765 | 9100 2125 9100 1980 766 | Wire Wire Line 767 | 9100 1980 9405 1980 768 | $Comp 769 | L power:+3V3 #PWR019 770 | U 1 1 5F4F7B85 771 | P 8760 1690 772 | F 0 "#PWR019" H 8760 1540 50 0001 C CNN 773 | F 1 "+3V3" H 8775 1863 50 0000 C CNN 774 | F 2 "" H 8760 1690 50 0001 C CNN 775 | F 3 "" H 8760 1690 50 0001 C CNN 776 | 1 8760 1690 777 | 1 0 0 -1 778 | $EndComp 779 | $Comp 780 | L power:GND #PWR020 781 | U 1 1 5F4F8184 782 | P 8760 2065 783 | F 0 "#PWR020" H 8760 1815 50 0001 C CNN 784 | F 1 "GND" H 8765 1892 50 0000 C CNN 785 | F 2 "" H 8760 2065 50 0001 C CNN 786 | F 3 "" H 8760 2065 50 0001 C CNN 787 | 1 8760 2065 788 | 1 0 0 -1 789 | $EndComp 790 | Text Label 6265 3340 0 50 ~ 0 791 | RESET_RX 792 | $EndSCHEMATC 793 | -------------------------------------------------------------------------------- /scripts/nrf52.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/cmsis-dap.cfg] 2 | transport select swd 3 | 4 | set CHIPNAME nrf52832 5 | source [find target/nrf52.cfg] 6 | 7 | adapter srst delay 100 8 | adapter srst pulse_width 100 9 | 10 | init 11 | targets 12 | reset halt 13 | -------------------------------------------------------------------------------- /scripts/saml21.cfg: -------------------------------------------------------------------------------- 1 | source [find interface/cmsis-dap.cfg] 2 | transport select swd 3 | 4 | set CHIPNAME atsaml21j18 5 | source [find target/at91samdXX.cfg] 6 | 7 | adapter srst delay 50 8 | adapter srst pulse_width 500 9 | 10 | init 11 | targets 12 | reset halt 13 | --------------------------------------------------------------------------------