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

Problem with writing more then 16 bytes. #10

Closed
orange-beans opened this issue Feb 9, 2024 · 7 comments
Closed

Problem with writing more then 16 bytes. #10

orange-beans opened this issue Feb 9, 2024 · 7 comments

Comments

@orange-beans
Copy link

orange-beans commented Feb 9, 2024

Chipset: STM32F410
EEPROM Chip: EE24AT02 (EE24_2KBIT)

Problem occurs when try to write more than 16 bytes:
Code:

  for (uint32_t i = 0; i < 32; i ++) {
    EEPROM_DATA[i] = i;
  }
  if (EE24_Init(&ee24, &hi2c1, EE24_ADDRESS_DEFAULT))
  {
    EE24_Write(&ee24, 0, EEPROM_DATA, 32, 1000);
  }

Result:

10 11 12 13 14 15 16 17
18 19 1A 1B 1C 1D 1E 1F
10 11 12 13 14 15 16 17
18 19 1A 1B 1C 1D 1E 1F

While the correct result should be:

00 01 02 03 04 05 06 07
08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17
18 19 1A 1B 1C 1D 1E 1F

What might be the problem?

@nimaltd
Copy link
Owner

nimaltd commented Feb 13, 2024

hi. let me check the code again. but someone told me check its and it works fine

@Andrew170285
Copy link

A similar problem. STM32F407, 24LC02, RTOS

@Andrew170285
Copy link

Andrew170285 commented Feb 16, 2024

In the ee24.c file, line 104
98 w = EE24_PSIZE - (Address % EE24_PSIZE);
99 if (w > Len)
100 {
101 w = Len;
102 }
103 #if ((EE24_SIZE == EE24_1KBIT) || (EE24_SIZE == EE24_2KBIT))
104 if (HAL_I2C_Mem_Write(Handle->HI2c, Handle->Address, Address, I2C_MEMADD_SIZE_8BIT, Data, Len, Timeout) == HAL_OK)
_____________________________________________________________________________________________________________^
replace Len with w

@nimaltd
Copy link
Owner

nimaltd commented Feb 16, 2024

@Andrew170285 okay. I will check it soon. Thanks for report.

@nimaltd
Copy link
Owner

nimaltd commented Feb 17, 2024

it has been fixed and I added WP pin.

@nimaltd nimaltd closed this as completed Feb 17, 2024
@orange-beans
Copy link
Author

Working great after updates, thanks!

@nimaltd
Copy link
Owner

nimaltd commented Feb 19, 2024

Your welcome

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

No branches or pull requests

3 participants