Skip to content

Conversation

@cameled
Copy link
Contributor

@cameled cameled commented Dec 30, 2021

Add a interrupt driven gd32 i2c driver.

Support transfer mode: Standard-mode, Fast-mode and Fast-mode Puls.

For GD32 SoCs, normally Standard-mode and Fast-mode are supported. Some SoCs, like GD32VF103xx, support Fast-mode Puls too. Since Standard-mode(up to 100kbit/s) and Fast-mode(up to 400kbit/s) is too slow, I use the interrupts to driven the data transfer.

There still have some known issue which list in below:

  • Repeat start not worked for read msg, can not clear the write msg btc interrupt.

More GD32 work #38657

@nandojve nandojve mentioned this pull request Dec 30, 2021
55 tasks
@nandojve nandojve changed the title Introduce GD32 I2C driver to Zephyr. drivers: i2c: Introduce GD32 I2C driver Dec 30, 2021
@cameled
Copy link
Contributor Author

cameled commented Dec 30, 2021

Use i2c_gd32_reg_dump() to track i2c runtime state, looks it can help us to learn how the i2c work.

@cameled cameled force-pushed the gd32-i2c branch 2 times, most recently from 8210ef3 to 28a17db Compare December 31, 2021 09:02
@cameled
Copy link
Contributor Author

cameled commented Dec 31, 2021

I think i2c functional work is done, only some document work left.

@gmarull gmarull requested review from gmarull and nandojve January 1, 2022 21:29
@teburd teburd self-requested a review January 4, 2022 16:00
@github-actions
Copy link

github-actions bot commented Jan 5, 2022

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
hal_gigadevice zephyrproject-rtos/hal_gigadevice@05de2b5 zephyrproject-rtos/hal_gigadevice@242a7f4 (main) zephyrproject-rtos/[email protected]

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@cameled cameled force-pushed the gd32-i2c branch 7 times, most recently from 77d9208 to 4bbb31d Compare January 10, 2022 06:10
upgrade hal_gigadevice to get i2c clock frequency boundary definition.

Signed-off-by: HaiLong Yang <[email protected]>
Add gd32 i2c interface support.

Signed-off-by: HaiLong Yang <[email protected]>
@github-actions github-actions bot removed the DNM This PR should not be merged (Do Not Merge) label Jan 10, 2022
Copy link
Contributor

@teburd teburd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good to me

@carlescufi
Copy link
Member

@nandojve please take a look

Add an interrupt driven i2c driver for gd32 i2c peripheral.

The transmit and reception method refer from GD32 SoCs user manual.
Particularly, reception method choose the solution B.

There have some wait for state ready logic in the driver. It cause by
i2c device internal state change slower than i2c driver.

Signed-off-by: HaiLong Yang <[email protected]>
Add i2c0 interface to gd32f450i_eval board.

Signed-off-by: HaiLong Yang <[email protected]>
Add gd32f450i_eval board with AT2402C eeprom.

Signed-off-by: HaiLong Yang <[email protected]>
Copy link
Member

@nandojve nandojve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MaureenHelm MaureenHelm merged commit 1d3c710 into zephyrproject-rtos:main Jan 14, 2022
@cameled cameled deleted the gd32-i2c branch January 15, 2022 03:45
@str4t0m str4t0m added the platform: GD32 GigaDevice label Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants