Skip to content

Commit 09354f6

Browse files
authored
Merge pull request #1 from TexasInstruments-Sandbox/ADD_I2C_DRIVER
I2C module support addition - 0.20.00.00
2 parents 8390ee5 + 0db7347 commit 09354f6

32 files changed

+4135
-7
lines changed

MANIFEST.html

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ <h2 id="ProductName">
3434
</h2>
3535

3636
<h4 id="ReleaseDate">
37-
<span>2025-11-03</span>
37+
<span>2025-20-05</span>
3838
</h2>
3939

4040
<h4 id="SRASID">
41-
Manifest ID - <span>SRAS00012350</span>
41+
Manifest ID - <span>SRAS00012667</span>
4242
</h4>
4343

4444
</div><div id="content">
@@ -251,7 +251,7 @@ <h2>
251251
<span>MSP-CMSIS-DRIVER Code Examples</span>
252252
</td>
253253
<td id="version" name="version" rowspan="2">
254-
<span>0.10.01.00</span>
254+
<span>0.20.00.00</span>
255255
</td>
256256
<td id="license" name="license" rowspan="2">
257257
<span>BSD-3-Clause</span>
@@ -281,7 +281,7 @@ <h2>
281281
<span>MSP-CMSIS-DRIVER</span>
282282
</td>
283283
<td id="version" name="version" rowspan="2">
284-
<span>0.10.01.00</span>
284+
<span>0.20.00.00</span>
285285
</td>
286286
<td id="license" name="license" rowspan="2">
287287
<span>Apache-2.0</span>
@@ -335,6 +335,36 @@ <h2>
335335
</tr>
336336
</tbody>
337337

338+
<tbody >
339+
<tr>
340+
<td id="name" name="name" rowspan="2">
341+
<span>CMSIS-Driver I2C</span>
342+
</td>
343+
<td id="version" name="version" rowspan="2">
344+
<span>2.4</span>
345+
</td>
346+
<td id="license" name="license" rowspan="2">
347+
<span>Apache-2.0</span>
348+
</td>
349+
<td id="delivered" name="delivered" rowspan="2">
350+
<span>Source</span>
351+
</td>
352+
<td id="modified" name="modified" rowspan="2">
353+
<span>No</span>
354+
</td>
355+
<td><b>Location</b></td>
356+
<td id="location" name="location">
357+
<span>[as installed]/source/CMSIS/Drivers/Driver_I2C.h</span>
358+
</td>
359+
</tr>
360+
<tr>
361+
<td><b>Obtained from</b></td>
362+
<td id="obtained" name="obtained">
363+
<span>ARM-Software</span>
364+
</td>
365+
</tr>
366+
</tbody>
367+
338368
<tbody >
339369
<tr>
340370
<td id="name" name="name" rowspan="2">

