Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2C #36

Open
parthitce opened this issue Nov 22, 2024 · 3 comments
Open

I2C #36

parthitce opened this issue Nov 22, 2024 · 3 comments
Assignees

Comments

@parthitce
Copy link
Member

parthitce commented Nov 22, 2024

  • Controller and Target support testing
  • Suspend, resume with handling for pinmux states changes, clock disablement or switch low power clock handling

Initial work here: msp-ti@ea9eaee

@parthitce parthitce self-assigned this Nov 28, 2024
@parthitce
Copy link
Member Author

Pulled in the changes from msp-ti@ea9eaee (branch: https://github.com/msp-ti/zephyr/commits/mspm0_dev_stable/)
But I2C scan fails to show the devices, debugging further: https://github.com/linumiz/zephyr/tree/dev/ti/mspm0-i2c

@parthitce
Copy link
Member Author

I2C Controller mode works fine. Target mode is still work in progress and checking with Jackson for possible fix.

@parthitce
Copy link
Member Author

git diff boards/ti/lp_mspm0g3507/lp_mspm0g3507_mspm0g3507.dts
diff --git a/boards/ti/lp_mspm0g3507/lp_mspm0g3507_mspm0g3507.dts b/boards/ti/lp_mspm0g3507/lp_mspm0g3507_mspm0g3507.dts
index c9305262a19..dffa84e90a6 100644
--- a/boards/ti/lp_mspm0g3507/lp_mspm0g3507_mspm0g3507.dts
+++ b/boards/ti/lp_mspm0g3507/lp_mspm0g3507_mspm0g3507.dts
@@ -101,7 +101,7 @@
 };
 
 &i2c0 {
-       status = "okay";
+       status = "disabled";
        pinctrl-0 = <&i2c0_scl_pa31 &i2c0_sda_pa28>;
        pinctrl-names = "default";
 };
@@ -110,8 +110,17 @@
        status = "okay";
        pinctrl-0 = <&i2c1_scl_pb2 &i2c1_sda_pb3>;
        pinctrl-names = "default";
+
+       eeprom0: eeprom@54 {
+               reg = <0x54>;
+               size = <256>;
+               compatible = "zephyr,i2c-target-eeprom";
+               status = "okay";
+       };
 };
 
+target_eeprom: &eeprom0{};
+
 &rtc0 {
        status = "okay";
 };

and with

git diff samples/
diff --git a/samples/drivers/i2c/target_eeprom/prj.conf b/samples/drivers/i2c/target_eeprom/prj.conf
index 03350edd923..7c1f280a13c 100644
--- a/samples/drivers/i2c/target_eeprom/prj.conf
+++ b/samples/drivers/i2c/target_eeprom/prj.conf
@@ -1,3 +1,6 @@
 CONFIG_I2C=y
 CONFIG_I2C_TARGET=y
 CONFIG_I2C_EEPROM_TARGET=y
+
+CONFIG_SHELL=y
+CONFIG_I2C_SHELL=y
diff --git a/samples/drivers/i2c/target_eeprom/src/main.c b/samples/drivers/i2c/target_eeprom/src/main.c
index d1c42f9a401..5a02eb082c0 100644
--- a/samples/drivers/i2c/target_eeprom/src/main.c
+++ b/samples/drivers/i2c/target_eeprom/src/main.c
@@ -27,7 +27,8 @@ int main(void)
 
        printk("i2c target driver registered\n");
 
-       k_msleep(1000);
+       while (1)
+               k_msleep(1000);
 
        if (i2c_target_driver_unregister(eeprom) < 0) {
                printk("Failed to unregister i2c target driver\n");

target mode works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant