Skip to content

Commit 0c59b41

Browse files
authored
Merge pull request #292 from Infineon/feature/can_bus
Feature/CAN_XMC14002GO
2 parents bed41f4 + 38598e9 commit 0c59b41

File tree

166 files changed

+18370
-14137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+18370
-14137
lines changed

.github/scripts/release.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import argparse, copy, hashlib, json, re, requests, os, shutil
33

4-
version = '0.2.0'
4+
version = '0.2.1'
55

66
xmc_ino_root_path = os.path.relpath(os.path.join(os.path.join(os.getcwd(), os.pardir), os.pardir))
77
build_dir_name = 'pkg_build'
@@ -37,8 +37,12 @@ def build_package(pkg_name):
3737
'README.md'
3838
]
3939

40+
ignore_pattern = shutil.ignore_patterns()
41+
4042
for dir in dirs_to_copy:
41-
shutil.copytree(os.path.join(xmc_ino_root_path, dir), os.path.join(pkg_build_path, dir))
43+
if dir == 'libraries':
44+
ignore_pattern = shutil.ignore_patterns('Makefile', 'Makefile.test', 'test')
45+
shutil.copytree(os.path.join(xmc_ino_root_path, dir), os.path.join(pkg_build_path, dir), ignore=ignore_pattern)
4246

4347
for file in files_to_copy:
4448
shutil.copyfile(os.path.join(xmc_ino_root_path, file), os.path.join(pkg_build_path, file))

.github/workflows/compile-platform-examples.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
stackMem: true
4545
dma: false
4646
alarmRtc: false
47+
can: false
4748
- fqbn: Infineon:xmc:XMC1100_XMC2GO
4849
i2s: true
4950
dieTemp: true
@@ -53,6 +54,7 @@ jobs:
5354
stackMem: true
5455
dma: false
5556
alarmRtc: false
57+
can: false
5658
- fqbn: Infineon:xmc:XMC1300_Boot_Kit
5759
i2s: false
5860
dieTemp: true
@@ -63,6 +65,7 @@ jobs:
6365
multiSerial: false
6466
dma: false
6567
alarmRtc: false
68+
can: false
6669
- fqbn: Infineon:xmc:XMC4200_Platform2GO
6770
i2s: false
6871
dieTemp: false
@@ -73,6 +76,7 @@ jobs:
7376
multiSerial: false
7477
dma: false
7578
alarmRtc: true
79+
can: true
7680
- fqbn: Infineon:xmc:XMC4400_Platform2GO
7781
i2s: false
7882
dieTemp: false
@@ -82,6 +86,7 @@ jobs:
8286
stackMem: true
8387
dma: false
8488
alarmRtc: false
89+
can: true
8590
- fqbn: Infineon:xmc:XMC4700_Relax_Kit
8691
i2s: true
8792
dieTemp: true
@@ -92,6 +97,7 @@ jobs:
9297
multiSerial: true
9398
dma: true
9499
alarmRtc: true
100+
can: true
95101
- fqbn: Infineon:xmc:XMC1400_XMC2GO
96102
i2s: true
97103
dieTemp: true
@@ -101,6 +107,7 @@ jobs:
101107
stackMem: false
102108
dma: false
103109
alarmRtc: false
110+
can: true
104111
- fqbn: Infineon:xmc:XMC1400_Arduino_Kit
105112
i2s: false
106113
dieTemp: true
@@ -111,6 +118,7 @@ jobs:
111118
multiSerial: false
112119
dma: false
113120
alarmRtc: false
121+
can: false
114122

115123
# Make board type-specific customizations to the matrix jobs
116124
include:
@@ -146,12 +154,16 @@ jobs:
146154
alarmRtc: true
147155
alarmRtc-sketch-paths: |
148156
- libraries/RTC/examples/AlarmRTC
157+
- board:
158+
can: true
159+
can-sketch-paths: |
160+
- libraries/CAN/examples
149161
steps:
150162
- name: Checkout repository
151-
uses: actions/checkout@v2
163+
uses: actions/checkout@v4
152164

