2023-06-26 02:50 AM
Hello,
I am try to write the data for memory address in EEPROM using standard protocol I2C. we are trying in data write to memory Address and Driver IC read to operates the Sensorless BLDC motor. so I am working in this method. But am put in the data's for properly in the function but address was can't write properly. I attach my output waveform.
2023-06-26 09:02 AM
1 - You do not need to include the address in your data arrays (EE_buf, DEV_BUF, etc.), just put the data there. And if each write operation is only 1 (data) byte, you don't need arrays to store them in.
2 - You HAL_I2C_Mem_Write() is incorrect. You correctly pass the register address, but the next param (the 4th parameter in the function call) is the SIZE of the address. You pass "2" which HAL interprets to mean "send the address as a 16-bit value" (see the I2C_MEMADD_SIZE_8BIT and I2C_MEMADD_SIZE_16BIT). You should be passing "I2C_MEMADD_SIZE_8BIT" (or if you insist on poor programming style, "1").
2023-06-26 09:52 AM
Might help to communicate which part you are using in each post. DRV10983 from prior one
https://www.ti.com/lit/ds/slvscp6h/slvscp6h.pdf?ts=1687761058949
The Register address space is 8-bit wide, registers 0x20 - 0x2B being EEPROM, and having default values you could likely read back and confirm.
// Something with some semblence of diagrammed pattern
uint8_t reg20 = 0x39;
HAL_I2C_Mem_Write(&hi2c1, 0xA4, 0x20, I2C_MEMADD_SIZE_8BIT, ®20, sizeof(reg20), 10);