- Changes to sorting in measure() function

- Changes to Zener Voltage Correction /  measure now returns value in volts
- Changes to Motor control
- Resistor values changed
- Created BOM
This commit is contained in:
1nct committed 2022-02-16 10:45:30 +01:00
1 parent 57af1b67a4
commit 4d073dd7f7
8 files changed
+1376 -105

No files matched your search

+84
View File
@@ -0,0 +1,84 @@
"Source:","/home/gab/Documents/RP2040-Decoder/KiCad/RP2040-Decoder-Rev_0_2.kicad_sch"
"Date:","Mo 14 Feb 2022 19:02:20 CET"
"Tool:","Eeschema (6.0.1)"
"Generator:","/usr/share/kicad/plugins/bom_csv_grouped_by_value.py"
"Component Count:","43"
"Individual Components:"
"Item","Qty","Reference(s)","Value","LibPart","Footprint","Datasheet","Comment","Frequency"
"","","C1","10u","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C2","10u","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C3","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C4","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C5","2u2","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C6","2u2","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C7","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C8","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C9","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C10","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C11","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C12","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C13","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C14","2u2","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C15","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C16","33p","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","C17","33p","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"","","D1","KMB24F","RP2040-Decoder_Additional_Symbols:KMB24F","Package_TO_SOT_SMD:TO-269AA","https://datasheet.lcsc.com/lcsc/2010151636_FUXINSEMI-KMB24F_C880910.pdf","TO-269AA = MBS",""
"","","D2","1N4148WS","Diode:1N4148WS","Diode_SMD:D_SOD-323","https://datasheet.lcsc.com/lcsc/2008281134_TWGMC-1N4148WS_C727111.pdf","",""
"","","D3","BZT52C3V3S",":BZT52C3V3S_1","Diode_SMD:D_SOD-323","https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf","",""
"","","D4","BZT52C3V3S",":BZT52C3V3S_2","Diode_SMD:D_SOD-323","https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf","",""
"","","D5","BZT52C3V3S",":BZT52C3V3S_3","Diode_SMD:D_SOD-323","https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf","",""
"","","J1","DCC_IN","Connector:Conn_01x02_Male","Connector_PinHeader_1.00mm:PinHeader_1x02_P1.00mm_Vertical","~","",""
"","","J2","MOTOR_CONN","Connector:Conn_01x04_Male","Connector_PinHeader_1.00mm:PinHeader_1x04_P1.00mm_Vertical","~","",""
"","","J3","GPIO_CONN","Connector:Conn_01x06_Male","Connector_PinHeader_1.00mm:PinHeader_1x06_P1.00mm_Vertical","~","",""
"","","J4","DEBUG_CONN","Connector:Conn_01x04_Male","Connector_PinHeader_1.00mm:PinHeader_1x04_P1.00mm_Vertical","~","",""
"","","Q1","WNM2030",":WNM2030_1","RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad","https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf","",""
"","","Q2","WNM2030",":WNM2030_2","RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad","https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf","",""
"","","Q3","WNM2030",":WNM2030_3","RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad","https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf","",""
"","","Q4","WNM2030","RP2040-Decoder_Additional_Symbols:WNM2030","RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad","https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf","",""
"","","R1","3k9","Device:R","Resistor_SMD:R_0603_1608Metric","~","",""
"","","R3","200",":R_1","Resistor_SMD:R_0603_1608Metric","~","",""
"","","R4","DNF","Device:R","Resistor_SMD:R_0603_1608Metric","~","",""
"","","R5","3k9","Device:R","Resistor_SMD:R_0603_1608Metric","~","",""
"","","R6","3k9","Device:R","Resistor_SMD:R_0603_1608Metric","~","",""
"","","R7","3k9","Device:R","Resistor_SMD:R_0603_1608Metric","~","",""
"","","R8","3k9","Device:R","Resistor_SMD:R_0603_1608Metric","~","",""
"","","R9","1k","Device:R","Resistor_SMD:R_0603_1608Metric","~","",""
"","","U1","PJ75AL33SA","RP2040-Decoder_Additional_Symbols:PJ75AL33SA","Package_TO_SOT_SMD:SOT-23","https://datasheet.lcsc.com/lcsc/1912111437_PJSEMI-PJ75AL33SA_C411736.pdf","",""
"","","U2","BDR6133","RP2040-Decoder_Additional_Symbols:BDR6133","Package_SO:SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalVias","https://datasheet.lcsc.com/lcsc/2101211904_Bardeen-Micro--BDR6133_C2687793.pdf","",""
"","","U3","W25Q64JVSSIQ","RP2040-Decoder_Additional_Symbols:W25Q64JVSSIQ","Package_SO:SOIC-8_5.23x5.23mm_P1.27mm","https://www.winbond.com/resource-files/w25q64jv%20revj%2003272018%20plus.pdf","",""
"","","U4","RP2040","RP2040-Decoder_Additional_Symbols:RP2040","RP2040-Decoder_Additional_Footprints:QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mm","https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf","",""
"","","Y1","X322512MSB4SI",":X322512MSB4SI_1","Crystal:Crystal_SMD_3225-4Pin_3.2x2.5mm","https://datasheet.lcsc.com/lcsc/2103291203_Yangxing-Tech-X322512MSB4SI_C9002.pdf","","12MHz"
"Collated Components:"
"Item","Qty","Reference(s)","Value","LibPart","Footprint","Datasheet","Comment","Frequency"
"1","2","C1, C2","10u","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"2","10","C3, C4, C7, C8, C9, C10, C11, C12, C13, C15","100n","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"3","3","C5, C6, C14","2u2","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"4","2","C16, C17","33p","Device:C","Capacitor_SMD:C_0603_1608Metric","~","",""
"5","1","D1","KMB24F","RP2040-Decoder_Additional_Symbols:KMB24F","Package_TO_SOT_SMD:TO-269AA","https://datasheet.lcsc.com/lcsc/2010151636_FUXINSEMI-KMB24F_C880910.pdf","TO-269AA = MBS",""
"6","1","D2","1N4148WS","Diode:1N4148WS","Diode_SMD:D_SOD-323","https://datasheet.lcsc.com/lcsc/2008281134_TWGMC-1N4148WS_C727111.pdf","",""
"7","1","D3","BZT52C3V3S",":BZT52C3V3S_1","Diode_SMD:D_SOD-323","https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf","",""
"8","1","D4","BZT52C3V3S",":BZT52C3V3S_2","Diode_SMD:D_SOD-323","https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf","",""
"9","1","D5","BZT52C3V3S",":BZT52C3V3S_3","Diode_SMD:D_SOD-323","https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf","",""
"10","1","J1","DCC_IN","Connector:Conn_01x02_Male","Connector_PinHeader_1.00mm:PinHeader_1x02_P1.00mm_Vertical","~","",""
"11","1","J2","MOTOR_CONN","Connector:Conn_01x04_Male","Connector_PinHeader_1.00mm:PinHeader_1x04_P1.00mm_Vertical","~","",""
"12","1","J3","GPIO_CONN","Connector:Conn_01x06_Male","Connector_PinHeader_1.00mm:PinHeader_1x06_P1.00mm_Vertical","~","",""
"13","1","J4","DEBUG_CONN","Connector:Conn_01x04_Male","Connector_PinHeader_1.00mm:PinHeader_1x04_P1.00mm_Vertical","~","",""
"14","1","Q1","WNM2030",":WNM2030_1","RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad","https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf","",""
"15","1","Q2","WNM2030",":WNM2030_2","RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad","https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf","",""
"16","1","Q3","WNM2030",":WNM2030_3","RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad","https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf","",""
"17","1","Q4","WNM2030","RP2040-Decoder_Additional_Symbols:WNM2030","RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad","https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf","",""
"18","5","R1, R5, R6, R7, R8","3k9","Device:R","Resistor_SMD:R_0603_1608Metric","~","",""
"19","1","R3","200",":R_1","Resistor_SMD:R_0603_1608Metric","~","",""
"20","1","R4","DNF","Device:R","Resistor_SMD:R_0603_1608Metric","~","",""
"21","1","R9","1k","Device:R","Resistor_SMD:R_0603_1608Metric","~","",""
"22","1","U1","PJ75AL33SA","RP2040-Decoder_Additional_Symbols:PJ75AL33SA","Package_TO_SOT_SMD:SOT-23","https://datasheet.lcsc.com/lcsc/1912111437_PJSEMI-PJ75AL33SA_C411736.pdf","",""
"23","1","U2","BDR6133","RP2040-Decoder_Additional_Symbols:BDR6133","Package_SO:SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalVias","https://datasheet.lcsc.com/lcsc/2101211904_Bardeen-Micro--BDR6133_C2687793.pdf","",""
"24","1","U3","W25Q64JVSSIQ","RP2040-Decoder_Additional_Symbols:W25Q64JVSSIQ","Package_SO:SOIC-8_5.23x5.23mm_P1.27mm","https://www.winbond.com/resource-files/w25q64jv%20revj%2003272018%20plus.pdf","",""
"25","1","U4","RP2040","RP2040-Decoder_Additional_Symbols:RP2040","RP2040-Decoder_Additional_Footprints:QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mm","https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf","",""
"26","1","Y1","X322512MSB4SI",":X322512MSB4SI_1","Crystal:Crystal_SMD_3225-4Pin_3.2x2.5mm","https://datasheet.lcsc.com/lcsc/2103291203_Yangxing-Tech-X322512MSB4SI_C9002.pdf","","12MHz"
1 Source: /home/gab/Documents/RP2040-Decoder/KiCad/RP2040-Decoder-Rev_0_2.kicad_sch
2 Date: Mo 14 Feb 2022 19:02:20 CET
3 Tool: Eeschema (6.0.1)
4 Generator: /usr/share/kicad/plugins/bom_csv_grouped_by_value.py
5 Component Count: 43
6 Individual Components:
7 Item Qty Reference(s) Value LibPart Footprint Datasheet Comment Frequency
8 C1 10u Device:C Capacitor_SMD:C_0603_1608Metric ~
9 C2 10u Device:C Capacitor_SMD:C_0603_1608Metric ~
10 C3 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
11 C4 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
12 C5 2u2 Device:C Capacitor_SMD:C_0603_1608Metric ~
13 C6 2u2 Device:C Capacitor_SMD:C_0603_1608Metric ~
14 C7 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
15 C8 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
16 C9 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
17 C10 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
18 C11 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
19 C12 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
20 C13 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
21 C14 2u2 Device:C Capacitor_SMD:C_0603_1608Metric ~
22 C15 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
23 C16 33p Device:C Capacitor_SMD:C_0603_1608Metric ~
24 C17 33p Device:C Capacitor_SMD:C_0603_1608Metric ~
25 D1 KMB24F RP2040-Decoder_Additional_Symbols:KMB24F Package_TO_SOT_SMD:TO-269AA https://datasheet.lcsc.com/lcsc/2010151636_FUXINSEMI-KMB24F_C880910.pdf TO-269AA = MBS
26 D2 1N4148WS Diode:1N4148WS Diode_SMD:D_SOD-323 https://datasheet.lcsc.com/lcsc/2008281134_TWGMC-1N4148WS_C727111.pdf
27 D3 BZT52C3V3S :BZT52C3V3S_1 Diode_SMD:D_SOD-323 https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf
28 D4 BZT52C3V3S :BZT52C3V3S_2 Diode_SMD:D_SOD-323 https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf
29 D5 BZT52C3V3S :BZT52C3V3S_3 Diode_SMD:D_SOD-323 https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf
30 J1 DCC_IN Connector:Conn_01x02_Male Connector_PinHeader_1.00mm:PinHeader_1x02_P1.00mm_Vertical ~
31 J2 MOTOR_CONN Connector:Conn_01x04_Male Connector_PinHeader_1.00mm:PinHeader_1x04_P1.00mm_Vertical ~
32 J3 GPIO_CONN Connector:Conn_01x06_Male Connector_PinHeader_1.00mm:PinHeader_1x06_P1.00mm_Vertical ~
33 J4 DEBUG_CONN Connector:Conn_01x04_Male Connector_PinHeader_1.00mm:PinHeader_1x04_P1.00mm_Vertical ~
34 Q1 WNM2030 :WNM2030_1 RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf
35 Q2 WNM2030 :WNM2030_2 RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf
36 Q3 WNM2030 :WNM2030_3 RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf
37 Q4 WNM2030 RP2040-Decoder_Additional_Symbols:WNM2030 RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf
38 R1 3k9 Device:R Resistor_SMD:R_0603_1608Metric ~
39 R3 200 :R_1 Resistor_SMD:R_0603_1608Metric ~
40 R4 DNF Device:R Resistor_SMD:R_0603_1608Metric ~
41 R5 3k9 Device:R Resistor_SMD:R_0603_1608Metric ~
42 R6 3k9 Device:R Resistor_SMD:R_0603_1608Metric ~
43 R7 3k9 Device:R Resistor_SMD:R_0603_1608Metric ~
44 R8 3k9 Device:R Resistor_SMD:R_0603_1608Metric ~
45 R9 1k Device:R Resistor_SMD:R_0603_1608Metric ~
46 U1 PJ75AL33SA RP2040-Decoder_Additional_Symbols:PJ75AL33SA Package_TO_SOT_SMD:SOT-23 https://datasheet.lcsc.com/lcsc/1912111437_PJSEMI-PJ75AL33SA_C411736.pdf
47 U2 BDR6133 RP2040-Decoder_Additional_Symbols:BDR6133 Package_SO:SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalVias https://datasheet.lcsc.com/lcsc/2101211904_Bardeen-Micro--BDR6133_C2687793.pdf
48 U3 W25Q64JVSSIQ RP2040-Decoder_Additional_Symbols:W25Q64JVSSIQ Package_SO:SOIC-8_5.23x5.23mm_P1.27mm https://www.winbond.com/resource-files/w25q64jv%20revj%2003272018%20plus.pdf
49 U4 RP2040 RP2040-Decoder_Additional_Symbols:RP2040 RP2040-Decoder_Additional_Footprints:QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mm https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf
50 Y1 X322512MSB4SI :X322512MSB4SI_1 Crystal:Crystal_SMD_3225-4Pin_3.2x2.5mm https://datasheet.lcsc.com/lcsc/2103291203_Yangxing-Tech-X322512MSB4SI_C9002.pdf 12MHz
51 Collated Components:
52 Item Qty Reference(s) Value LibPart Footprint Datasheet Comment Frequency
53 1 2 C1, C2 10u Device:C Capacitor_SMD:C_0603_1608Metric ~
54 2 10 C3, C4, C7, C8, C9, C10, C11, C12, C13, C15 100n Device:C Capacitor_SMD:C_0603_1608Metric ~
55 3 3 C5, C6, C14 2u2 Device:C Capacitor_SMD:C_0603_1608Metric ~
56 4 2 C16, C17 33p Device:C Capacitor_SMD:C_0603_1608Metric ~
57 5 1 D1 KMB24F RP2040-Decoder_Additional_Symbols:KMB24F Package_TO_SOT_SMD:TO-269AA https://datasheet.lcsc.com/lcsc/2010151636_FUXINSEMI-KMB24F_C880910.pdf TO-269AA = MBS
58 6 1 D2 1N4148WS Diode:1N4148WS Diode_SMD:D_SOD-323 https://datasheet.lcsc.com/lcsc/2008281134_TWGMC-1N4148WS_C727111.pdf
59 7 1 D3 BZT52C3V3S :BZT52C3V3S_1 Diode_SMD:D_SOD-323 https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf
60 8 1 D4 BZT52C3V3S :BZT52C3V3S_2 Diode_SMD:D_SOD-323 https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf
61 9 1 D5 BZT52C3V3S :BZT52C3V3S_3 Diode_SMD:D_SOD-323 https://datasheet.lcsc.com/lcsc/2109071430_YONGYUTAI-BZT52C3V3S_C2892655.pdf
62 10 1 J1 DCC_IN Connector:Conn_01x02_Male Connector_PinHeader_1.00mm:PinHeader_1x02_P1.00mm_Vertical ~
63 11 1 J2 MOTOR_CONN Connector:Conn_01x04_Male Connector_PinHeader_1.00mm:PinHeader_1x04_P1.00mm_Vertical ~
64 12 1 J3 GPIO_CONN Connector:Conn_01x06_Male Connector_PinHeader_1.00mm:PinHeader_1x06_P1.00mm_Vertical ~
65 13 1 J4 DEBUG_CONN Connector:Conn_01x04_Male Connector_PinHeader_1.00mm:PinHeader_1x04_P1.00mm_Vertical ~
66 14 1 Q1 WNM2030 :WNM2030_1 RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf
67 15 1 Q2 WNM2030 :WNM2030_2 RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf
68 16 1 Q3 WNM2030 :WNM2030_3 RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf
69 17 1 Q4 WNM2030 RP2040-Decoder_Additional_Symbols:WNM2030 RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad https://datasheet.lcsc.com/lcsc/1809191616_WILLSEMI-Will-Semicon-WNM2030-3-TR_C239769.pdf
70 18 5 R1, R5, R6, R7, R8 3k9 Device:R Resistor_SMD:R_0603_1608Metric ~
71 19 1 R3 200 :R_1 Resistor_SMD:R_0603_1608Metric ~
72 20 1 R4 DNF Device:R Resistor_SMD:R_0603_1608Metric ~
73 21 1 R9 1k Device:R Resistor_SMD:R_0603_1608Metric ~
74 22 1 U1 PJ75AL33SA RP2040-Decoder_Additional_Symbols:PJ75AL33SA Package_TO_SOT_SMD:SOT-23 https://datasheet.lcsc.com/lcsc/1912111437_PJSEMI-PJ75AL33SA_C411736.pdf
75 23 1 U2 BDR6133 RP2040-Decoder_Additional_Symbols:BDR6133 Package_SO:SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalVias https://datasheet.lcsc.com/lcsc/2101211904_Bardeen-Micro--BDR6133_C2687793.pdf
76 24 1 U3 W25Q64JVSSIQ RP2040-Decoder_Additional_Symbols:W25Q64JVSSIQ Package_SO:SOIC-8_5.23x5.23mm_P1.27mm https://www.winbond.com/resource-files/w25q64jv%20revj%2003272018%20plus.pdf
77 25 1 U4 RP2040 RP2040-Decoder_Additional_Symbols:RP2040 RP2040-Decoder_Additional_Footprints:QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mm https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf
78 26 1 Y1 X322512MSB4SI :X322512MSB4SI_1 Crystal:Crystal_SMD_3225-4Pin_3.2x2.5mm https://datasheet.lcsc.com/lcsc/2103291203_Yangxing-Tech-X322512MSB4SI_C9002.pdf 12MHz
+10 -10
View File
@@ -4041,7 +4041,7 @@
(in_bom yes) (on_board yes) (in_bom yes) (on_board yes)
(uuid 00000000-0000-0000-0000-0000621db99e) (uuid 00000000-0000-0000-0000-0000621db99e)
(property "Reference" "R1" (id 0) (at 36.83 25.4 0)) (property "Reference" "R1" (id 0) (at 36.83 25.4 0))
(property "Value" "10k" (id 1) (at 36.83 27.94 0)) (property "Value" "3k9" (id 1) (at 36.83 27.94 0))
(property "Footprint" "Resistor_SMD:R_0603_1608Metric" (id 2) (at 34.798 26.67 90) (property "Footprint" "Resistor_SMD:R_0603_1608Metric" (id 2) (at 34.798 26.67 90)
(effects (font (size 1.27 1.27)) hide) (effects (font (size 1.27 1.27)) hide)
) )
@@ -4091,7 +4091,7 @@
(in_bom yes) (on_board yes) (in_bom yes) (on_board yes)
(uuid 00000000-0000-0000-0000-0000623b9b34) (uuid 00000000-0000-0000-0000-0000623b9b34)
(property "Reference" "R6" (id 0) (at 250.19 115.57 0)) (property "Reference" "R6" (id 0) (at 250.19 115.57 0))
(property "Value" "10k" (id 1) (at 250.19 118.11 0)) (property "Value" "3k9" (id 1) (at 250.19 118.11 0))
(property "Footprint" "Resistor_SMD:R_0603_1608Metric" (id 2) (at 248.158 116.84 90) (property "Footprint" "Resistor_SMD:R_0603_1608Metric" (id 2) (at 248.158 116.84 90)
(effects (font (size 1.27 1.27)) hide) (effects (font (size 1.27 1.27)) hide)
) )
@@ -4106,7 +4106,7 @@
(in_bom yes) (on_board yes) (in_bom yes) (on_board yes)
(uuid 00000000-0000-0000-0000-0000623ba784) (uuid 00000000-0000-0000-0000-0000623ba784)
(property "Reference" "R8" (id 0) (at 250.19 125.73 0)) (property "Reference" "R8" (id 0) (at 250.19 125.73 0))
(property "Value" "10k" (id 1) (at 250.19 128.27 0)) (property "Value" "3k9" (id 1) (at 250.19 128.27 0))
(property "Footprint" "Resistor_SMD:R_0603_1608Metric" (id 2) (at 248.158 127 90) (property "Footprint" "Resistor_SMD:R_0603_1608Metric" (id 2) (at 248.158 127 90)
(effects (font (size 1.27 1.27)) hide) (effects (font (size 1.27 1.27)) hide)
) )
@@ -4121,7 +4121,7 @@
(in_bom yes) (on_board yes) (in_bom yes) (on_board yes)
(uuid 00000000-0000-0000-0000-0000623ce82a) (uuid 00000000-0000-0000-0000-0000623ce82a)
(property "Reference" "R7" (id 0) (at 217.17 125.73 0)) (property "Reference" "R7" (id 0) (at 217.17 125.73 0))
(property "Value" "10k" (id 1) (at 217.17 128.27 0)) (property "Value" "3k9" (id 1) (at 217.17 128.27 0))
(property "Footprint" "Resistor_SMD:R_0603_1608Metric" (id 2) (at 222.758 127 90) (property "Footprint" "Resistor_SMD:R_0603_1608Metric" (id 2) (at 222.758 127 90)
(effects (font (size 1.27 1.27)) hide) (effects (font (size 1.27 1.27)) hide)
) )
@@ -4136,7 +4136,7 @@
(in_bom yes) (on_board yes) (in_bom yes) (on_board yes)
(uuid 00000000-0000-0000-0000-0000623ce830) (uuid 00000000-0000-0000-0000-0000623ce830)
(property "Reference" "R5" (id 0) (at 217.17 115.57 0)) (property "Reference" "R5" (id 0) (at 217.17 115.57 0))
(property "Value" "10k" (id 1) (at 217.17 118.11 0)) (property "Value" "3k9" (id 1) (at 217.17 118.11 0))
(property "Footprint" "Resistor_SMD:R_0603_1608Metric" (id 2) (at 222.758 116.84 90) (property "Footprint" "Resistor_SMD:R_0603_1608Metric" (id 2) (at 222.758 116.84 90)
(effects (font (size 1.27 1.27)) hide) (effects (font (size 1.27 1.27)) hide)
) )
@@ -5041,7 +5041,7 @@
(reference "Q4") (unit 1) (value "WNM2030") (footprint "RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad") (reference "Q4") (unit 1) (value "WNM2030") (footprint "RP2040-Decoder_Additional_Footprints:SOT-723-Extended_Pad")
) )
(path "/00000000-0000-0000-0000-0000621db99e" (path "/00000000-0000-0000-0000-0000621db99e"
(reference "R1") (unit 1) (value "10k") (footprint "Resistor_SMD:R_0603_1608Metric") (reference "R1") (unit 1) (value "3k9") (footprint "Resistor_SMD:R_0603_1608Metric")
) )
(path "/b8f41645-564e-4e6d-89bf-38ca4d783693" (path "/b8f41645-564e-4e6d-89bf-38ca4d783693"
(reference "R3") (unit 1) (value "200") (footprint "Resistor_SMD:R_0603_1608Metric") (reference "R3") (unit 1) (value "200") (footprint "Resistor_SMD:R_0603_1608Metric")
@@ -5050,16 +5050,16 @@
(reference "R4") (unit 1) (value "DNF") (footprint "Resistor_SMD:R_0603_1608Metric") (reference "R4") (unit 1) (value "DNF") (footprint "Resistor_SMD:R_0603_1608Metric")
) )
(path "/00000000-0000-0000-0000-0000623ce830" (path "/00000000-0000-0000-0000-0000623ce830"
(reference "R5") (unit 1) (value "10k") (footprint "Resistor_SMD:R_0603_1608Metric") (reference "R5") (unit 1) (value "3k9") (footprint "Resistor_SMD:R_0603_1608Metric")
) )
(path "/00000000-0000-0000-0000-0000623b9b34" (path "/00000000-0000-0000-0000-0000623b9b34"
(reference "R6") (unit 1) (value "10k") (footprint "Resistor_SMD:R_0603_1608Metric") (reference "R6") (unit 1) (value "3k9") (footprint "Resistor_SMD:R_0603_1608Metric")
) )
(path "/00000000-0000-0000-0000-0000623ce82a" (path "/00000000-0000-0000-0000-0000623ce82a"
(reference "R7") (unit 1) (value "10k") (footprint "Resistor_SMD:R_0603_1608Metric") (reference "R7") (unit 1) (value "3k9") (footprint "Resistor_SMD:R_0603_1608Metric")
) )
(path "/00000000-0000-0000-0000-0000623ba784" (path "/00000000-0000-0000-0000-0000623ba784"
(reference "R8") (unit 1) (value "10k") (footprint "Resistor_SMD:R_0603_1608Metric") (reference "R8") (unit 1) (value "3k9") (footprint "Resistor_SMD:R_0603_1608Metric")
) )
(path "/00000000-0000-0000-0000-0000620f5623" (path "/00000000-0000-0000-0000-0000620f5623"
(reference "R9") (unit 1) (value "1k") (footprint "Resistor_SMD:R_0603_1608Metric") (reference "R9") (unit 1) (value "1k") (footprint "Resistor_SMD:R_0603_1608Metric")
File diff suppressed because it is too large. Load diff
+13 -10
View File
@@ -262,7 +262,7 @@ void instruction_evaluation(uint8_t number_of_bytes,const uint8_t byte_array[])
} }
//Interrupt handler for DCC Logic Signal //Interrupt handler for DCC Logic Signal
void gpio_callback_rise(unsigned int gpio, long unsigned int events) { void gpio_callback_rise(unsigned int gpio, long unsigned int events) {
add_alarm_in_us(87, &readBit_alarm_callback, NULL, true); add_alarm_in_us(87, &readBit_alarm_callback, NULL, false);
} }
void evaluation(){ void evaluation(){
@@ -288,18 +288,21 @@ void evaluation(){
} }
int main() { int main() {
busy_wait_ms(2000); //busy_wait_ms(2000);
stdio_init_all(); stdio_init_all();
printf("Launched successfully2.\n"); printf("core0 init...\n");
// gpio_init(10); //gpio_init(PICO_DEFAULT_LED_PIN);
// gpio_set_dir(10,GPIO_OUT); //gpio_set_dir(PICO_DEFAULT_LED_PIN,GPIO_OUT);
// gpio_put(10,true); //gpio_put(PICO_DEFAULT_LED_PIN,true);
gpio_init(DCC_INPUT_PIN); gpio_init(DCC_INPUT_PIN);
gpio_set_dir(DCC_INPUT_PIN, GPIO_IN); gpio_set_dir(DCC_INPUT_PIN, GPIO_IN);
gpio_init_mask(ALLOWED_GPIO_MASK); //gpio_init_mask(ALLOWED_GPIO_MASK);
gpio_set_dir_out_masked(ALLOWED_GPIO_MASK); //gpio_set_dir_out_masked(ALLOWED_GPIO_MASK);
multicore_launch_core1(core1_entry); multicore_launch_core1(core1_entry);
gpio_set_irq_enabled_with_callback(DCC_INPUT_PIN, GPIO_IRQ_EDGE_RISE, true, &gpio_callback_rise); gpio_set_irq_enabled_with_callback(DCC_INPUT_PIN, GPIO_IRQ_EDGE_RISE, true, &gpio_callback_rise);
printf("Launched successfully.3\n"); printf("core0 done\n");
while (1) ; while (1){
printf("0\n");
printf("0-\n");
}
} }
+1 -1
View File
@@ -9,7 +9,7 @@
#include "CV.h" #include "CV.h"
#define SIZE_BYTE_ARRAY 5 #define SIZE_BYTE_ARRAY 5
#define SIZE_ACTIVE_FUNCTIONS 32 #define SIZE_ACTIVE_FUNCTIONS 32
#define DCC_INPUT_PIN 11 //Custom: 11 Default: 14 #define DCC_INPUT_PIN 9
//Default //Default
//#define ALLOWED_GPIO_MASK 0b00000000000000000000111111111100 //prevents setting GPIO's that are not allowed (ADC, PWM, ...) //#define ALLOWED_GPIO_MASK 0b00000000000000000000111111111100 //prevents setting GPIO's that are not allowed (ADC, PWM, ...)
//Custom //Custom
+99 -78
View File
@@ -5,9 +5,9 @@
////////////////////////// //////////////////////////
#include "core1.h" #include "core1.h"
int msr_arr[10000] = {0};
uint current_target = 0; uint16_t current_target = 0;
float current_target_voltage = 0;
struct repeating_timer pid_control_timer,speed_helper_timer; struct repeating_timer pid_control_timer,speed_helper_timer;
typedef struct pid_params{ typedef struct pid_params{
@@ -15,12 +15,12 @@ typedef struct pid_params{
float t_s; float t_s;
float a_1; float a_1;
float a_2; float a_2;
int sum_limit_max; float sum_limit_max;
int sum_limit_min; float sum_limit_min;
float output; float output;
int e; float e;
int e_prev; float e_prev;
int e_sum; float e_sum;
}pid_params; }pid_params;
pid_params pid; pid_params pid;
@@ -31,50 +31,28 @@ typedef struct measure_params{
uint8_t right_side_array_cutoff; uint8_t right_side_array_cutoff;
}measure_params; }measure_params;
measure_params msr; measure_params msr;
uint8_t a_factor = 30; /*CV_ARRAY_FLASH[59];..................*/
void quicksort(uint16_t number[], int first, int last){ uint16_t calc_end_target(){
int i, j, pivot, temp;
if(first<last){
pivot=first;
i=first;
j=last;
while(i<j){
while(number[i]<=number[pivot]&&i<last)
i++;
while(number[j]>number[pivot])
j--;
if(i<j){
temp=number[i];
number[i]=number[j];
number[j]=temp;
}
}
temp=number[pivot];
number[pivot]=number[j];
number[j]=temp;
quicksort(number,first,j-1);
quicksort(number,j+1,last);
}
}
uint calc_end_target(){
//Forward //Forward
if(target_direction){ if(target_direction){
if (target_speed_step == 128) return 0; if (target_speed_step == 128) return 0;
else return (target_speed_step - 129) * CV_ARRAY_FLASH[59]; else return (target_speed_step-129) * a_factor ; /* (float) CV_ARRAY_FLASH[59]*/
} }
//Reverse //Reverse
else { else {
if (target_speed_step == 0) return 0; if (target_speed_step == 0) return 0;
else return (target_speed_step-1) * CV_ARRAY_FLASH[59]; else return (target_speed_step-1) * a_factor; /*(float)CV_ARRAY_FLASH[59]*/
} }
} }
bool speed_helper() { bool speed_helper() {
uint8_t accel_rate = CV_ARRAY_FLASH[2]; uint8_t accel_rate = 1; /*CV_ARRAY_FLASH[2];*/
uint8_t decel_rate = CV_ARRAY_FLASH[3]; uint8_t decel_rate = 1; /*CV_ARRAY_FLASH[3];*/
uint end_target = calc_end_target(); uint16_t end_target = calc_end_target();
//current_target only gets adjusted when the counter equals the acc/dec rate
//-> Time for 1 Speed Step := (speed_helper timer delay)*(accel_rate)
static uint8_t speed_helper_counter; static uint8_t speed_helper_counter;
//Emergency Stop //Emergency Stop
if (target_speed_step == 129 || target_speed_step==1) { if (target_speed_step == 129 || target_speed_step==1) {
@@ -83,15 +61,15 @@ bool speed_helper() {
} }
//Acceleration //Acceleration
else if (end_target > current_target && speed_helper_counter == accel_rate) { else if (end_target > current_target && speed_helper_counter == accel_rate) {
current_target += CV_ARRAY_FLASH[59]; current_target += a_factor;
speed_helper_counter = 0; speed_helper_counter = 0;
} }
//Deceleration //Deceleration
else if (end_target < current_target && speed_helper_counter == decel_rate) { else if (end_target < current_target && speed_helper_counter == decel_rate) {
current_target -= CV_ARRAY_FLASH[59]; current_target -= a_factor;
speed_helper_counter = 0; speed_helper_counter = 0;
} }
//Accel/Decel "scheduled" //Acceleration/Deceleration "scheduled"
else if (end_target != current_target){ else if (end_target != current_target){
speed_helper_counter++; speed_helper_counter++;
} }
@@ -99,51 +77,88 @@ bool speed_helper() {
else{ else{
speed_helper_counter = 0; speed_helper_counter = 0;
} }
current_target_voltage = (float)current_target/1260;
return true; return true;
} }
int measure(){ float measure(){
pwm_set_gpio_level(MOTOR_PWM_FORWARD,0); pwm_set_gpio_level(MOTOR_PWM_FORWARD,0);
pwm_set_gpio_level(MOTOR_PWM_REVERSE,0); pwm_set_gpio_level(MOTOR_PWM_REVERSE,0);
adc_select_input(!target_direction); adc_select_input(!target_direction);
busy_wait_us(msr.delay_in_us); busy_wait_us(100/*msr.delay_in_us*/);
//gpio_put(9,true);
uint32_t sum = 0; uint32_t sum = 0;
uint16_t adc_values[msr.total_iterations]; uint16_t adc_val[100/*msr.total_iterations*/];
for (int i = 0; i < msr.total_iterations; ++i) { adc_run(true);
adc_values[i] = adc_read(); int key, j;
for (int i = 0; i < 100/*msr.total_iterations*/; ++i) {
adc_val[i] = adc_fifo_get_blocking();
//Insertion Sort (1 Step)
key = adc_val[i];
j = i - 1;
while (j >= 0 && adc_val[j] > key) {
adc_val[j + 1] = adc_val[j];
j = j - 1;
}
adc_val[j + 1] = key;
} }
//gpio_put(9,false); adc_run(false);
quicksort(adc_values, 0, msr.total_iterations - 1); for (uint8_t i = msr.left_side_array_cutoff; i < 100/*msr.total_iterations*/ - msr.right_side_array_cutoff ; ++i) {
for (uint8_t i = msr.left_side_array_cutoff; i < msr.total_iterations - msr.right_side_array_cutoff ; ++i) { sum += adc_val[i];
sum = sum+adc_values[i];
} }
float result_f = (float)sum/(float)(msr.total_iterations - 20); //V_z is represented in 12bit
if(result_f>MEASURE_CORRECTION_THRESHOLD){ float V_z = (float)sum / (float)(100/*msr.total_iterations*/ - 30);
result_f = 11*result_f*result_f/(1241*1241) - 43*result_f/1241 + 45; //Zener correction (approximated) & Conversion factor for V_z <= 1951
//Returns Value in "Volts"
if (V_z > 1951){
float V_z_sq = V_z * V_z;
return ( C0 + C1 * V_z + C2 * V_z_sq + C3 * V_z * V_z_sq + C4 * V_z_sq * V_z_sq);
} }
int result = (int)result_f; else{
return result; return (L1*V_z);
}
}
void set_pid_params(float v){
float v_max = (float)a_factor/10;
pid.t_s = 5.0f / 1000;
pid.k_p = (-90*v)/v_max+100.0f;
pid.a_1 = 0.0f * pid.t_s; // k_i*t_s
pid.a_2 = 2.0f / pid.t_s; // k_d/t_s
if (pid.k_p<10)pid.k_p=10;
if (pid.a_2<0)pid.k_p=0;
/*if (v > 0.6f * max_voltage){
pid.k_p = 5.0f;
pid.t_s = 5.0f / 1000;
pid.a_1 = 0.5f * pid.t_s; // k_i*t_s
pid.a_2 = 0.0f / pid.t_s; // k_d/t_s
}
else if(v > 0.2f * max_voltage){
pid.k_p = 30.0f;
pid.t_s = 5.0f / 1000;
pid.a_1 = 0.0f * pid.t_s; // k_i*t_s
pid.a_2 = 5.0f / pid.t_s; // k_d/t_s
}*/
//else{
//}
} }
bool pid_control(struct repeating_timer *t){ bool pid_control(struct repeating_timer *t){
static uint counter; float measured_voltage = measure();
int msr_val = measure(); set_pid_params(measured_voltage);
pid.e = (int)current_target - msr_val; pid.e = current_target_voltage - measured_voltage;
msr_arr[counter] = msr_val;
counter++;
pid.e_sum = pid.e_sum + pid.e; pid.e_sum = pid.e_sum + pid.e;
if (pid.e_sum > pid.sum_limit_max) pid.e_sum = pid.sum_limit_max; if (pid.e_sum > pid.sum_limit_max) pid.e_sum = pid.sum_limit_max;
else if (pid.e_sum < pid.sum_limit_min) pid.e_sum = pid.sum_limit_min; else if (pid.e_sum < pid.sum_limit_min) pid.e_sum = pid.sum_limit_min;
pid.output += (pid.k_p * (float)pid.e) + pid.output += (pid.k_p * (float)pid.e) +
(pid.a_1 * (float)pid.e_sum) + // k_i*t_s*e_sum (pid.a_1 * (float)pid.e_sum) + // k_i*t_s*e_sum
(pid.a_2 * (float)(pid.e - pid.e_prev)); // (k_d/t_s)*(e-e_prev) (pid.a_2 * (float)(pid.e - pid.e_prev)); // (k_d/t_s)*(e-e_prev)
pid.e_prev = pid.e; pid.e_prev = pid.e;
if (current_target == 0) pid.output = 0; if (current_target == 0) pid.output = 0;
else if (pid.output > 5000) pid.output = 5000; else if (pid.output > 5000) pid.output = 5000;
else if (pid.output < 1000) pid.output = 1000; else if (pid.output < 1000) pid.output = 1000;
adjust_pwm_level((uint16_t )pid.output); adjust_pwm_level((uint16_t )pid.output);
return true; adc_fifo_drain();
return true;
} }
void init_pid(){ void init_pid(){
@@ -151,12 +166,12 @@ void init_pid(){
// pid.t_s = ((float)CV_ARRAY_FLASH[47] / 1000); // pid.t_s = ((float)CV_ARRAY_FLASH[47] / 1000);
// pid.a_1 = ((float)CV_ARRAY_FLASH[49] / 64) * pid.t_s ; // k_i*t_s // pid.a_1 = ((float)CV_ARRAY_FLASH[49] / 64) * pid.t_s ; // k_i*t_s
// pid.a_2 = ((float)CV_ARRAY_FLASH[50] / 4096) / pid.t_s; // k_d/t_s // pid.a_2 = ((float)CV_ARRAY_FLASH[50] / 4096) / pid.t_s; // k_d/t_s
pid.k_p = 1.0f; //pid.k_p = 5.0f;
pid.t_s = 10.0f / 1000; //pid.t_s = 5.0f / 1000;
pid.a_1 = 0.0f * pid.t_s ; // k_i*t_s //pid.a_1 = 0.5f * pid.t_s; // k_i*t_s
pid.a_2 = 0.0f / pid.t_s; // k_d/t_s //pid.a_2 = 0.0f / pid.t_s; // k_d/t_s
pid.sum_limit_max = CV_ARRAY_FLASH[51] * 10; pid.sum_limit_max = 200.0f;/*(float)(CV_ARRAY_FLASH[51] );*/
pid.sum_limit_min = CV_ARRAY_FLASH[52] * (-10); pid.sum_limit_min = -200.0f;/*(float)(CV_ARRAY_FLASH[52] * (-1));*/
msr.total_iterations = 70;/*CV_ARRAY_FLASH[60];*/ msr.total_iterations = 70;/*CV_ARRAY_FLASH[60];*/
msr.delay_in_us = CV_ARRAY_FLASH[61]; msr.delay_in_us = CV_ARRAY_FLASH[61];
msr.left_side_array_cutoff = 15;/*CV_ARRAY_FLASH[62];*/ msr.left_side_array_cutoff = 15;/*CV_ARRAY_FLASH[62];*/
@@ -182,26 +197,32 @@ void print_cv_array(const uint8_t *buf, size_t len) {
} }
} }
void core1_entry() { void core1_entry() {
printf("core1 init...\n");
if(gpio_get_function(MOTOR_PWM_FORWARD)!=4){ if(gpio_get_function(MOTOR_PWM_FORWARD)!=4){
gpio_set_function(MOTOR_PWM_FORWARD, GPIO_FUNC_PWM); gpio_set_function(MOTOR_PWM_FORWARD, GPIO_FUNC_PWM);
gpio_set_function(MOTOR_PWM_REVERSE, GPIO_FUNC_PWM); gpio_set_function(MOTOR_PWM_REVERSE, GPIO_FUNC_PWM);
adc_init(); adc_init();
adc_gpio_init(V_EMF_ADC_PIN_FORWARD); adc_gpio_init(V_EMF_ADC_PIN_FORWARD);
adc_gpio_init(V_EMF_ADC_PIN_REVERSE); adc_gpio_init(V_EMF_ADC_PIN_REVERSE);
adc_fifo_setup(true,false,0,false,false);
init_pwm(MOTOR_PWM_FORWARD); init_pwm(MOTOR_PWM_FORWARD);
init_pwm(MOTOR_PWM_REVERSE); init_pwm(MOTOR_PWM_REVERSE);
init_pid(); init_pid();
} }
alarm_pool_add_repeating_timer_ms(alarm_pool_create(0,1), alarm_pool_add_repeating_timer_ms(alarm_pool_create(0,1),
10/*CV_ARRAY_FLASH[47]*/, 5/*CV_ARRAY_FLASH[47]*/,
pid_control, pid_control,
NULL, NULL,
&pid_control_timer); &pid_control_timer);
irq_set_priority(0,0x00); // 0x00 is equivalent to the highest priority! irq_set_priority(0,0x00); // 0x00 = highest priority
alarm_pool_add_repeating_timer_ms(alarm_pool_create(1,1), alarm_pool_add_repeating_timer_ms(alarm_pool_create(1,1),
7, 7,
speed_helper, speed_helper,
NULL, NULL,
&speed_helper_timer); &speed_helper_timer);
while (1); printf("core1 done\n");
while (1){
printf("1\n");
printf("-1\n");
}
} }
+11 -4
View File
@@ -8,11 +8,18 @@
#include "shared.h" #include "shared.h"
#define V_EMF_ADC_PIN_FORWARD 26 #define V_EMF_ADC_PIN_FORWARD 26
#define V_EMF_ADC_PIN_REVERSE 27 #define V_EMF_ADC_PIN_REVERSE 27
#define MEASURE_CORRECTION_THRESHOLD 2271
void quicksort(uint16_t number[], int first, int last); #define MEASURE_CORRECTION_THRESHOLD 1695
uint calc_end_target(); #define L1 0.001611328125f
#define C0 26.18270299751651f
#define C1 -0.04661614287233649f
#define C2 3.29589342261872e-05f
#define C3 -1.000062393830345e-08f
#define C4 1.15408454807169e-12f
uint16_t calc_end_target();
bool speed_helper(); bool speed_helper();
int measure(); float measure();
void init_pid(); void init_pid();
void init_pwm(uint gpio); void init_pwm(uint gpio);
void print_cv_array(const uint8_t *buf, size_t len); void print_cv_array(const uint8_t *buf, size_t len);
+2 -2
View File
@@ -14,8 +14,8 @@
#include "hardware/flash.h" #include "hardware/flash.h"
#include "hardware/irq.h" #include "hardware/irq.h"
#include "stdint.h" #include "stdint.h"
#define MOTOR_PWM_FORWARD 10 //Custom: 10 Default: 12 #define MOTOR_PWM_FORWARD 22
#define MOTOR_PWM_REVERSE 13 #define MOTOR_PWM_REVERSE 23
extern repeating_timer_t pid_control_timer; extern repeating_timer_t pid_control_timer;
extern repeating_timer_t speed_helper_timer; extern repeating_timer_t speed_helper_timer;
extern bool target_direction; extern bool target_direction;