circuitpython/ports
yn386 65d82066a8 stm32/pyb_i2c: Fix failing pyb.I2C(dma=True) after receiving 1 byte.
Excuting the code:

    i2c = I2C(1, I2C.CONTROLLER, dma=True)
    tmp = i2c.recv(1, i2c_addr)
    recv_data = bytearray(56)
    i2c.recv(recv_data, i2c_addr)

The second i2c.recv() fails with OSError: [Errno 110] ETIMEDOUT.  When
receiving greater than or equal to 2 bytes at first i2c.recv(), the second
i2c.recv() succeeds.  This issue does not occur without DMA.

Details of change: when executing I2C with DMA:

- Bit 11 of I2Cx_CR2 (DMA Request Enable) should be 1 to indicate that DMA
  transfer is enabled.  This bit is set after I2C event interrupt is
  enabled in HAL_I2C_Master_Transmit_DMA()/HAL_I2C_Master_Receive_DMA(), so
  DMA Request Enable bit might be 0 in IRQHandler.

- In case of data receive:
    - When only 1 byte receiption, clear I2Cx_CR1's bit 10 (ACK).
    - When only 2 byte receiption, clear I2Cx_CR1's bit 10 (ACK) and set
      bit 11 (POS).
    - When greater than or equal to 2 byte receiption, bit 12 of I2Cx_CR2
      (DMA Last Transfer) should set to generate NACK when DMA transfer
      completed.

Otherwise, the I2C bus may be busy after received data from peripheral.
2022-11-18 13:55:14 +11:00
..
bare-arm bare-arm/mpconfigport.h: Disable remaining optional features. 2021-11-01 14:23:06 +11:00
cc3200 extmod: Make extmod.mk self-contained. 2022-10-11 23:31:49 +11:00
esp32 extmod/extmod.cmake: Add MICROPY_PY_BTREE compiler definition. 2022-11-17 23:20:58 +11:00
esp8266 esp8266/machine_pin: Disable open drain when pin becomes input/output. 2022-11-15 12:51:39 +11:00
mimxrt mimxrt/Makefile: Set MPY_CROSS_FLAGS. 2022-11-17 22:10:40 +11:00
minimal minimal/Makefile: Set linker to $(CC). 2022-11-15 17:09:37 +11:00
nrf shared/tinyusb: Further refactor static USB device implementation. 2022-11-11 16:47:36 +11:00
pic16bit all: Use += rather than = everywhere for CFLAGS/LDFLAGS/LIBS. 2022-10-11 23:17:41 +11:00
powerpc all: Use += rather than = everywhere for CFLAGS/LDFLAGS/LIBS. 2022-10-11 23:17:41 +11:00
qemu-arm py/objstr: Add hex/fromhex to bytes/memoryview/bytearray. 2022-08-12 12:44:30 +10:00
renesas-ra renesas-ra: Change file system size to 64KB for RA6M1. 2022-11-15 10:01:36 +11:00
rp2 rp2/boards/ARDUINO_NANO_RP2040: Add more modules and enable MD5 hash. 2022-11-14 19:06:51 +11:00
samd samd/Makefile: Set MPY_CROSS_FLAGS. 2022-11-17 22:10:41 +11:00
stm32 stm32/pyb_i2c: Fix failing pyb.I2C(dma=True) after receiving 1 byte. 2022-11-18 13:55:14 +11:00
teensy extmod: Make extmod.mk self-contained. 2022-10-11 23:31:49 +11:00
unix extmod/extmod.mk: Set default mbedtls config file in extmod Makefile. 2022-11-09 18:43:13 +01:00
webassembly webassembly/library: Make use of CustomEvent detail property. 2022-11-11 13:21:28 +11:00
windows windows: Make project file read-only for IDE. 2022-11-15 16:37:31 +11:00
zephyr zephyr: Rename machine I2C and SPI types consistently across ports. 2022-10-22 12:58:21 +11:00