8000 stmhal: I2C not working with DMA enabled · Issue #2643 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

stmhal: I2C not working with DMA enabled #2643

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

Closed
blazewicz opened this issue Nov 17, 2016 · 2 comments
Closed

stmhal: I2C not working with DMA enabled #2643

blazewicz opened this issue Nov 17, 2016 · 2 comments

Comments

@blazewicz
Copy link
Contributor

Adding an issue as discussed in #2408

For example, tests/pyb/i2c.py fails if following patch is applied:

diff --git a/tests/pyb/i2c.py b/tests/pyb/i2c.py
index a220f8e..0b3ba93 100644
--- a/tests/pyb/i2c.py
+++ b/tests/pyb/i2c.py
@@ -11,7 +11,7 @@ for bus in (-1, 0, 1, 2, 3, "X", "Y", "Z"):

 i2c = I2C(1)

-i2c.init(I2C.MASTER, baudrate=400000)
+i2c.init(I2C.MASTER, baudrate=400000, dma=True)
 print(i2c.scan())
 i2c.deinit()
@yn386
Copy link
Contributor
yn386 commented Aug 31, 2022

I met the same issue with NUCLEO-F446RE and I found some additional implementation is needed to i2c_ev_irq_handler.

I tried to fix in #9167.

dpgeorge pushed a commit that referenced this issue Sep 6, 2022
Prior to this commit, excuting this code:

    i2c = I2C(1, I2C.CONTROLLER, dma=True)
    i2c.send(data, addr=i2c_addr)

the call to i2c.send() does not return and the board needs a reset.  This
code works when dma=False.

According to the specification, I2Cx_EV_IRQHandler should:
- Write DR to address when Start condition generated.
- Clear ADDR by reading SR2 after reading SR2 when address sent.

These processes are included in HAL_I2C_EV_IRQHandler(), however the
firmware size increses about 2KB if HAL_I2C_EV_IRQHandler is called.  This
commit adds above processes to i2c_ev_irq_handler, and increases firmware
by less than 100 bytes.

Fixes issue #2643.
@dpgeorge
Copy link
Member
dpgeorge commented Sep 6, 2022

Fixed by da50827

@dpgeorge dpgeorge closed this as completed Sep 6, 2022
karfas pushed a commit to karfas/micropython that referenced this issue Apr 23, 2023
Prior to this commit, excuting this code:

    i2c = I2C(1, I2C.CONTROLLER, dma=True)
    i2c.send(data, addr=i2c_addr)

the call to i2c.send() does not return and the board needs a reset.  This
code works when dma=False.

According to the specification, I2Cx_EV_IRQHandler should:
- Write DR to address when Start condition generated.
- Clear ADDR by reading SR2 after reading SR2 when address sent.

These processes are included in HAL_I2C_EV_IRQHandler(), however the
firmware size increses about 2KB if HAL_I2C_EV_IRQHandler is called.  This
commit adds above processes to i2c_ev_irq_handler, and increases firmware
by less than 100 bytes.

Fixes issue micropython#2643.
alphonse82 pushed a commit to alphonse82/micropython-wch-ch32v307 that referenced this issue May 8, 2023
Prior to this commit, excuting this code:

    i2c = I2C(1, I2C.CONTROLLER, dma=True)
    i2c.send(data, addr=i2c_addr)

the call to i2c.send() does not return and the board needs a reset.  This
code works when dma=False.

According to the specification, I2Cx_EV_IRQHandler should:
- Write DR to address when Start condition generated.
- Clear ADDR by reading SR2 after reading SR2 when address sent.

These processes are included in HAL_I2C_EV_IRQHandler(), however the
firmware size increses about 2KB if HAL_I2C_EV_IRQHandler is called.  This
commit adds above processes to i2c_ev_irq_handler, and increases firmware
by less than 100 bytes.

Fixes issue micropython#2643.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0