We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
My ADuC7026 wont transmit more than the I2C address byte when trying to read from a 2416 EEPROM memory. The SCL and SDA looks sensible on the 'scope, but I don't know whether it's the hardware or the software. The code is based on the examples and looks like this:
uint8_t Byte_Read(const uint16_t EEPROM_Address) { uint16_t block; bool wait; uint8_t res = 0xffu; uint32_t reg; // Fish out the block address block = (EEPROM_Address & 0x0700 ) >> 7; // Fill FIFO with Destination Address low bits I2C1MTX = EEPROM_Address & 0x00ff ; // Set Address Write Command with merged block address I2C1ADR = SLAVE_ADDR_W | block; // What until Master is finished command do { reg = I2C1MSTA; // take a copy as some bits are cleared by a read wait = (bool)((reg & I2CMSTA_Busy_Mask ) == I2CMSTA_Busy_Mask); } while(wait); if(I2CMSTA_NoAck_Mask == (I2CMSTA_NoAck_Mask & reg)) { res = 0xfeu; } I2C1CNT = 0; // Read a Single 8 Bit Byte I2C1ADR = SLAVE_ADDR_R | block; // Transmit read Address setTickTimeout(TIdx_I2C, READ_TIMEOUT_MSEC); // start a timeout timer // Wait until Master recieve data, i.e. RXIrq set do { wait = (bool)((I2C1MSTA & I2CMSTA_RXIrq_Mask) == 0x0); wait = wait && !(tickers[TIdx_I2C].flag); // check the timeout timer } while(wait); if(I2C1MSTA & I2CMSTA_RXIrq_Mask) { res = I2C1MRX; // Read Data Read } return res; }
Trying to find a software bug when your problem is actually hardware is never going to be productive.