Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading/Writing to EEPROM & CalDac's

i am using eCos (Embedded Configurable Operation System) running on a simple intel base computer
 and want to read the calibration constt from EEPROM for NI PCI-6071E card.
but this code always return "myvalue=255". which is not the required value. can any body help me..
 
 
cyg_uint8 thisbit;
cyg_uint16 writevalue;
int myindex;
cyg_uint8 myvalue = 0; 
writevalue=0x0BFC;//reading the NI-DAQ Board Code
//p_PCI_DIO96->io_address  is the Base Add 1.
// 0x4 - chip select - enable EEPROM communciation
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,0x00);
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,0x00);
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,0x04);
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,0x04);
 
for (myindex = 15; myindex >= 0; myindex--)
{
thisbit = ((writevalue >> myindex) & 0x01) * 0x02;
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,(0x04 + thisbit)); // set data bit
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,(0x04 + thisbit));
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,(0x04 + thisbit + 0x1)); // set data bit and clock
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,(0x04 + thisbit + 0x1));
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,0x04);
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,0x04);
}

// read back PROMOUT (D7-D0) 8-bit result.
for (myindex = 7; myindex >= 0; myindex--)
{
// read bit
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,0x04); // set clock low
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,0x04);
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,(0x04 + 0x1)); // set clock high
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,(0x04 + 0x1));
HAL_READ_UINT8(p_PCI_DIO96->io_address+0x01,thisbit); // read data bit
thisbit &= 0x1;
myvalue |= thisbit << myindex;
}
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,0x00); // set rom low
HAL_WRITE_UINT8(p_PCI_DIO96->io_address + 0x0D,0x00);
printf("my Value = %d\n", myvalue);
printf("Execution completed");
/////////////////////////////////////
0 Kudos
Message 1 of 4
(8,027 Views)

Hi arshad-

In order to read the NI-DAQ board code you should be looking at EEPROM offset 511; this means (by my calculation) that your writevalue should actually be 0x0BFF.  Are you able to read values from other locations successfully?

Thanks-

 

Tom W
National Instruments
0 Kudos
Message 2 of 4
(8,004 Views)
yes the address will be 0x0BFF.
i tried it with this address but same result .
infact i get 255 from all registers. mean same result from different address.
0 Kudos
Message 3 of 4
(7,995 Views)
Hi arshad-
 
I suspect that (despite the E Series RLP manual recommendation to write twice to each EEPROM access operation) your application is executing too quickly to allow the EEPROM to settle and respond correctly to your commands.  I would suggest that you instead add a short software delay between EEPROM access operations to lengthen the space between operations.  If your development system does not include a sleep() function you could just spin an empty loop for a msec or so to allow time for the operations to complete.
 
Thanks-

Message Edited by Tom W [DE] on 05-24-2007 10:10 AM

Tom W
National Instruments
0 Kudos
Message 4 of 4
(7,987 Views)