153165
- name: Compile examples
154-
uses: arduino/compile-sketches@v1
166+
uses: arduino/compile-sketches@v1.1.1
155167
with:
156168
github-token: ${{ secrets.GITHUB_TOKEN }}
157169
fqbn: ${{ matrix.board.fqbn }}
@@ -178,12 +190,13 @@ jobs:
178190
${{ matrix.multiSerial-sketch-paths }}
179191
${{ matrix.dma-sketch-paths }}
180192
${{ matrix.alarmRtc-sketch-paths }}
193+
${{ matrix.can-sketch-paths }}
181194
enable-deltas-report: false
182195
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
183196

184197
- name: Save sketches report as workflow artifact
185-
uses: actions/upload-artifact@v2
198+
uses: actions/upload-artifact@v3
186199
with:
187200
if-no-files-found: error
188201
path: ${{ env.SKETCHES_REPORTS_PATH }}
189-
name: ${{ env.SKETCHES_REPORTS_PATH }}
202+
name: ${{ env.SKETCHES_REPORTS_PATH }}

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
.history
22
.vscode
3-
pkg_build
3+
pkg_build
4+
build
5+
.clang-format
6+
**/__pycache__/

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ Check the **develop** branch for any Beta releases fixes for any issues you may
1616
4. Other branches are for other tests and not to be treated as anything but work in progress for now
1717
5. Check [XMC-for-Arduino Wiki](https://github.com/Infineon/XMC-for-Arduino/wiki) for any additional information
1818

19+
### Develop Built-in Library
20+
<ul>
21+
<li>Reference to other libraries in the libraris folder. Typically required files include: </li>
22+
<ul>
23+
<li>source</li>
24+
<li>library.properties</li>
25+
<li>keywords.txt</li>
26+
<li>README.md</li>
27+
</ul>
28+
<li>Check out the official arduino libraries and try to keep the API consistent</li>
29+
<li>Add Compilation test in github workflow</li>
30+
<li>Update documentation ( README, github wiki...)</li>
31+
</ul>
32+
33+
### Add new XMC Board
34+
1935
### Local Running using Arduino IDE (**ON WINDOWS**):
2036
Clone the repository in arduino folder:
2137
- Open Arduino and install any Infineon XMC library (e.g. 2.2.0)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This repository integrates [Infineon's](https://www.infineon.com/) XMC microcont
2121
* [XMC1100 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc_2go_xmc1100_v1/)
2222
* [XMC1100 Boot Kit](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc11_boot_001/)
2323
* [XMC1300 Boot Kit](https://www.infineon.com/cms/de/product/evaluation-boards/kit_xmc13_boot_001/)
24+
* [XMC1400 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc14_2go/)
2425
* [XMC1400 Kit for Arduino](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc1400_arduino/)
2526
* [XMC4200 Platform 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc_plt2go_xmc4200/)
2627
* [XMC4400 Platform 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc_plt2go_xmc4400//)
@@ -35,6 +36,7 @@ Please visit also the Wiki for additional information, e.g. datasheets, pin out
3536
* Page for [XMC1100 XMC 2Go](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC-2Go)
3637
* Page for [XMC1100 Boot Kit](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC1100-Boot-Kit)
3738
* Page for [XMC1300 Boot Kit](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC1300-Boot-Kit)
39+
* Page for [XMC1400 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc14_2go/)
3840
* Page for [XMC1400 Kit for Arduino](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC1400-Kit-for-Arduino)
3941
* Page for [XMC4200 Platform 2Go](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC4200-Platform2Go)
4042
* Page for [XMC4400 Platform 2Go](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC4400-Platform2Go)

boards.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ XMC1400_XMC2GO.serial.disableRTS=true
154154
XMC1400_XMC2GO.build.mcu=cortex-m0
155155
XMC1400_XMC2GO.build.f_cpu=48000000L
156156
XMC1400_XMC2GO.build.board=ARM_XMC
157-
XMC1400_XMC2GO.build.board.version=1402
157+
XMC1400_XMC2GO.build.board.version=1404
158158
XMC1400_XMC2GO.build.board.type=Q040x0200
159159
XMC1400_XMC2GO.build.board.v=0200
160160
XMC1400_XMC2GO.build.core=./

cores/Arduino.h

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ extern "C" {
5050
#include <xmc_spi.h>
5151
#include <xmc_i2c.h>
5252
#include <xmc_i2s.h>
53+
#include <xmc_can.h>
5354

5455
//****************************************************************************
5556
// @Defines
@@ -247,9 +248,40 @@ extern "C" {
247248
#endif
248249
} XMC_I2S_t;
249250

250-
//****************************************************************************
251-
// @Imported Global Variables
252-
//****************************************************************************
251+
#ifdef CAN_xmc
252+
/*
253+
* XMC (Arduino) CAN type
254+
*/
255+
256+
typedef enum
257+
{
258+
XMC_NODE_NUM_0,
259+
XMC_NODE_NUM_1
260+
}
261+
XMC_CAN_NODE_NUM_t;
262+
263+
typedef struct
264+
{
265+
CAN_NODE_TypeDef *can_node;
266+
XMC_CAN_NODE_NUM_t can_node_num;
267+
XMC_CAN_CANCLKSRC_t can_clock;
268+
uint32_t can_frequency;
269+
XMC_PORT_PIN_t rx;
270+
XMC_GPIO_CONFIG_t rx_config;
271+
XMC_PORT_PIN_t tx;
272+
XMC_GPIO_CONFIG_t tx_config;
273+
XMC_CAN_NODE_RECEIVE_INPUT_t node_input;
274+
IRQn_Type irq_num;
275+
uint32_t irq_service_request;
276+
#if (UC_SERIES == XMC14)
277+
XMC_SCU_IRQCTRL_t irq_source;
278+
#endif
279+
} XMC_ARD_CAN_t;
280+
#endif
281+
282+
//****************************************************************************
283+
// @Imported Global Variables
284+
//****************************************************************************
253285
extern const XMC_PORT_PIN_t mapping_port_pin[];
254286
extern const XMC_PIN_INTERRUPT_t mapping_interrupt[];
255287
extern const uint8_t mapping_pin_PWM4[][ 2 ];
@@ -277,6 +309,9 @@ extern "C" {
277309

278310
extern XMC_I2S_t i2s_config;
279311

312+
#ifdef CAN_xmc
313+
extern XMC_ARD_CAN_t XMC_CAN_0;
314+
#endif
280315
//****************************************************************************
281316
// @Prototypes Of Global Functions
282317
//****************************************************************************

cores/xmc_lib/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Develop notes
2+
## XMCLib version
3+
The current one is V4.3.0. The macro of XMCLib version is also defined in ```cores\xmc_lib\XMCLib\inc\xmc_common.h```
4+
5+
## CAN macro
6+
7+
Because XMClibs use CAN macro, conflicts with Arduino default CAN class name, so we manually changed XMClib (CAN -> CAN_xmc).
8+
changed files:
9+
10+
.h header files:
11+
- XMCLib\inc\xmc_can.h
12+
- XMCLib\inc\xmc_pau.h
13+
- XMCLib\inc\xmc1_scu.h
14+
- XMCLib\inc\xmc4_scu.h
15+
16+
.c source files:
17+
- XMCLib\src\xmc_can.c
18+
- XMCLib\src\xmc1_scu.c

cores/xmc_lib/XMCLib/License.txt

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
License Terms and Copyright Information
22
=======================================
33

4-
Copyright (c) 2015-2016, Infineon Technologies AG All rights reserved.
4+
Copyright (c) 2015-2023, Infineon Technologies AG All rights reserved.
55

6-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7-
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8-
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
9-
and/or other materials provided with the distribution.
10-
- Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software
11-
without specific prior written permission.
6+
Boost Software License - Version 1.0 - August 17th, 2003
127

13-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
14-
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
15-
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
16-
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
17-
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8+
Permission is hereby granted, free of charge, to any person or organization
9+
obtaining a copy of the software and accompanying documentation covered by
10+
this license (the "Software") to use, reproduce, display, distribute,
11+
execute, and transmit the Software, and to prepare derivative works of the
12+
Software, and to permit third-parties to whom the Software is furnished to
13+
do so, all subject to the following:
1814

19-
To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with Infineon Technologies AG ([email protected]).
15+
The copyright notices in the Software and this entire statement, including
16+
the above license grant, this restriction and the following disclaimer,
17+
must be included in all copies of the Software, in whole or in part, and
18+
all derivative works of the Software, unless such copies or derivative
19+
works are solely in the form of machine-executable object code generated by
20+
a source language processor.
21+
22+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
25+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
26+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
27+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28+
DEALINGS IN THE SOFTWARE.
29+
30+
To improve the quality of the software, users are encouraged to share modifications,
31+
enhancements or bug fixes with Infineon Technologies AG at [email protected].

cores/xmc_lib/XMCLib/Readme.txt

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)