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

Fix for I2C #40

Merged
merged 1 commit into from
Dec 12, 2020
Merged

Fix for I2C #40

merged 1 commit into from
Dec 12, 2020

Conversation

Serhiy-K
Copy link
Contributor

Tested with Marlin-bugfix-2.0.x and my LPC1768 dev board.

@p3p
Copy link
Owner

p3p commented Aug 21, 2020

I think removing the address bitshift inherited from mbed will require changing Marlin to not compensate for it, the update to the CMSIS implementation is interesting, that's the driver supplied by LPC so will need to try and confirm your change doesn't have any side effects.

@Serhiy-K
Copy link
Contributor Author

Serhiy-K commented Aug 21, 2020

I tested my LCD panel with I2C bus with boards based on AVR-mega2560 , STM32F103 and STM32F411. In this cases function Wire.beginTransmission(address) uses address param without bitshift. The address is shifted inside this function. And all works good.
About CMSIS. In attached file in function I2C_MasterTransferData line number 892 if (TransferCfg->rx_count < (TransferCfg->rx_length - 1)) looks like my patch. In this data read cycle all bytes transfered with ACK except last byte according to Master Receiver mode description in UM10360. If TransferCfg->rx_count will be less (TransferCfg->rx_length - 2) then it point to pre-last byte. Attached CMSIS file was installed in CoIDE and used in my old project without correction. CMSIS may have mistakes as other programs.
lpc17xx_i2c.zip

@Serhiy-K
Copy link
Contributor Author

I tried to find lpc17xx_i2c with comparison (rx_count < x_length - 2) but only found with (rx_count < x_length - 1). In fact it was a file as I added in previous message. I think x_length - 2 is typo.
About address bitshift - just add a comment that a left shift address is used.

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

Successfully merging this pull request may close these issues.

2 participants