README.md

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ This package provides a CMSIS-DRIVER inteface to peripherals on [TI MSPM0 microc
1919

2020
This package currently supports the following CMSIS-Driver modules:
2121
- Driver_USART (configurable with DMA or interrupt driven I/O)
22+
- Driver_I2C (configurable with DMA or interrupt driven I/O)
2223

2324
The following additional CMSIS-Driver modules are planned for future versions of this package:
24-
- Driver_I2C (configurable with DMA or interrupt driven I/O)
2525
- Driver_SPI (configurable with DMA or interrupt driven I/O)
2626
- Driver_GPIO (configurable with DMA or interrupt driven I/O)
2727

@@ -53,24 +53,35 @@ The repository contains the following directories:
5353
- /CMSIS/Drivers (These are the Arm standard interface files)
5454
- Driver_Common.h
5555
- Driver_USART.h
56+
- Driver_I2C.h
5657
- /Drivers (These are the TI implementation back end source files)
5758
- /V0
5859
- Driver_USART_MSP_Priv.h
5960
- Driver_USART_MSP_Priv.c
61+
- Driver_I2C_MSP_Priv.h
62+
- Driver_I2C_MSP_Priv.c
6063
- /Drivers_Interface (These are the TI implementation front end source files)
6164
- Driver_Common_MSP.h
6265
- Driver_USART_MSP.h
6366
- Driver_USART_MSP.c
67+
- Driver_I2C_MSP.h
68+
- Driver_I2C_MSP.c
6469
- /examples (These are the code examples for the LaunchPad EVMs and Code Composer Studio)
6570
- /nortos
6671
- /LP_MSPM0G3507
6772
- /cmsis_driver_uart
6873
- /cmsis-driver-usart-echo (This is the USART echo code example for MSPM0G3507)
6974
- /cmsis-driver-usart-loopback-dma (This is the USART dual-driver / DMA code example for MSPM0G3507)
75+
- /cmsis_driver_i2c
76+
- /cmsis-driver-i2c-transmit-receive (This is the I2C transmit and receieve code example for MSPM0G3507)
77+
- /cmsis-driver-i2c-transmit-receive-dma (This is the I2C transmit and receieve w/ DMA code example for MSPM0G3507)
7078
- /LP_MSPM0G3519
7179
- /cmsis_driver_uart
7280
- /cmsis-driver-usart-echo (This is the USART echo code example for MSPM0G3507)
7381
- /cmsis-driver-usart-loopback-dma (This is the USART dual-driver / DMA code example for MSPM0G3519)
82+
- /cmsis_driver_i2c
83+
- /cmsis-driver-i2c-transmit-receive (This is the I2C transmit and receieve code example for MSPM0G3507)
84+
- /cmsis-driver-i2c-transmit-receive-dma (This is the I2C transmit and receieve w/ DMA code example for MSPM0G3507)
7485

7586
### Quick Start
7687

@@ -92,7 +103,7 @@ The MSP-CMSIS-DRIVER package is delivered as source only. Build of the drivers
92103

93104
### CMSIS-Driver Static Configuration Procedures
94105

95-
The MSP-CMSIS-DRIVER modules (at this time, the USART module) do not require any configuration in the SysConfig visual configuration tool. The following static properties of each driver instance must be configured in a file named *Driver_Config_MSP.h*"* and subsequently included in the build include path.
106+
The MSP-CMSIS-DRIVER modules do not require any configuration in the SysConfig visual configuration tool. The static properties of each driver instance must be configured in a file named *Driver_Config_MSP.h*"* and subsequently included in the build include path.
96107

97108
#### Driver_USART Static Configuration
98109

@@ -161,6 +172,60 @@ To add more instances, simply copy and past the configuration block and update i
161172
```
162173
To include MSP-CMSIS-DRIVER software in another project, all that is required is to bring in the /msp-cmsis-driver directory to the project, and the corresponding include paths, and add a Driver_Config_MSP.h to the project (example shown above) to provide the static configurations for the driver instances.
163174

175+
#### Driver_I2C Static Configuration
176+
177+
The Driver_I2C module requires the definitions below to be placed in the *Driver_Config_MSP.h* file for each instance. The code examples already include this file.
178+
These definitions specify the static driver configuration parameters which are not exposed through runtime APIs.
179+
180+
- SCL pin mux index and port function selection
181+
- SDA pin mux index and port function selection
182+
- Clock selection and frequency
183+
- Transmit DMA hardware instance, channel, trigger (optional)
184+
- Receive DMA hardware instance, channel, trigger (optional)
185+
186+
Two configurations are shown in an example *Driver_Config_MSP.h* below, one for I2C0 and a second for I2C1. The I2C0 configuration does not configure DMA channels for transmit and receive. As such, I2C0 will use interrupt driven input/output. The I2C1 configuration is configured to use the DMA for transmit and receive. As such, I2C1 will use DMA driven input/output.
187+
188+
To add more instances, simply copy and past the configuration block and update it for the parameters used by the desired I2C instance. The device datasheet may be referred to for identifying pin configurations (IOMUX PINCM, PF). If the peripheral clock sources/frequencies are updated, note that the CLOCK_FREQ parameter must too be updated to ensure correct bus speed calculations.
189+
190+
```
191+
/* I2C Driver Configuration Options */
192+
193+
/* Driver_I2C0 Configuration (Maps to MSP hardware I2C0 peripheral) */
194+
#define DRIVER_CONFIG_HAS_I2C0 (1)
195+
#if (DRIVER_CONFIG_HAS_I2C0==1) && defined(I2C0_BASE)
196+
#define DRIVER_I2C0_SDA_PINCM (IOMUX_PINCM1)
197+
#define DRIVER_I2C0_SDA_PF (IOMUX_PINCM1_PF_I2C0_SDA)
198+
#define DRIVER_I2C0_SCL_PINCM (IOMUX_PINCM2)
199+
#define DRIVER_I2C0_SCL_PF (IOMUX_PINCM2_PF_I2C0_SCL)
200+
#define DRIVER_I2C0_CLOCK_SEL (DRIVER_CLK_MSP_BUSCLK)
201+
#define DRIVER_I2C0_CLOCK_FREQ (32000000U)
202+
#define DRIVER_I2C0_TRANSMIT_DMA_HW (DRIVER_DMA_HW_NONE)
203+
#define DRIVER_I2C0_TRANSMIT_DMA_CH (DRIVER_DMA_CH_NONE)
204+
#define DRIVER_I2C0_TRANSMIT_DMA_TRIG (DRIVER_DMA_TRIG_NONE)
205+
#define DRIVER_I2C0_RECEIVE_DMA_HW (DRIVER_DMA_HW_NONE)
206+
#define DRIVER_I2C0_RECEIVE_DMA_CH (DRIVER_DMA_CH_NONE)
207+
#define DRIVER_I2C0_RECEIVE_DMA_TRIG (DRIVER_DMA_TRIG_NONE)
208+
#endif
209+
210+
/* Driver_I2C1 Configuration (Maps to MSP hardware I2C1 peripheral) */
211+
#define DRIVER_CONFIG_HAS_I2C1 (1)
212+
#if (DRIVER_CONFIG_HAS_I2C1==1) && defined(I2C1_BASE)
213+
#define DRIVER_I2C1_SDA_PINCM (IOMUX_PINCM16)
214+
#define DRIVER_I2C1_SDA_PF (IOMUX_PINCM16_PF_I2C1_SDA)
215+
#define DRIVER_I2C1_SCL_PINCM (IOMUX_PINCM15)
216+
#define DRIVER_I2C1_SCL_PF (IOMUX_PINCM15_PF_I2C1_SCL)
217+
#define DRIVER_I2C1_CLOCK_SEL (DRIVER_CLK_MSP_BUSCLK)
218+
#define DRIVER_I2C1_CLOCK_FREQ (32000000U)
219+
#define DRIVER_I2C1_TRANSMIT_DMA_HW (DMA)
220+
#define DRIVER_I2C1_TRANSMIT_DMA_CH (2U)
221+
#define DRIVER_I2C1_TRANSMIT_DMA_TRIG (DMA_I2C1_TX_TRIG)
222+
#define DRIVER_I2C1_RECEIVE_DMA_HW (DMA)
223+
#define DRIVER_I2C1_RECEIVE_DMA_CH (3U)
224+
#define DRIVER_I2C1_RECEIVE_DMA_TRIG (DMA_I2C1_RX_TRIG)
225+
#endif
226+
```
227+
To include MSP-CMSIS-DRIVER software in another project, all that is required is to bring in the /msp-cmsis-driver directory to the project, and the corresponding include paths, and add a Driver_Config_MSP.h to the project (example shown above) to provide the static configurations for the driver instances.
228+
164229
## Supported Devices
165230

166231
The following LaunchPad evaluation kits are currently supported with code examples in this package:
@@ -220,6 +285,29 @@ The Driver_USART module supports the following capabilities:
220285
| MSPSWSDK-5154 | [SPS] CMSIS-Driver USART module loopback code example with DMA | The MSP-CMSIS-Driver product shall include a code example demonstrating USART in a loopback configuration with an external wire for loopback, demonstrating setup and teardown of the driver and use of DMA. | Implemented |
221286
| MSPSWSDK-5245 | [SPS] CMSIS-Driver USART module back channel UART example | The MSP-CMSIS-DRIVER product shall include a code example for USART transmit / receive in a back channel configuration with the XDS-110. | Implemented |
222287

288+
### Driver_I2C Specifications
289+
The Driver_I2C module supports the following capabilities:
290+
291+
| Req ID | Description | Summary | Status |
292+
| --------------|-------------------------|------------------------------------------------------|--------|
293+
| MSPSWSDK-5427 | [SPS] CMSIS-Driver I2C module feature: Controller mode | The MSP-CMSIS-DRIVER I2C module shall provide an option for operating in controller mode. | Implemented |
294+
| MSPSWSDK-5428 | [SPS] CMSIS-Driver I2C module feature: Target mode | The MSP-CMSIS-DRIVER I2C module shall provide an option for operating in target mode. | Implemented |
295+
| MSPSWSDK-5429 | [SPS] CMSIS-Driver I2C module feature: Transfer done event | The MSP-CMSIS-DRIVER I2C module shall provide a transfer done event fired when a transfer completes. | Implemented |
296+
| MSPSWSDK-5430 | [SPS] CMSIS-Driver I2C module feature: Transfer Incomplete event | The MSP-CMSIS-DRIVER I2C module shall provide a transfer imcompleted event fired when a transfer does not complete successfully. | Implemented |
297+
| MSPSWSDK-5431 | [SPS] CMSIS-Driver I2C module feature: Arbitration loss event | The MSP-CMSIS-DRIVER I2C module shall provide an arbitration lost event fired when bus abitration is lost. | Implemented |
298+
| MSPSWSDK-5432 | [SPS] CMSIS-Driver I2C module feature: Bus error event | The MSP-CMSIS-DRIVER I2C module shall provide a bus error event fired when there is an I2C bus error.| Implemented |
299+
| MSPSWSDK-5433 | [SPS] CMSIS-Driver I2C module feature: General call event | The MSP-CMSIS-DRIVER I2C module shall provide a general call event fired when a target is addressed via general call. | Implemented |
300+
| MSPSWSDK-5434 | [SPS] CMSIS-Driver I2C module feature: Bus clear event| The MSP-CMSIS-DRIVER I2C module shall provide a bus clear event fired when the I2C bus is cleared via 9 clock pulses. | Implemented |
301+
| MSPSWSDK-5435 | [SPS] CMSIS-Driver I2C module feature: Address NACK event | The MSP-CMSIS-DRIVER I2C module shall provide a NACK event fired when the controller receives a NACK response.| Implemented |
302+
| MSPSWSDK-5436 | [SPS] CMSIS-Driver I2C module feature: Slave transmit event | The MSP-CMSIS-DRIVER I2C module shall provide a slave transmit event fired when the target is addressed to write but SlaveTransmit was not called. | Implemented |
303+
| MSPSWSDK-5437 | [SPS] CMSIS-Driver I2C module feature: Slave receive event | The MSP-CMSIS-DRIVER I2C module shall provide a slave receive event fired when the target is addressed to read but SlaveReceive was not called.| Implemented |
304+
| MSPSWSDK-5438 | [SPS] CMSIS-Driver I2C module feature: Bus speed selection | The MSP-CMSIS-DRIVER I2C module shall provide an option of selecting different bus speeds for the I2C driver. | Implemented |
305+
| MSPSWSDK-5439 | [SPS] CMSIS-Driver I2C module feature: I2C own address selection | The MSP-CMSIS-DRIVER I2C module shall provide an option for a target to set its own address.| Implemented |
306+
| MSPSWSDK-5440 | [SPS] CMSIS-Driver I2C module feature: 10-bit address mode | The MSP-CMSIS-DRIVER I2C module shall provide an option for a target to use a 10-bit addressing mode. | Implemented |
307+
| MSPSWSDK-5441 | [SPS] CMSIS-Driver I2C module feature: DMA driven transfers | The MSP-CMSIS-DRIVER I2C module shall provide an option for using DMA-driven non-blocking transfers. | Implemented |
308+
| MSPSWSDK-5442 | [SPS] CMSIS-Driver I2C Controller and Target transfer example | The MSP-CMSIS-DRIVER product shall include an example showcasing transfers between controller and target. | Implemented |
309+
| MSPSWSDK-5446 | [SPS] CMSIS-Driver I2C Controller and Target w/ DMA transfer example | The MSP-CMSIS-DRIVER product shall include an example showcasing transfers with DMA between controller and target. | Implemented |
310+
223311
## Known Issues
224312

225313
| Bug ID | Description | Summary | Status |
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright (c) 2024, Texas Instruments Incorporated
3+
* All rights reserved.
4+
*
5+
* TODO: Add license
6+
*/
7+
/*!****************************************************************************
8+
* @file Driver_Config_MSP.h
9+
* @brief CMSIS-Drivers board configuration file for Texas Instruments
10+
* MSP MCUs based on Arm Cortex-M CPUs
11+
*
12+
* This configuration file must be tailored for each board port.
13+
*
14+
* <hr>
15+
******************************************************************************
16+
*/
17+
18+
#ifndef DRIVER_CONFIG_MSP_H_
19+
#define DRIVER_CONFIG_MSP_H_
20+
21+
#ifdef __cplusplus
22+
extern "C"
23+
{
24+
#endif
25+
26+
#include <ti/devices/msp/msp.h>
27+
#include <Driver_I2C_MSP.h>
28+
29+
/* I2C Driver Configuration Options */
30+
31+
/* Driver_I2C0 Configuration (Maps to MSP hardware I2C0 peripheral) */
32+
#define DRIVER_CONFIG_HAS_I2C0 (1)
33+
#if (DRIVER_CONFIG_HAS_I2C0==1) && defined(I2C0_BASE)
34+
#define DRIVER_I2C0_SDA_PINCM (IOMUX_PINCM1)
35+
#define DRIVER_I2C0_SDA_PF (IOMUX_PINCM1)
36+
#define DRIVER_I2C0_SCL_PINCM (IOMUX_PINCM2)
37+
#define DRIVER_I2C0_SCL_PF (IOMUX_PINCM2_PF_I2C0_SCL)
38+
#define DRIVER_I2C0_CLOCK_SEL (DRIVER_CLK_MSP_BUSCLK)
39+
#define DRIVER_I2C0_CLOCK_FREQ (32000000U)
40+
#define DRIVER_I2C0_TRANSMIT_DMA_HW (DMA)
41+
#define DRIVER_I2C0_TRANSMIT_DMA_CH (0U)
42+
#define DRIVER_I2C0_TRANSMIT_DMA_TRIG (DMA_I2C0_TX_TRIG)
43+
#define DRIVER_I2C0_RECEIVE_DMA_HW (DMA)
44+
#define DRIVER_I2C0_RECEIVE_DMA_CH (1U)
45+
#define DRIVER_I2C0_RECEIVE_DMA_TRIG (DMA_I2C0_RX_TRIG)
46+
#endif
47+
48+
/* Driver_I2C1 Configuration (Maps to MSP hardware I2C1 peripheral) */
49+
#define DRIVER_CONFIG_HAS_I2C1 (1)
50+
#if (DRIVER_CONFIG_HAS_I2C1==1) && defined(I2C1_BASE)
51+
#define DRIVER_I2C1_SDA_PINCM (IOMUX_PINCM16)
52+
#define DRIVER_I2C1_SDA_PF (IOMUX_PINCM16_PF_I2C1_SDA)
53+
#define DRIVER_I2C1_SCL_PINCM (IOMUX_PINCM15)
54+
#define DRIVER_I2C1_SCL_PF (IOMUX_PINCM15_PF_I2C1_SCL)
55+
#define DRIVER_I2C1_CLOCK_SEL (DRIVER_CLK_MSP_BUSCLK)
56+
#define DRIVER_I2C1_CLOCK_FREQ (32000000U)
57+
#define DRIVER_I2C1_TRANSMIT_DMA_HW (DMA)
58+
#define DRIVER_I2C1_TRANSMIT_DMA_CH (2U)
59+
#define DRIVER_I2C1_TRANSMIT_DMA_TRIG (DMA_I2C1_TX_TRIG)
60+
#define DRIVER_I2C1_RECEIVE_DMA_HW (DMA)
61+
#define DRIVER_I2C1_RECEIVE_DMA_CH (3U)
62+
#define DRIVER_I2C1_RECEIVE_DMA_TRIG (DMA_I2C1_RX_TRIG)
63+
#endif
64+
65+
/* Driver_I2C1 Configuration (Maps to MSP hardware I2C1 peripheral) */
66+
#define DRIVER_CONFIG_HAS_I2C2 (0)
67+
#if (DRIVER_CONFIG_HAS_I2C2==1) && defined(I2C2_BASE)
68+
#define DRIVER_I2C2_SDA_PINCM (IOMUX_PINCM16)
69+
#define DRIVER_I2C2_SDA_PF (IOMUX_PINCM16_PF_I2C1_SDA)
70+
#define DRIVER_I2C2_SCL_PINCM (IOMUX_PINCM15)
71+
#define DRIVER_I2C2_SCL_PF (IOMUX_PINCM15_PF_I2C1_SCL)
72+
#define DRIVER_I2C2_CLOCK_FREQ (32000000U)
73+
#define DRIVER_I2C2_TRANSMIT_DMA_HW (DRIVER_DMA_HW_NONE)
74+
#define DRIVER_I2C2_TRANSMIT_DMA_CH (DRIVER_DMA_CH_NONE)
75+
#define DRIVER_I2C2_TRANSMIT_DMA_TRIG (DRIVER_DMA_TRIG_NONE)
76+
#define DRIVER_I2C2_RECEIVE_DMA_HW (DRIVER_DMA_HW_NONE)
77+
#define DRIVER_I2C2_RECEIVE_DMA_CH (DRIVER_DMA_CH_NONE)
78+
#define DRIVER_I2C2_RECEIVE_DMA_TRIG (DRIVER_DMA_TRIG_NONE)
79+
#endif
80+
81+
#ifdef __cplusplus
82+
}
83+
#endif
84+
85+
#endif /* DRIVER_CONFIG_MSP_H_ */
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Example Summary
2+
3+
This is an example project for the CMSIS-Driver I2C module.
4+
The example uses the I2C0 and I2C1 device peripherals for communication, which present as Driver_I2C0 and Driver_I2C1 respectively in the CMSIS-Driver I2C module.
5+
The project uses SysConfig for initialization, but all functionality related to the CMSIS-Driver I2C module is handled by the CMSIS-Driver itself. All transmissions
6+
in this example are done using the DMA. Connect PA0 and PB3 with a jumper wire. Connect PA1 and PB2 with a jumper wire. External resistors are needed and should be connected to PA0 and PA1, or PB2 and PB3. The on-board pull up resistors can be used by populating J19 and J20.
7+
8+
This example uses on-board LEDs to demonstrate succesfully transmission between target and controller. When the controller transmits data to the target, the BLUE led
9+
is turned on. When the target transmit data to the controller, the RED led is turned on.
10+
11+
## Peripherals, Pin Functions, MCU Pins, Launchpad Pins
12+
| Peripheral | Function | Pin | Launchpad Pin |
13+
| --- | --- | --- | --- |
14+
| BOARD | Debug Clock | PA20 | J19_16 |
15+
| BOARD | Debug Data In Out | PA19 | J19_14 |
16+
| I2C0 | I2C0_SDA | PA0 |
17+
| I2C0 | I2C0_SCL | PA1 |
18+
| I2C1 | I2C1_SCL | PB2 |
19+
| I2C1 | I2C1_SDA | PB3 |
20+
| GPIOB | USER_LED_1 | PB22 |
21+
| GPIOB | USER_LED_2 | PB26 |

0 commit comments

Comments
 (0)