2022-06-14 11:49 PM
Hi,
I am trying to set the FRAM memory mb85rc64ta in sleep mode (Datasheet: I cannot copy and paste a link, but it is from Fujitsu and the pdf file is called MB85RC64TA-DS501-00044-4v1-E page 11)
It requires 2 START condition but no STOP condition before the second one. I have tried modifying a HAL function to do this but always I get the second START bit condition, I get a STOP one right before.
How should I do this?
2022-06-20 01:02 PM
For things like the EEPROM, and likely the FRAM, there are two addresses to consider. One is the device address on the I2C bus. That's determined strictly by the chip manufacturer and the state of the address pins (if any). The allowable range of addresses on the I2C bus is 0x0 to 0x7F, with certain addresses reserved. When the I2C chip puts this address on the bus, it shifts it up by one, thus going 0x0 to 0xFF in steps of two. The LSB contains the read/write flag.
The second byte generally contains either a command or an address. In this case, normal reads and writes use a 16 bit address. For your sleep function, you need the memory address to be 0xAn where n is the chip's address.
This requires the HAL firmware to be set into an 8 bit address mode (internally).
HAL_StatusTypeDef HAL_I2C_Mem_Read(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress,
uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
So as I see it, DevAddress is the 7 bit address shifted over by one, MemAddress is 0x5x (X for your hardware address) shifted by one - so 0xAn, MemAddSize should be set for 8 bits, pData should point to an 8 bit variable with the contents of 0x86. Timeout is whatever you desire.
That should send the data the chip needs.