You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: how-tos/write_board_software.md
+78Lines changed: 78 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,84 @@ layout: default
6
6
lang: en
7
7
---
8
8
9
+
# Writing the Board-Specific Software File
10
+
11
+
## Overview
12
+
13
+
This guide explains how to write the board-specific software file for the subsystem board. This involves modifying key parameters and configurations to match the hardware setup.
14
+
15
+
## Before you start
16
+
17
+
Before writing the board-specific software file, ensure:
18
+
19
+
* You have the necessary software development tools installed (e.g., MPLAB X, XC8 compiler).
20
+
* You have access to the firmware repository.
21
+
* You understand the board’s hardware specifications and required configurations.
22
+
23
+
## Modifying the Board-Specific Software File
24
+
25
+
1.**Locate the Board-Specific File**
26
+
27
+
Navigate to the firmware repository and open the file corresponding to your board (e.g., `board_config.h`).
28
+
29
+
2.**Update the Microcontroller Settings**
30
+
31
+
Modify the following parameters to match your board’s specifications:
32
+
33
+
```c
34
+
#defineCPU_FREQUENCY 32000000 // Set the correct clock frequency
35
+
#define UART_BAUDRATE 9600 // Set the UART communication speed
36
+
```
37
+
38
+
3. **Configure the I/O Pins**
39
+
40
+
Adjust the pin configurations based on your hardware connections:
41
+
42
+
```c
43
+
#defineLED_PIN TRISBbits.TRISB0 // Set LED pin as output
44
+
#define BUTTON_PIN TRISBbits.TRISB1 // Set Button pin as input
45
+
```
46
+
47
+
4. **Define Communication Protocols**
48
+
49
+
If using SPI, I2C, or UART, configure the relevant registers:
50
+
51
+
```c
52
+
voidinitUART() {
53
+
TXSTAbits.BRGH = 1; // High-speed mode
54
+
BAUDCONbits.BRG16 = 1;
55
+
SPBRGH = 0x00;
56
+
SPBRG = 207; // Baud rate setting
57
+
}
58
+
```
59
+
60
+
### Updating Other Files
61
+
62
+
Some additional files may require changes to ensure proper integration:
63
+
64
+
1.**Modify `main.c`**
65
+
66
+
Ensure the initialization functions for peripherals and board-specific settings are included:
67
+
68
+
```c
69
+
voidmain() {
70
+
initUART();
71
+
while (1) {
72
+
// Main program loop
73
+
}
74
+
}
75
+
```
76
+
77
+
2.**Update `Makefile` or Build Configurations**
78
+
79
+
If using a custom linker script or additional libraries, ensure they are properly linked in your project settings.
80
+
81
+
## See also
82
+
83
+
*[Microchip MPLAB X Documentation](https://www.microchip.com/mplabx)
0 commit comments