FM6124 Ramtron Corporation, FM6124 Datasheet - Page 44

no-image

FM6124

Manufacturer Part Number
FM6124
Description
Event Data Recorder With F-ram
Manufacturer
Ramtron Corporation
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
FM6124
Manufacturer:
FM/富满电子
Quantity:
20 000
Part Number:
FM6124-QG
Manufacturer:
ABOV
Quantity:
3 000
////////////////////////////////////////////////////////////////////////////////
// Function:
// Description:
// Parameters:
// Return value:
// Remarks:
//
//
////////////////////////////////////////////////////////////////////////////////
ruint8
FM6124ReadFRAM(ruint16 a_uiFramAddr)
{
}
Rev. 4.0 (EOL)
July 2010
ruint8 l_uiDataRead;
// Make sure I2C is Idle
while(!(I2CSTATUS & 0x08));
// Wait for TX Buffer to be empty
while((I2CSTATUS & 0x01) == 0);
// Dummy Read to clear the I2CRXAVF
l_uiDataRead = I2CRXTX;
// Send Write command to FM6124
I2CRXTX = I2C_ID_FM | g_uiI2CDevSelect | IC2_WRITE;
// Wait for TX Buffer to be empty
while((I2CSTATUS & 0x01) == 0);
// Make sure we received an ACK and that there was no error during transfer
if (I2CSTATUS & 0xC0)
{
}
// Send Read Address, 8 MSB
I2CRXTX = (a_uiFramAddr >> 8) & 0xFF;
// Wait for TX Buffer to be empty
while((I2CSTATUS & 0x01) == 0);
// Make sure we received an ACK and that there was no error during transfer
if (I2CSTATUS & 0xC0)
{
}
// Send Read Address, 8 LSB
I2CRXTX = a_uiFramAddr & 0xFF;
// Wait for I2C to be Idle, This will generate a STOP
while(!(I2CSTATUS & 0x08));
// Make sure we received an ACK and that there was no error during transfer
if (I2CSTATUS & 0xC0)
{
}
// Now, send the Read command to the FM6124
I2CRXTX = I2C_ID_FM | g_uiI2CDevSelect | IC2_READ;
// Wait for Data to comeback
while(!(I2CSTATUS & 0x02));
l_uiDataRead = I2CRXTX;
// Stop the transaction
I2CCONFIG |= 0x02;
// Wait for I2C to be Idle, This will generate a STOP
while(!(I2CSTATUS & 0x08));
// Make sure we received an ACK and that there was no error during transfer
if (I2CSTATUS & 0xC0)
{
}
return l_uiDataRead;
return 0xFF;
return 0xFF;
return 0xFF;
return 0xFF;
FM6124ReadFRAM
Read 1 byte of Data in the F-RAM of the FM6124
ruint16 a_uiFramAddr
ruint8: Byte read
To Read a data on the I2C, we first need to "fake"
a write operation in order to send the memory address to the
slave module.
Page 44 of 53

Related parts for FM6124