This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1290NCZAD: Using uDMA with I2C

Part Number: TM4C1290NCZAD

Team,

I'm working from the app note SPMA073 using example 'ektm4c129_i2c_master_udma_fifo'. The demo is based on communicating with a 24C256 external memory device. The issue I have is I'm trying to communicate with a 24C02. The main difference is that the 24C256 use a 2 byte internal addressing scheme and the 24C02 uses a single byte internal addressing scheme.

Please will you detail the steps to change the 'ektm4c129_i2c_master_udma_fifo' example from using a 2 byte address internal address (24C256) to a single byte address (24C02)? 

I have tried to do this myself but so far without success.

Thanks.

  • Hello Chris,

    I don't have a lot of familiarity with that example, but looking over it and what you described, then I would expect that you don't need the I2C_OP_TXADDR state anymore and could remove that.

    To do so, you'd want to go right into I2C_OP_FIFO like this, and then use the 8 bit addressing:

    	case I2C_OP_IDLE:
    		//
    		// Move from IDLE to Transmit Address State
    		//
    		g_ui8MasterPrevState = g_ui8MasterCurrState;
    		g_ui8MasterCurrState = I2C_OP_FIFO;
    
    		//
    		// Write the upper bits of the page to the Slave
    		//
    		I2CMasterSlaveAddrSet(I2C2_BASE, SLAVE_ADDRESS_EXT, false);
    		I2CMasterDataPut(I2C2_BASE, DataForSlaveAddressHere));
    		I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START);
    		break;
    
    

    That would be replacing all of this:

    	case I2C_OP_IDLE:
    		//
    		// Move from IDLE to Transmit Address State
    		//
    		g_ui8MasterPrevState = g_ui8MasterCurrState;
    		g_ui8MasterCurrState = I2C_OP_TXADDR;
    
    		//
    		// Write the upper bits of the page to the Slave
    		//
    		I2CMasterSlaveAddrSet(I2C2_BASE, SLAVE_ADDRESS_EXT, false);
    		I2CMasterDataPut(I2C2_BASE, (g_ui16SlaveWordAddress >> 8));
    		I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_START);
    		break;
    
    	case I2C_OP_TXADDR:
    		//
    		// Assign the current state to the previous state
    		//
    		g_ui8MasterPrevState = g_ui8MasterCurrState;
    
    		//
    		// If Address has been NAK'ed then go to stop state
    		// else go the FIFO Priming State
    		//
    		if(ui32I2CMasterInterruptStatus & I2C_MASTER_INT_NACK)
    		{
    			g_ui8MasterCurrState = I2C_OP_STOP;
    		}
    		else
    		{
    			g_ui8MasterCurrState = I2C_OP_FIFO;
    		}
    
    		//
    		// Write the lower bits of the page to the Slave if
    		// Address has been ACK-ed
    		//
    		I2CMasterDataPut(I2C2_BASE, (g_ui16SlaveWordAddress >> 0));
    		I2CMasterControl(I2C2_BASE, I2C_MASTER_CMD_BURST_SEND_CONT);
    		break;
    

    You may also need to remove I2C_OP_TXADDR from the I2C_MASTER_STATE.