• Home
  • Annotate
  • current directory
Name Date Size #Lines LOC

..21-Aug-2025-

common/21-Aug-2025-

doc/21-Aug-2025-

samc21/21-Aug-2025-

samd51-adafruit-metro-m4/21-Aug-2025-

samd51-seeed-wio-terminal/21-Aug-2025-

same54/21-Aug-2025-

same70/21-Aug-2025-

saml10/21-Aug-2025-

README.md A D21-Aug-20256.5 KiB231122

README.md

1# Microchip BSP
2
3## 1. Microchip BSP Introduction
4
5Supported Microchip SAM (ARM Cortex-Mx Core) MCU is as following:
6
7### ARM Cortex-M23 Series
8
9- saml10 | 3.3V Cortex-M23 with ultra low power
10- saml11 | 3.3V Cortex-M23 with ultra low power and trust-zone
11
12### ARM Cortex-M0+ Series
13
14- samc21 | 5V Cortex-M0+ with 2 CAN-FD support
15- saml21 | 3.3V low power Cortex-M0+
16- samd21 | 3.3V industrial level Cortex-M0+
17
18### ARM Cortex-M4 Series
19
20- same54 | 3.3V 120MHz Cortex-M4F core with CAN-FD/USB/Ethernet support
21
22### ARM Cortex-M7 Series
23
24- same70 | 3.3V 300MHz Cortex-M7 core with CAN-FD/High speed USB/Ethernet support
25
26### Directory description:
27
28	* applications:
29		* user main function entrance,
30		* driver example - like i2c, can, adc ...
31		* application example
32	* board:
33		* user board initialization
34		* user driver adpater code, like console device, ethernet device
35	* bsp:
36		* MCU BSP files - startup file, peripheral drivers, configuation headers and linker script
37		* generated from start.atmel.com - DO NOT modify it
38
39## 2. RT-Thread porting guide of Microchip SAM MCU
40
41### 2.1 Configure project BSP on Atmel Start
42
43Visit <https://start.atmel.com/#> and click CREATE NEW PROJECT.
44
45![](doc/2-1-1-atmel-start-online.png)
46
47Input MCU part number and then select device, click CREATE NEW PROJECT.
48
49![](doc/2-1-2-atmel-start-newproject.png)
50
51Add STDIO and other driver/middleware to project.
52
53![](doc/2-1-3-atmel-start-add-STDIO.png)
54
55Configure STDIO driver.
56
57![](doc/2-1-4-atmel-start-driver-stdio.png)
58
59Configure CAN module clock.
60
61![](doc/2-1-5-atmel-start-can-clock.png)
62
63Configure CAN module driver.
64
65![](doc/2-1-6-atmel-start-driver-can0.png)
66
67![](doc/2-1-6-atmel-start-driver-can1.png)
68
69Add LED pin description.
70
71![](doc/2-1-8-atmel-start-add-LED0.png)
72
73Rename project.
74
75![](doc/2-1-7-atmel-start-rename-project.png)
76
77Save project configuration.
78
79![](doc/2-1-9-atmel-start-save-configuration.png)
80
81Export project source code.
82
83![](doc/2-1-10-atmel-start-export-project.png)
84
85### 2.2 Add project to RT-Thread source code
86
87Link: <https://github.com/RT-Thread/rt-thread> and download RT souce code.
88
89![](doc/2-2-1-atmel-start-download-RT-Thread.png)
90
91Unzip downloaded RT-Thread and SAME70 CAN Example
92
93![](doc/2-2-2-atmel-start-unzip-file.png)
94
95Enter *rt-thread-xxx/bsp/microchip* directory and copy **same70** folder and rename it to **same70q20**.
96
97![](doc/2-2-3-atmel-start-copy-file.png)
98
99Enter same70q20 directory and remove all files except SConscript file.
100
101![](doc/2-2-4-atmel-start-remove-old-files.png)
102
103Copy all files from SAME70 CAN Example to rt-thread-xxx/bsp/microchip/same70q20/bsp.
104
105![](doc/2-2-5-atmel-start-copy-files.png)
106
107Modify rt-thread-xxx\bsp\microchip\same70q20\rtconfig.py.
108
109![](doc/2-2-6-atmel-start-modify-file0.png)
110
111Modify rt-thread-xxx\bsp\microchip\same70q20\bsp\SConscript.
112
113![](doc/2-2-6-atmel-start-modify-file1.png)
114
115Modify rt-thread-xxx\bsp\microchip\same70q20\bsp\same70b\gcc\gcc\same70q20b_flash.ld.
116
117![](doc/2-2-6-atmel-start-modify-file2.png)
118
119Modify rt-thread-xxx\bsp\microchip\same70q20\bsp\same70b\gcc\gcc\startup_same70q20b.c.
120
121![](doc/2-2-6-atmel-start-modify-file3.png)
122
123Alright, now you can use RT-Thread env tools to compile the project.
124
125### 2.3 Compile project with RT-Thread env tools
126
127About RT-Thread env tools, click [Here](https://github.com/RT-Thread/rt-thread/blob/master/documentation/env/env.md).
128
129Download RT-Thread env tools <https://www.rt-thread.org/download.html#download-rt-thread-env-tool>
130
131![](doc/2-3-1-atmel-start-download-env-tools.png)
132
133Unzip downloaded file and run env.exe.
134
135![](doc/2-3-2-atmel-start-run-env-tools.png)
136
137Enter your project directory and run scons command to compile it.
138
139![](doc/2-3-3-atmel-start-env-tools-compile.png)
140
141Compile error you may have and proposed solution.
142
143![](doc/2-3-4-atmel-start-env-tools-errors.png)
144
145Fix compiling error
146
147![](doc/2-3-5-atmel-start-env-tools-fixerrors.png)
148
149Compiling success
150
151![](doc/2-3-6-atmel-start-env-tools-compiling-OK.png)
152
153In the following chapter I will show you how to debug RT-Thread with Studio 7.
154
155## 3. RT-Thread debugging with Microchip IDE
156
157Link: <https://www.microchip.com/en-us/tools-resources/develop/microchip-studio>, download & install Microchip Studio 7.
158
159![](doc/3-1-1-atmel-start-Studio7-download.png)
160
161Open installed Microchip Studio 7 and open object file for debugging.
162
163![](doc/3-1-2-atmel-start-Studio7-open-objects.png)
164
165Choose object file, fill project name and select where to save this project.
166
167![](doc/3-1-3-atmel-start-Studio7-import-debug.png)
168
169Select the right part number and complete object set up.
170
171![](doc/3-1-4-atmel-start-Studio7-select-device.png)
172
173Object file import complete and you can see related files are linked to project.
174
175![](doc/3-1-5-atmel-start-Studio7-project-complete.png)
176
177Right click the project and choose the debug tools in project propertities setting.
178
179![](doc/3-1-6-atmel-start-Studio7-project-properties.png)
180
181Choose debugger/programmer and debugger interface - SWD or JTGA.
182
183![](doc/3-1-7-atmel-start-Studio7-select-tools.png)
184
185Press debugging button and enjoy your debugging journey.
186
187![](doc/3-1-8-atmel-start-Studio7-start-debugging1.png)
188
189Debugging start and you can add breakpoint.
190
191![](doc/3-1-8-atmel-start-Studio7-start-debugging2.png)
192
193Debugging paused at breakpoint and you can monitor local variables at Watch window.
194
195![](doc/3-1-8-atmel-start-Studio7-start-debugging3.png)
196
197Debugging message output.
198
199![](doc/3-1-9-atmel-start-rt-thread-run.png)
200
201## 4. Reconfigure MCU BSP
202
203Visit <https://start.atmel.com/#> and upload project configuration.
204
205![](doc/4-1-1-atmel-start-Studio7-reimport-project.png)
206
207Now you can reconfigure your project.
208
209![](doc/4-1-2-atmel-start-Studio7-project-configurtion.png)
210
211
212## 5. Microchip SAM MCU BSP configuration and user guide
213
214Please refer to [ASF4 API Reference Manual](https://ww1.microchip.com/downloads/en/DeviceDoc/50002633B.pdf) for more details
215
216### 5.1 SAMC2x/E5x/E70 CAN Driver
217
218CAN driver configuration.
219
220![](doc/5-1-1-atmel-start-driver-can0.png)
221![](doc/5-1-1-atmel-start-driver-can1.png)
222
223CAN driver user guide - see [ASF4 API Reference Manual](https://ww1.microchip.com/downloads/en/DeviceDoc/50002633B.pdf) P121 for more details.
224
225To be continued.
226
227## 6. Contact Info
228
229- [Kevin Liu](https://github.com/klmchp), email: <kevin.liu.mchp@gmail.com>
230- [luhuadong](https://github.com/luhuadong), email: <luhuadong@163.com>
231