-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds I2C leader interrupt based example
- Loading branch information
1 parent
b8cd7a2
commit 33d717d
Showing
7 changed files
with
520 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file added
BIN
+57.3 KB
platform_i2c_leader_interrupt/SimplicityStudio/platform_i2c_leader_interrupt.sls
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/***************************************************************************//** | ||
* @file | ||
* @brief Top level application functions | ||
******************************************************************************* | ||
* # License | ||
* <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b> | ||
******************************************************************************* | ||
* | ||
* The licensor of this software is Silicon Laboratories Inc. Your use of this | ||
* software is governed by the terms of Silicon Labs Master Software License | ||
* Agreement (MSLA) available at | ||
* www.silabs.com/about-us/legal/master-software-license-agreement. This | ||
* software is distributed to you in Source Code format and is governed by the | ||
* sections of the MSLA applicable to Source Code. | ||
* | ||
******************************************************************************/ | ||
|
||
#ifndef APP_H | ||
#define APP_H | ||
|
||
/***************************************************************************//** | ||
* Initialize application. | ||
******************************************************************************/ | ||
void app_init(void); | ||
|
||
/***************************************************************************//** | ||
* App ticking function. | ||
******************************************************************************/ | ||
void app_process_action(void); | ||
|
||
#endif // APP_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# I2C leader interrupt based C Example | ||
|
||
## Summary | ||
This project shows how to configure the I2C periphreal in leader mode, | ||
and use interrupt based routine to perform I2C transfers with a | ||
secondary device. The I2C state machine is implemented in the I2C interrupt | ||
handler. Both read and write operations are supported and can be configured | ||
using the push buttons. | ||
|
||
## Gecko SDK Version | ||
v4.4.3 | ||
|
||
## Hardware Required | ||
|
||
* Board: 2x Silicon Labs EFR32xG24 Starter Kit + WSTK (BRD4186C + BRD4001A) | ||
* Device: EFR32MG24B210F1536IM48 | ||
|
||
## Setup | ||
Clone the repository with this project from GitHub onto your local machine. | ||
|
||
From within the Simplicity Studio IDE, select Import -> MCU Project... from the | ||
Project menu. Click the Browse button and navigate to the local repository | ||
folder, then to the SimplicityStudio folder, select the .slsproj/.sls file for the | ||
board, click the Next button twice, and then click Finish. | ||
|
||
Import the [I2C_Follower](https://github.com/SiliconLabs/peripheral_examples/tree/master/series2/i2c/i2c_follower) example from the peripehral examples repo | ||
|
||
|
||
Connect the GND, I2C_SCL, and I2C_SDA pins between the two boards and use a | ||
logic analyzer to probe the SCL and SDA pin. Or run the project in debug mode | ||
and check the receiveBuffer for read operations. | ||
|
||
I2C_SCL -> PC05 EXP 15 | ||
I2C_SDA -> PC07 EXP 16 | ||
|
||
Press Push Button 0 for read request from leader to follower | ||
Press Push Button 1 for write request from leader to follower | ||
|
||
## How the Project Works | ||
The I2C leader state machine is configured in the I2C handler using different | ||
I2C interrupt. The state machine itself is documented in the EFR32xg24 reference | ||
manual's I2C chapter. | ||
The I2C follower example is used to test the leader project, but ideally any I2C | ||
follower device should work as long as the follower's address is written correctly. | ||
|
||
## .sls Projects Used | ||
* i2c_leader_interrupt.sls | ||
|
||
## How to Port to Another Part | ||
Right click on the project and select "Properties" and navigate to "C/C++ | ||
Build" then "Board/Part/SDK". Select the new board or part to target and apply | ||
the changes. There may be some dependencies that need to be resolved when | ||
changing the target architecture. This project can only be run on other | ||
Series 1 devices. |
Oops, something went wrong.