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: allow static redefinition of I2C buffer size #853

Merged
merged 1 commit into from
Jan 6, 2020

Conversation

ABOSTM
Copy link
Contributor

@ABOSTM ABOSTM commented Jan 3, 2020

Summary

I2C: allow static redefinition of I2C buffer size.
Default buffer size is still 32, but it is now possible to redefine compilation switch: I2C_TXRX_BUFFER_SIZE
It's maximum value is 255

Now it is possible to transfer up to 255 bytes for all following cases:

  • Master read
  • Master write
  • Slave read
  • Slave write

Warning: a bug in STM32 cube HAL currently prevents, in Master mode, to send/receive exactly 255 bytes.
Issue is tracked internally, and fix should come in later release.

Nevertheless, if required, it is possible to patch the STM32 cube HAL:
for example, when working on NUCLEO_L476RG in file stm32l4xx_hal_i2c.c (adapt file name to the STM32 familly you are working on), replace all occurrences of
if (hi2c->XferCount < MAX_NBYTE_SIZE)
by
if (hi2c->XferCount <= MAX_NBYTE_SIZE)

Default buffer size is still 32,
but it is now possible to redefine compilation switch: I2C_TXRX_BUFFER_SIZE
It's maximum value is 255
@fpistm fpistm added the enhancement New feature or request label Jan 3, 2020
@fpistm fpistm added this to the 1.8.1 milestone Jan 3, 2020
@fpistm fpistm self-requested a review January 3, 2020 17:06
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

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

LGTM

@fpistm
Copy link
Member

fpistm commented Jan 3, 2020

Note: this is internal I2C buffer size.

@ABOSTM ABOSTM mentioned this pull request Jan 3, 2020
@fpistm
Copy link
Member

fpistm commented Jan 6, 2020

@fpistm fpistm merged commit bca9a7e into stm32duino:master Jan 6, 2020
@fpistm fpistm added the fix 🩹 Bug fix label Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fix 🩹 Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants