Updated Can speed chose option

This commit is contained in:
sorek 2024-01-30 17:38:31 +00:00
parent 861fa61489
commit b81bb112bc
4 changed files with 19 additions and 8 deletions

View File

@ -23,6 +23,14 @@ HardwareSerial Serial3(USART3); //for some reason this isn't defined in arduino_
enum BitRate { CAN_50KBPS, CAN_100KBPS, CAN_125KBPS, CAN_250KBPS, CAN_500KBPS, CAN_1000KBPS };
BitRate bitRateArray[4] = {
CAN_500KBPS,
CAN_1000KBPS,
CAN_125KBPS,
CAN_250KBPS,
};
typedef struct {
uint16_t id;
uint8_t data[8];
@ -74,12 +82,13 @@ enum IdCan {
};
enum IdPins {
ID_PIN0 = PB3,
ID_PIN1 = PB4,
ID_PIN2 = PB5,
ID_PIN3 = PB6,
ID_PIN4 = PB7,
CAN_SPEED_PIN = PB8
ID_PIN0 = PB3,
ID_PIN1 = PB4,
ID_PIN2 = PB5,
ID_PIN3 = PB6,
ID_PIN4 = PB7,
CAN_SPEED_PIN1 = PB8,
CAN_SPEED_PIN2 = PB9
};
struct IdAddrCan {
@ -132,7 +141,8 @@ void canInit(enum BitRate bitrate) {
}
void setup() {
pinMode(CAN_SPEED_PIN, INPUT_PULLUP);
pinMode(CAN_SPEED_PIN1, INPUT_PULLUP);
pinMode(CAN_SPEED_PIN2, INPUT_PULLUP);
uint16_t canMask = 0;
for(uint8_t i = 0; i < ID_CAN_SIZE; ++i) {
pinMode(pins[i].pin, INPUT_PULLUP);
@ -142,7 +152,8 @@ void setup() {
max31855_OK_bits = 0;
Serial.begin(115200); //debug
Serial3.begin(115200); //data to speeduino
canInit(digitalRead(CAN_SPEED_PIN) ? CAN_500KBPS : CAN_1000KBPS); //init can at 500KBPS speed
BitRate canSpeed = bitRateArray[digitalRead(CAN_SPEED_PIN2) <<1 | digitalRead(CAN_SPEED_PIN1)];
canInit(canSpeed); //init can at 500KBPS speed
CAN_msg_14.len = 8; //8 bytes in can message
CAN_msg_58.len = 8;
CAN_msg_14.id = Sensor1_4_CAN_ADDRESS | canMask;

Binary file not shown.
1 ID Name Designator Footprint Quantity Manufacturer Part Manufacturer Supplier Supplier Part Price
2 1 12pF C12,C13 C0603 2 CL10C120JB8NNNC SAMSUNG(三星) LCSC C38523 0.005
3 2 8MHz X1 OSC-SMD_L5.0-W3.2 1 ABM3-8.000MHZ-D2Y-T ABRACON LCSC C144380 0.42
4 3 776280-1 CN1 CONN-TH_TE_776280-1 1 776280-1 TE Connectivity(美国泰科) LCSC C498611 8.222
5 4 SS14 D1,D2,D3 SMA_L4.2-W2.6-LS5.3-RD 3 SS14 MDD LCSC C2480 0.013
6 5 B1205S-2WR2_C2992386 U12 PWRM-TH_BXXXXS-2WR2 1 B1205S-2WR2 YLPTEC(易川) LCSC C2992386 1.367
7 6 SN65HVD231DR U10 SOIC-8_L4.9-W3.9-P1.27-LS6.0-BL 1 SN65HVD231DR TI LCSC C129257 1.133
8 7 10nF C1,C2,C3,C4,C5,C6,C7,C8,C16,C17 0805 10 CL21B103KBCNNNC SAMSUNG LCSC C84715 0.009
9 8 120 R3 R0603 1 0603WAF1200T5E UniOhm LCSC C22787 0.001
10 9 10kΩ R4,R6 R0603 2 0603WAF1002T5E UNI-ROYAL(厚声) LCSC C25804 0.001
11 10 DSHP08TSGER CAN_ID SW-SMD_DSHP08TSGET 1 DSHP08TSGET YE LCSC C40738 0.597
12 11 PM200V-12-12-H43 U9 HDR-TH_12P-P2.00-V-F-R2-C6-S2.00 1 PM200V-12-12-H43 XFCN(兴飞) LCSC C2925565 0.196
13 12 1u C23,C24,C10,C20,C21,C22 C_0603 6 CL10A105KB8NNNC SAMSUNG LCSC C15849 0.005
14 13 10uF C9,C15,C19 C0805 3 CL21A106KAYNNNE SAMSUNG LCSC C15850 0.011
15 14 47uF C11,C14,C18 C1206 3 GRM31CR61E476ME44L muRata(村田) LCSC C403725 0.31
16 15 1MΩ R2 R0603 1 0603WAF1004T5E UNI-ROYAL(厚声) LCSC C22935 0.001
17 16 TS-1101-C-W RST1 SW-SMD_L6.0-W3.3-LS8.0 1 TS-1101-C-W XKB Connectivity(中国星坤) LCSC C318938 0.035
18 17 STM32F103C8T6 U14 LQFP-48_L7.0-W7.0-P0.50-LS9.0-BL 1 STM32F103C8T6 ST(意法半导体) LCSC C8734 1.383
19 18 220Ω L1,L2,L3,L4,L5,L6,L7,L8,L9,L11,L12,L13,L14,L15,L16 L0402 15 MPZ1005S221ET000 TDK LCSC C165811 0.02
20 19 220Ω L10 L0805 1 CBG201209U221T FH LCSC C124102 0.005
21 20 MAX31855KASA+T U1,U2,U3,U4,U5,U6,U7,U8 SO-8_L4.9-W3.9-P1.27-LS5.9-BL 8 MAX31855KASA+T MAXIM LCSC C52028 1.858
22 21 LM3940IMP-3.3/NOPB U11 SOT-223_L6.5-W3.5-P2.30-LS7.0-BR 1 LM3940IMP-3.3/NOPB Texas Instruments LCSC C140319 2.071
23 22 PCC-SMP-V K-type P1,P2,P3,P4,P5,P6,P7,P8 PCC-SMP-V K-TYPE 8 PCC-SMP-V OMEGA Alibaba

Binary file not shown.

Binary file not shown.
1 Designator Footprint Mid X Mid Y Ref X Ref Y Pad X Pad Y Layer Rotation Comment
2 C1 0805' 24.9mm -5.91mm 24.9mm -5.91mm 24.9mm -6.93mm T 90 10nF
3 C2 0805' 24.77mm -15.82mm 24.77mm -15.82mm 24.77mm -16.83mm T 90 10nF
4 C3 0805' 24.9mm -26.99mm 24.9mm -26.99mm 24.9mm -28.01mm T 90 10nF
5 C4 0805' 24.77mm -38.42mm 24.77mm -38.42mm 24.77mm -39.44mm T 90 10nF
6 C5 0805' 24.77mm -49.47mm 24.77mm -49.47mm 24.77mm -50.49mm T 90 10nF
7 C6 0805' 24.77mm -60.52mm 24.77mm -60.52mm 24.77mm -61.54mm T 90 10nF
8 C7 0805' 24.9mm -71.06mm 24.9mm -71.06mm 24.9mm -72.08mm T 90 10nF
9 C8 0805' 24.77mm -81.98mm 24.77mm -81.98mm 24.77mm -83mm T 90 10nF
10 C9 C0805 49.92mm -10.54mm 49.92mm -10.54mm 48.92mm -10.54mm T 0 10uF
11 C10 C_0603 57.79mm -74.61mm 57.79mm -74.61mm 58.57mm -74.61mm T 180 1u
12 C11 C1206 40.59mm -58.85mm 40.59mm -58.85mm 40.59mm -57.25mm T 270 47uF
13 C12 C0603 64.26mm -68.71mm 64.26mm -68.71mm 64.26mm -68.01mm T 270 12pF
14 C13 C0603 64.26mm -71.76mm 64.26mm -71.76mm 64.26mm -72.46mm T 90 12pF
15 C14 C1206 60.03mm -13.59mm 60.03mm -13.59mm 58.44mm -13.59mm T 0 47uF
16 C15 C0805 60.62mm -11.18mm 60.62mm -11.18mm 61.62mm -11.18mm T 180 10uF
17 C16 0805' 47.37mm -34.8mm 47.37mm -34.8mm 47.37mm -33.78mm T 270 10nF
18 C17 0805' 45.09mm -34.8mm 45.09mm -34.8mm 45.09mm -33.78mm T 270 10nF
19 C18 C1206 39.75mm -14.86mm 39.75mm -14.86mm 38.16mm -14.86mm T 0 47uF
20 C19 C0805 43.67mm -16.54mm 43.67mm -16.54mm 43.67mm -17.54mm T 90 10uF
21 C20 C_0603 46.1mm -10.54mm 46.1mm -10.54mm 45.31mm -10.54mm T 0 1u
22 C21 C_0603 45.93mm -59.65mm 45.93mm -59.65mm 45.93mm -58.87mm T 270 1u
23 C22 C_0603 30.58mm -10.86mm 30.58mm -10.86mm 31.37mm -10.86mm T 180 1u
24 C23 C_0603 30.58mm -43.5mm 30.58mm -43.5mm 31.37mm -43.5mm T 180 1u
25 C24 C_0603 30.58mm -86.05mm 30.58mm -86.05mm 31.37mm -86.05mm T 180 1u
26 CAN_ID SW-SMD_DSHP08TSGET 51.05mm -84.14mm 51.05mm -84.14mm 46.61mm -87.95mm T 0 DSHP08TSGER
27 CN1 CONN-TH_TE_776280-1 60.58mm -45mm 60.58mm -45mm 56.58mm -49mm T 90 776280-1
28 D1 SMA_L4.2-W2.6-LS5.3-RD 59.06mm -19.18mm 59.06mm -19.18mm 56.49mm -19.18mm T 0 SS14
29 D2 SMA_L4.2-W2.6-LS5.3-RD 59.06mm -16.26mm 59.06mm -16.26mm 61.62mm -16.26mm T 180 SS14
30 D3 SMA_L4.2-W2.6-LS5.3-RD 40.89mm -20.07mm 40.89mm -20.07mm 38.33mm -20.07mm T 0 SS14
31 L1 L0402 25.91mm -9.34mm 25.91mm -9.34mm 26.46mm -9.34mm T 180 220Ω
32 L2 L0402 25.91mm -2.61mm 25.91mm -2.61mm 26.46mm -2.61mm T 180 220Ω
33 L3 L0402 25.79mm -19.24mm 25.79mm -19.24mm 26.33mm -19.24mm T 180 220Ω
34 L4 L0402 25.79mm -12.51mm 25.79mm -12.51mm 26.33mm -12.51mm T 180 220Ω
35 L5 L0402 25.91mm -30.29mm 25.91mm -30.29mm 26.46mm -30.29mm T 180 220Ω
36 L6 L0402 25.91mm -23.69mm 25.91mm -23.69mm 26.46mm -23.69mm T 180 220Ω
37 L7 L0402 25.79mm -41.72mm 25.79mm -41.72mm 26.33mm -41.72mm T 180 220Ω
38 L8 L0402 25.79mm -35.12mm 25.79mm -35.12mm 26.33mm -35.12mm T 180 220Ω
39 L9 L0402 25.79mm -52.77mm 25.79mm -52.77mm 26.33mm -52.77mm T 180 220Ω
40 L10 L0805 25.79mm -46.17mm 25.79mm -46.17mm 26.79mm -46.17mm T 180 220Ω
41 L11 L0402 25.79mm -63.82mm 25.79mm -63.82mm 26.33mm -63.82mm T 180 220Ω
42 L12 L0402 25.79mm -57.22mm 25.79mm -57.22mm 26.33mm -57.22mm T 180 220Ω
43 L13 L0402 25.91mm -74.36mm 25.91mm -74.36mm 26.46mm -74.36mm T 180 220Ω
44 L14 L0402 25.91mm -67.63mm 25.91mm -67.63mm 26.46mm -67.63mm T 180 220Ω
45 L15 L0402 25.79mm -85.28mm 25.79mm -85.28mm 26.33mm -85.28mm T 180 220Ω
46 L16 L0402 25.79mm -78.81mm 25.79mm -78.81mm 26.33mm -78.81mm T 180 220Ω
47 P1 PCC-SMP-V K-TYPE 12.49mm -7.57mm 2.99mm -9.27mm 15.69mm -9.27mm T 0 PCC-SMP-V K-type
48 P2 PCC-SMP-V K-TYPE 12.49mm -18.21mm 2.99mm -19.91mm 15.69mm -19.91mm T 0 PCC-SMP-V K-type
49 P3 PCC-SMP-V K-TYPE 12.49mm -28.85mm 2.99mm -30.55mm 15.69mm -30.55mm T 0 PCC-SMP-V K-type
50 P4 PCC-SMP-V K-TYPE 12.49mm -39.49mm 2.99mm -41.19mm 15.69mm -41.19mm T 0 PCC-SMP-V K-type
51 P5 PCC-SMP-V K-TYPE 12.49mm -50.12mm 2.99mm -51.82mm 15.69mm -51.82mm T 0 PCC-SMP-V K-type
52 P6 PCC-SMP-V K-TYPE 12.49mm -60.76mm 2.99mm -62.46mm 15.69mm -62.46mm T 0 PCC-SMP-V K-type
53 P7 PCC-SMP-V K-TYPE 12.49mm -71.4mm 2.99mm -73.1mm 15.69mm -73.1mm T 0 PCC-SMP-V K-type
54 P8 PCC-SMP-V K-TYPE 12.49mm -82.04mm 2.99mm -83.74mm 15.69mm -83.74mm T 0 PCC-SMP-V K-type
55 R2 R0603 57.53mm -70.17mm 57.53mm -70.17mm 57.53mm -69.42mm T 270 1MΩ
56 R3 R0603 41.15mm -73.28mm 41.15mm -73.28mm 41.85mm -73.28mm T 180 120
57 R4 R0603 57.53mm -67.12mm 57.53mm -67.12mm 57.53mm -67.88mm T 90 10kΩ
58 R6 R0603 58.17mm -80.84mm 58.17mm -80.84mm 58.17mm -80.08mm T 270 10kΩ
59 RST1 SW-SMD_L6.0-W3.3-LS8.0 44.83mm -53.21mm 44.83mm -53.21mm 48.83mm -53.21mm T 180 TS-1101-C-W
60 U1 SO-8_L4.9-W3.9-P1.27-LS5.9-BL 32.52mm -6.42mm 32.52mm -6.42mm 29.8mm -4.51mm T 270 MAX31855KASA+T
61 U2 SO-8_L4.9-W3.9-P1.27-LS5.9-BL 32.52mm -15.94mm 32.52mm -15.94mm 29.8mm -14.04mm T 270 MAX31855KASA+T
62 U3 SO-8_L4.9-W3.9-P1.27-LS5.9-BL 32.52mm -26.1mm 32.52mm -26.1mm 29.8mm -24.2mm T 270 MAX31855KASA+T
63 U4 SO-8_L4.9-W3.9-P1.27-LS5.9-BL 32.52mm -38.42mm 32.52mm -38.42mm 29.8mm -36.52mm T 270 MAX31855KASA+T
64 U5 SO-8_L4.9-W3.9-P1.27-LS5.9-BL 32.52mm -49.72mm 32.52mm -49.72mm 29.8mm -47.82mm T 270 MAX31855KASA+T
65 U6 SO-8_L4.9-W3.9-P1.27-LS5.9-BL 32.52mm -60.14mm 32.52mm -60.14mm 29.8mm -58.23mm T 270 MAX31855KASA+T
66 U7 SO-8_L4.9-W3.9-P1.27-LS5.9-BL 32.52mm -70.81mm 32.52mm -70.81mm 29.8mm -68.9mm T 270 MAX31855KASA+T
67 U8 SO-8_L4.9-W3.9-P1.27-LS5.9-BL 32.52mm -82.11mm 32.52mm -82.11mm 29.8mm -80.2mm T 270 MAX31855KASA+T
68 U9 HDR-TH_12P-P2.00-V-F-R2-C6-S2.00 45.72mm -25.91mm 45.72mm -25.91mm 40.72mm -26.91mm T 0 PM200V-12-12-H43
69 U10 SOIC-8_L4.9-W3.9-P1.27-LS6.0-BL 41.23mm -66.05mm 41.23mm -66.05mm 43.13mm -63.28mm T 180 SN65HVD231DR
70 U11 SOT-223_L6.5-W3.5-P2.30-LS7.0-BR 49.98mm -15.41mm 49.98mm -15.41mm 46.88mm -13.12mm T 180 LM3940IMP-3.3/NOPB
71 U12 PWRM-TH_BXXXXS-2WR2 55.27mm -7.87mm 55.27mm -7.87mm 61.62mm -7.87mm T 180 B1205S-2WR2_C2992386
72 U14 LQFP-48_L7.0-W7.0-P0.50-LS9.0-BL 50.99mm -69.03mm 50.99mm -69.03mm 55.24mm -71.78mm T 90 STM32F103C8T6
73 X1 OSC-SMD_L5.0-W3.2 61.09mm -70.1mm 61.09mm -70.1mm 61.09mm -68.05mm T 270 8MHz