1# GD32F405XX pin definitions
2#
3# Sources:
4# - GD32F405XX Datasheet (Revision 2.2)
5#
6# Pin codes:
7#
8# - 64  pins: R
9# - 100 pins: V
10# - 144 pins: Z
11#
12# Memory codes:
13#
14# - 512Kb  Flash, 192Kb SRAM: E
15# - 1024Kb Flash, 192Kb SRAM: G
16# - 3072Kb Flash, 192Kb SRAM: K
17#
18# Copyright (c) 2021 BrainCo Inc.
19# SPDX-License-Identifier: Apache 2.0
20
21model: af
22
23series: gd32f405
24
25variants:
26  - pincode: R
27    memories: [G, K]
28  - pincode: V
29    memories: [G, K]
30  - pincode: Z
31    memories: [E, G, K]
32
33pins:
34  PA0:
35    pincodes: [R, V, Z]
36    afs:
37      ADC012_IN0: ANALOG
38      TIMER1_CH0: 1
39      TIMER1_ETI: 1
40      TIMER4_CH0: 2
41      TIMER7_ETI: 3
42      USART1_CTS: 7
43      UART3_TX: 8
44      EVENTOUT: 15
45  PA1:
46    pincodes: [R, V, Z]
47    afs:
48      ADC012_IN1: ANALOG
49      TIMER1_CH1: 1
50      TIMER4_CH1: 2
51      USART1_RTS: 7
52      UART3_RX: 8
53      EVENTOUT: 15
54  PA2:
55    pincodes: [R, V, Z]
56    afs:
57      ADC012_IN2: ANALOG
58      TIMER1_CH2: 1
59      TIMER4_CH2: 2
60      TIMER8_CH0: 3
61      I2S_CKIN: 5
62      USART1_TX: 7
63      EVENTOUT: 15
64  PA3:
65    pincodes: [R, V, Z]
66    afs:
67      ADC012_IN3: ANALOG
68      TIMER1_CH3: 1
69      TIMER4_CH3: 2
70      TIMER8_CH1: 3
71      I2S1_MCK: 5
72      USART1_RX: 7
73      USBHS_ULPI_D0: 10
74      EVENTOUT: 15
75  PA4:
76    pincodes: [R, V, Z]
77    afs:
78      ADC01_IN4: ANALOG
79      DAC_OUT0: ANALOG
80      SPI0_NSS: 5
81      SPI2_NSS: 6
82      I2S2_WS: 6
83      USART1_CK: 7
84      USBHS_SOF: 12
85      DCI_HSYNC: 13
86      EVENTOUT: 15
87  PA5:
88    pincodes: [R, V, Z]
89    afs:
90      ADC01_IN5: ANALOG
91      DAC_OUT1: ANALOG
92      TIMER1_CH0: 1
93      TIMER1_ETI: 1
94      TIMER7_CH0_ON: 3
95      SPI0_SCK: 5
96      USBHS_ULPI_CK: 10
97      EVENTOUT: 15
98  PA6:
99    pincodes: [R, V, Z]
100    afs:
101      ADC01_IN6: ANALOG
102      TIMER0_BRKIN: 1
103      TIMER2_CH0: 2
104      TIMER7_BRKIN: 3
105      SPI0_MISO: 5
106      I2S1_MCK: 6
107      TIMER12_CH0: 9
108      SDIO_CMD: 12
109      DCI_PIXCLK: 13
110      EVENTOUT: 15
111  PA7:
112    pincodes: [R, V, Z]
113    afs:
114      ADC01_IN7: ANALOG
115      TIMER0_CH0_ON: 1
116      TIMER2_CH1: 2
117      TIMER7_CH0_ON: 3
118      SPI0_MOSI: 5
119      TIMER13_CH0: 9
120      EVENTOUT: 15
121  PA8:
122    pincodes: [R, V, Z]
123    afs:
124      CK_OUT0: 0
125      TIMER0_CH0: 1
126      I2C2_SCL: 4
127      USART0_CK: 7
128      CTC_SYNC: 9
129      USBFS_SOF: 10
130      SDIO_D1: 12
131      EVENTOUT: 15
132  PA9:
133    pincodes: [R, V, Z]
134    afs:
135      TIMER0_CH1: 1
136      I2C2_SMBA: 4
137      SPI1_SCK: 5
138      I2S1_CK: 5
139      USART0_TX: 7
140      SDIO_D2: 12
141      DCI_D0: 13
142      EVENTOUT: 15
143  PA10:
144    pincodes: [R, V, Z]
145    afs:
146      TIMER0_CH2: 1
147      I2C2_TXFRAME: 4
148      USART0_RX: 7
149      USBFS_ID: 10
150      DCI_D1: 13
151      EVENTOUT: 15
152  PA11:
153    pincodes: [R, V, Z]
154    afs:
155      TIMER0_CH3: 1
156      USART0_CTS: 7
157      USART5_TX: 8
158      CAN0_RX: 9
159      USBFS_DM: 10
160      EVENTOUT: 15
161  PA12:
162    pincodes: [R, V, Z]
163    afs:
164      TIMER0_ETI: 1
165      USART0_RTS: 7
166      USART5_RX: 8
167      CAN0_TX: 9
168      USBFS_DP: 10
169      EVENTOUT: 15
170  PA13:
171    pincodes: [R, V, Z]
172    afs:
173      JTMS: 0
174      SWDIO: 0
175      EVENTOUT: 15
176  PA14:
177    pincodes: [R, V, Z]
178    afs:
179      JTCK: 0
180      SWCLK: 0
181      EVENTOUT: 15
182  PA15:
183    pincodes: [R, V, Z]
184    afs:
185      JTDI: 0
186      TIMER1_CH0: 1
187      TIMER1_ETI: 1
188      SPI0_NSS: 5
189      SPI2_NSS: 6
190      I2S2_WS: 6
191      USART0_TX: 7
192      EVENTOUT: 15
193  PB0:
194    pincodes: [R, V, Z]
195    afs:
196      ADC01_IN8: ANALOG
197      TIMER0_CH1_ON: 1
198      TIMER2_CH2: 2
199      TIMER7_CH1_ON: 3
200      SPI2_MOSI: 7
201      I2S2_SD: 7
202      USBHS_ULPI_D1: 10
203      SDIO_D1: 12
204      EVENTOUT: 15
205  PB1:
206    pincodes: [R, V, Z]
207    afs:
208      ADC01_IN9: ANALOG
209      TIMER0_CH2_ON: 1
210      TIMER2_CH3: 2
211      TIMER7_CH2_ON: 3
212      USBHS_ULPI_D2: 10
213      SDIO_D2: 12
214      EVENTOUT: 15
215  PB2:
216    pincodes: [R, V, Z]
217    afs:
218      TIMER1_CH3: 1
219      SPI2_MOSI: 7
220      I2S2_SD: 7
221      USBHS_ULPI_D4: 10
222      SDIO_CK: 12
223      EVENTOUT: 15
224  PB3:
225    pincodes: [R, V, Z]
226    afs:
227      JTDO: 0
228      TRACESWO: 0
229      TIMER1_CH1: 1
230      SPI0_SCK: 5
231      SPI2_SCK: 6
232      I2S2_CK: 6
233      USART0_RX: 7
234      I2C1_SDA: 9
235      EVENTOUT: 15
236  PB4:
237    pincodes: [R, V, Z]
238    afs:
239      NJTRST: 0
240      TIMER2_CH0: 2
241      I2C0_TXFRAME: 4
242      SPI0_MISO: 5
243      SPI2_MISO: 6
244      I2S2_ADD_SD: 7
245      I2C2_SDA: 9
246      SDIO_D0: 12
247      EVENTOUT: 15
248  PB5:
249    pincodes: [R, V, Z]
250    afs:
251      TIMER2_CH1: 2
252      I2C0_SMBA: 4
253      SPI0_MOSI: 5
254      SPI2_MOSI: 6
255      I2S2_SD: 6
256      CAN1_RX: 9
257      USBHS_ULPI_D7: 10
258      DCI_D10: 13
259      EVENTOUT: 15
260  PB6:
261    pincodes: [R, V, Z]
262    afs:
263      TIMER3_CH0: 2
264      I2C0_SCL: 4
265      USART0_TX: 7
266      CAN1_TX: 9
267      DCI_D5: 13
268      EVENTOUT: 15
269  PB7:
270    pincodes: [R, V, Z]
271    afs:
272      TIMER3_CH1: 2
273      I2C0_SDA: 4
274      USART0_RX: 7
275      DCI_VSYNC: 13
276      EVENTOUT: 15
277  PB8:
278    pincodes: [R, V, Z]
279    afs:
280      TIMER1_CH0: 1
281      TIMER1_ETI: 1
282      TIMER3_CH2: 2
283      TIMER9_CH0: 3
284      I2C0_SCL: 4
285      CAN0_RX: 9
286      SDIO_D4: 12
287      DCI_D6: 13
288      EVENTOUT: 15
289  PB9:
290    pincodes: [R, V, Z]
291    afs:
292      TIMER1_CH1: 1
293      TIMER3_CH3: 2
294      TIMER10_CH0: 3
295      I2C0_SDA: 4
296      SPI1_NSS: 5
297      I2S1_WS: 5
298      CAN0_TX: 9
299      SDIO_D5: 12
300      DCI_D7: 13
301      EVENTOUT: 15
302  PB10:
303    pincodes: [R, V, Z]
304    afs:
305      TIMER1_CH2: 1
306      I2C1_SCL: 4
307      SPI1_SCK: 5
308      I2S1_CK: 5
309      I2S2_MCK: 6
310      USART2_TX: 7
311      USBHS_ULPI_D3: 10
312      SDIO_D7: 12
313      EVENTOUT: 15
314  PB11:
315    pincodes: [R, V, Z]
316    afs:
317      TIMER1_CH3: 1
318      I2C1_SDA: 4
319      I2S_CKIN: 5
320      USART2_RX: 7
321      USBHS_ULPI_D4: 10
322      EVENTOUT: 15
323  PB12:
324    pincodes: [R, V, Z]
325    afs:
326      TIMER0_BRKIN: 1
327      I2C1_SMBA: 4
328      SPI1_NSS: 5
329      I2S1_WS: 5
330      USART2_CK: 7
331      CAN1_RX: 9
332      USBHS_ULPI_D5: 10
333      USBHS_ID: 12
334      EVENTOUT: 15
335  PB13:
336    pincodes: [R, V, Z]
337    afs:
338      TIMER0_CH0_ON: 1
339      I2C1_TXFRAME: 4
340      SPI1_SCK: 5
341      I2S1_CK: 5
342      USART2_CTS: 7
343      CAN1_TX: 9
344      USBHS_ULPI_D6: 10
345      EVENTOUT: 15
346  PB14:
347    pincodes: [R, V, Z]
348    afs:
349      TIMER0_CH1_ON: 1
350      TIMER7_CH1_ON: 3
351      SPI1_MISO: 5
352      I2S1_ADD_SD: 6
353      USART2_RTS: 7
354      TIMER11_CH0: 9
355      USBHS_DM: 12
356      EVENTOUT: 15
357  PB15:
358    pincodes: [R, V, Z]
359    afs:
360      RTC_REFIN: 0
361      TIMER0_CH2_ON: 1
362      TIMER7_CH2_ON: 3
363      SPI1_MOSI: 5
364      I2S1_SD: 5
365      TIMER11_CH1: 9
366      USBHS_DP: 12
367      EVENTOUT: 15
368  PC0:
369    pincodes: [R, V, Z]
370    afs:
371      ADC012_IN10: ANALOG
372      USBHS_ULPI_STP: 10
373      EVENTOUT: 15
374  PC1:
375    pincodes: [R, V, Z]
376    afs:
377      ADC012_IN11: ANALOG
378      SPI2_MOSI: 5
379      I2S2_SD: 5
380      SPI1_MOSI: 7
381      I2S1_SD: 7
382      EVENTOUT: 15
383  PC2:
384    pincodes: [R, V, Z]
385    afs:
386      ADC012_IN12: ANALOG
387      SPI1_MISO: 5
388      I2S1_ADD_SD: 6
389      USBHS_ULPI_DIR: 10
390      EVENTOUT: 15
391  PC3:
392    pincodes: [R, V, Z]
393    afs:
394      ADC012_IN13: ANALOG
395      SPI1_MOSI: 5
396      I2S1_SD: 5
397      USBHS_ULPI_NXT: 10
398      EVENTOUT: 15
399  PC4:
400    pincodes: [R, V, Z]
401    afs:
402      ADC01_IN14: ANALOG
403      EVENTOUT: 15
404  PC5:
405    pincodes: [R, V, Z]
406    afs:
407      ADC01_IN15: ANALOG
408      USART2_RX: 7
409      EVENTOUT: 15
410  PC6:
411    pincodes: [R, V, Z]
412    afs:
413      TIMER2_CH0: 2
414      TIMER7_CH0: 3
415      I2S1_MCK: 5
416      USART5_TX: 8
417      SDIO_D6: 12
418      DCI_D0: 13
419      EVENTOUT: 15
420  PC7:
421    pincodes: [R, V, Z]
422    afs:
423      TIMER2_CH1: 2
424      TIMER7_CH1: 3
425      SPI1_SCK: 5
426      I2S1_CK: 5
427      I2S2_MCK: 6
428      USART5_RX: 8
429      SDIO_D7: 12
430      DCI_D1: 13
431      EVENTOUT: 15
432  PC8:
433    pincodes: [R, V, Z]
434    afs:
435      TRACED0: 0
436      TIMER2_CH2: 2
437      TIMER7_CH2: 3
438      USART5_CK: 8
439      SDIO_D0: 12
440      DCI_D2: 13
441      EVENTOUT: 15
442  PC9:
443    pincodes: [R, V, Z]
444    afs:
445      CK_OUT1: 0
446      TIMER2_CH3: 2
447      TIMER7_CH3: 3
448      I2C2_SDA: 4
449      I2S_CKIN: 5
450      SDIO_D1: 12
451      DCI_D3: 13
452      EVENTOUT: 15
453  PC10:
454    pincodes: [R, V, Z]
455    afs:
456      SPI2_SCK: 6
457      I2S2_CK: 6
458      USART2_TX: 7
459      UART3_TX: 8
460      SDIO_D2: 12
461      DCI_D8: 13
462      EVENTOUT: 15
463  PC11:
464    pincodes: [R, V, Z]
465    afs:
466      I2S2_ADD_SD: 5
467      SPI2_MISO: 6
468      USART2_RX: 7
469      UART3_RX: 8
470      SDIO_D3: 12
471      DCI_D4: 13
472      EVENTOUT: 15
473  PC12:
474    pincodes: [R, V, Z]
475    afs:
476      I2C1_SDA: 4
477      SPI2_MOSI: 6
478      I2S2_SD: 6
479      USART2_CK: 7
480      UART4_TX: 8
481      SDIO_CK: 12
482      DCI_D9: 13
483      EVENTOUT: 15
484  PC13:
485    pincodes: [R, V, Z]
486    afs:
487      EVENTOUT: 15
488  PC14:
489    pincodes: [R, V, Z]
490    afs:
491      EVENTOUT: 15
492  PC15:
493    pincodes: [R, V, Z]
494    afs:
495      EVENTOUT: 15
496  PD0:
497    pincodes: [V, Z]
498    afs:
499      SPI2_MOSI: 6
500      I2S2_SD: 6
501      CAN0_RX: 9
502      EVENTOUT: 15
503  PD1:
504    pincodes: [V, Z]
505    afs:
506      SPI1_NSS: 7
507      I2S1_WS: 7
508      CAN0_TX: 9
509      EVENTOUT: 15
510  PD2:
511    pincodes: [R, V, Z]
512    afs:
513      TIMER2_ETI: 2
514      UART4_RX: 8
515      SDIO_CMD: 12
516      DCI_D11: 13
517      EVENTOUT: 15
518  PD3:
519    pincodes: [V, Z]
520    afs:
521      TRACED1: 0
522      SPI1_SCK: 5
523      I2S1_CK: 5
524      USART1_CTS: 7
525      DCI_D5: 13
526      EVENTOUT: 15
527  PD4:
528    pincodes: [V, Z]
529    afs:
530      USART1_RTS: 7
531      EVENTOUT: 15
532  PD5:
533    pincodes: [V, Z]
534    afs:
535      USART1_TX: 7
536      EVENTOUT: 15
537  PD6:
538    pincodes: [V, Z]
539    afs:
540      SPI2_MOSI: 5
541      I2S2_SD: 5
542      USART1_RX: 7
543      DCI_D10: 13
544      EVENTOUT: 15
545  PD7:
546    pincodes: [V, Z]
547    afs:
548      USART1_CK: 7
549      EVENTOUT: 15
550  PD8:
551    pincodes: [V, Z]
552    afs:
553      USART2_TX: 7
554      EVENTOUT: 15
555  PD9:
556    pincodes: [V, Z]
557    afs:
558      USART2_RX: 7
559      EVENTOUT: 15
560  PD10:
561    pincodes: [V, Z]
562    afs:
563      USART2_CK: 7
564      EVENTOUT: 15
565  PD11:
566    pincodes: [V, Z]
567    afs:
568      USART2_CTS: 7
569      EVENTOUT: 15
570  PD12:
571    pincodes: [V, Z]
572    afs:
573      TIMER3_CH0: 2
574      USART2_RTS: 7
575      EVENTOUT: 15
576  PD13:
577    pincodes: [V, Z]
578    afs:
579      TIMER3_CH1: 2
580      EVENTOUT: 15
581  PD14:
582    pincodes: [V, Z]
583    afs:
584      TIMER3_CH2: 2
585      EVENTOUT: 15
586  PD15:
587    pincodes: [V, Z]
588    afs:
589      CTC_SYNC: 0
590      TIMER3_CH3: 2
591      EVENTOUT: 15
592  PE0:
593    pincodes: [V, Z]
594    afs:
595      TIMER3_ETI: 2
596      DCI_D2: 13
597      EVENTOUT: 15
598  PE1:
599    pincodes: [V, Z]
600    afs:
601      TIMER0_CH1_ON: 1
602      DCI_D3: 13
603      EVENTOUT: 15
604  PE2:
605    pincodes: [V, Z]
606    afs:
607      TRACECK: 0
608      EVENTOUT: 15
609  PE3:
610    pincodes: [V, Z]
611    afs:
612      TRACED0: 0
613      EVENTOUT: 15
614  PE4:
615    pincodes: [V, Z]
616    afs:
617      TRACED1: 0
618      DCI_D4: 13
619      EVENTOUT: 15
620  PE5:
621    pincodes: [V, Z]
622    afs:
623      TRACED2: 0
624      TIMER8_CH0: 3
625      DCI_D6: 13
626      EVENTOUT: 15
627  PE6:
628    pincodes: [V, Z]
629    afs:
630      TRACED3: 0
631      TIMER8_CH1: 3
632      DCI_D7: 13
633      EVENTOUT: 15
634  PE7:
635    pincodes: [V, Z]
636    afs:
637      TIMER0_ETI: 0
638      EVENTOUT: 15
639  PE8:
640    pincodes: [V, Z]
641    afs:
642      TIMER0_CH0_ON: 1
643      EVENTOUT: 15
644  PE9:
645    pincodes: [V, Z]
646    afs:
647      TIMER0_CH0: 0
648      EVENTOUT: 15
649  PE10:
650    pincodes: [V, Z]
651    afs:
652      TIMER0_CH1_ON: 1
653      EVENTOUT: 15
654  PE11:
655    pincodes: [V, Z]
656    afs:
657      TIMER0_CH1: 0
658      EVENTOUT: 15
659  PE12:
660    pincodes: [V, Z]
661    afs:
662      TIMER0_CH2_ON: 1
663      EVENTOUT: 15
664  PE13:
665    pincodes: [V, Z]
666    afs:
667      TIMER0_CH2: 0
668      EVENTOUT: 15
669  PE14:
670    pincodes: [V, Z]
671    afs:
672      TIMER0_CH3: 0
673      EVENTOUT: 15
674  PE15:
675    pincodes: [V, Z]
676    afs:
677      TIMER0_BRKIN: 1
678      EVENTOUT: 15
679  PF0:
680    pincodes: [Z]
681    afs:
682      CTC_SYNC: 0
683      I2C1_SDA: 4
684      EVENTOUT: 15
685  PF1:
686    pincodes: [Z]
687    afs:
688      I2C1_SCL: 4
689      EVENTOUT: 15
690  PF2:
691    pincodes: [Z]
692    afs:
693      I2C1_SMBA: 4
694      EVENTOUT: 15
695  PF3:
696    pincodes: [Z]
697    afs:
698      ADC2_IN9: ANALOG
699      I2C1_TXFRAME: 4
700      EVENTOUT: 15
701  PF4:
702    pincodes: [Z]
703    afs:
704      ADC2_IN14: ANALOG
705      EVENTOUT: 15
706  PF5:
707    pincodes: [Z]
708    afs:
709      ADC2_IN15: ANALOG
710      EVENTOUT: 15
711  PF6:
712    pincodes: [Z]
713    afs:
714      ADC2_IN4: ANALOG
715      TIMER9_CH0: 3
716      EVENTOUT: 15
717  PF7:
718    pincodes: [Z]
719    afs:
720      ADC2_IN5: ANALOG
721      TIMER10_CH0: 3
722      EVENTOUT: 15
723  PF8:
724    pincodes: [Z]
725    afs:
726      ADC2_IN6: ANALOG
727      TIMER12_CH0: 9
728      EVENTOUT: 15
729  PF9:
730    pincodes: [Z]
731    afs:
732      ADC2_IN7: ANALOG
733      TIMER13_CH0: 9
734      EVENTOUT: 15
735  PF10:
736    pincodes: [Z]
737    afs:
738      ADC2_IN8: ANALOG
739      DCI_D11: 13
740      EVENTOUT: 15
741  PF11:
742    pincodes: [Z]
743    afs:
744      DCI_D12: 13
745      EVENTOUT: 15
746  PF12:
747    pincodes: [Z]
748    afs:
749      EVENTOUT: 15
750  PF13:
751    pincodes: [Z]
752    afs:
753      EVENTOUT: 15
754  PF14:
755    pincodes: [Z]
756    afs:
757      EVENTOUT: 15
758  PF15:
759    pincodes: [Z]
760    afs:
761      EVENTOUT: 15
762  PG0:
763    pincodes: [Z]
764    afs:
765      EVENTOUT: 15
766  PG1:
767    pincodes: [Z]
768    afs:
769      EVENTOUT: 15
770  PG2:
771    pincodes: [Z]
772    afs:
773      EVENTOUT: 15
774  PG3:
775    pincodes: [Z]
776    afs:
777      EVENTOUT: 15
778  PG4:
779    pincodes: [Z]
780    afs:
781      EVENTOUT: 15
782  PG5:
783    pincodes: [Z]
784    afs:
785      EVENTOUT: 15
786  PG6:
787    pincodes: [Z]
788    afs:
789      DCI_D12: 13
790      EVENTOUT: 15
791  PG7:
792    pincodes: [Z]
793    afs:
794      USART5_CK: 8
795      DCI_D13: 13
796      EVENTOUT: 15
797  PG8:
798    pincodes: [Z]
799    afs:
800      USART5_RTS: 8
801      EVENTOUT: 15
802  PG9:
803    pincodes: [Z]
804    afs:
805      USART5_RX: 8
806      DCI_VSYNC: 13
807      EVENTOUT: 15
808  PG10:
809    pincodes: [Z]
810    afs:
811      DCI_D2: 13
812      EVENTOUT: 15
813  PG11:
814    pincodes: [Z]
815    afs:
816      DCI_D3: 13
817      EVENTOUT: 15
818  PG12:
819    pincodes: [Z]
820    afs:
821      USART5_RTS: 8
822      EVENTOUT: 15
823  PG13:
824    pincodes: [Z]
825    afs:
826      TRACED2: 0
827      USART5_CTS: 8
828      EVENTOUT: 15
829  PG14:
830    pincodes: [Z]
831    afs:
832      TRACED3: 0
833      USART5_TX: 8
834      EVENTOUT: 15
835  PG15:
836    pincodes: [Z]
837    afs:
838      USART5_CTS: 8
839      DCI_D13: 13
840      EVENTOUT: 15
841