This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I2CMDR register is not getting updated in the peripheral window of the debugger

I was creating a program to communicate with the compass module(HMC5883L) using I2C module using Tiva C LaunchPad (TM4C123GH6PM. When debugging, I found that, when a write value was issued to the I2CMDR register, the value did not update in the peripheral window of the debugger. I tried with alternate I2C modules in the uC and in overall, I found that when using I2C1 module, I2C1 peripheral window in debug session, does not display any value at all for I2C1 registers. While using rest of the I2C modules, I2CMDR value in the I2C peripheral window didn't update at all(Sadly, it remained the same 0x00!). I place my source rode here. Please anyone offer suggestions. It is little urgent...!

I2C2 initialisation code

void initializeI2C( uint16_t i2cspeed, uint8_t slaveAddress)
{


SYSCTL_RCGCI2C_R |= 0X4;        //Enable I2C clock
delay = SYSCTL_RCGCI2C_R;       //create delay for clock stabilisation

SYSCTL_RCGC2_R |= 0x00000010;     // activate clock for Port  A
delay = SYSCTL_RCGC2_R;         //create delay for clock stabilisation

GPIO_PORTE_LOCK_R = 0x4C4F434B;   // unlock GPIO Port A
GPIO_PORTE_CR_R = 0xFF;           // allow changes to PF7-0

GPIO_PORTE_AFSEL_R |= (1 << 4)|(1 << 5);//Alternate function assignment to respective pins

GPIO_PORTE_ODR_R |= (1 << 5) ;            //Make I2CSDA pin for open drain configuration

GPIO_PORTE_PCTL_R |= 0x00330000;  //Set corresponding PMCx reg. for I2C2 peripheral

I2C2_MCR_R |= 0 << MFE | 0 << SFE;  //Initialise I2C as master

I2C2_MTPR_R |= ((16000/(20*i2cspeed)) - 1) << 0 | 0 << 7; //set the desired clock speed for SCL

I2C2_MSA_R = (slaveAddress << 1); //Specify the slave address for the operation

}

Here is the main code for writing to the I2CMDR register (I2C2 peripheral)

int main(void)
{

        initializeI2C3(100, 0x1E);

        I2C2_MDR_R = 0x25;

}

The code compiled without any errors and I ran through every code in the debugger, there was no problem at all, except this one.

Parents
  • Has anyone figured this issue out? I am using TivaWare on a TM4C129 and if i step through (I realize the bus won't actually work due to timing issues with this approach) i never see updates to either the MDR or the MCLKOCNT registers. I checked the memory map against the macro expansion and the register address looks right and the data is present within the API function but it just never updates the register. 

Reply
  • Has anyone figured this issue out? I am using TivaWare on a TM4C129 and if i step through (I realize the bus won't actually work due to timing issues with this approach) i never see updates to either the MDR or the MCLKOCNT registers. I checked the memory map against the macro expansion and the register address looks right and the data is present within the API function but it just never updates the register. 

Children
No data