AnsweredAssumed Answered

I2C changes from 3.2 to 3.4

Question asked by Michael Urbaniak on Nov 30, 2009
Latest reply on Dec 1, 2009 by Petr MacHala

I have a project originally written with MQX version 3.2 that communicates to an I2C real time clock.

This worked as expected.

I have since upgraded to MQX 3.4 and that code no longer runs it just "hangs".


Should the I2C code be backwards compatible or do I need to re write for version 3.4?


As an example here is a short section that just set the RTC in 3.2


    /* Open the I2C controller */        
    rtc_file = fopen("i2c0:", (pointer)(I2C_DEVICE_MASTER_MODE));



    /* this is later on to set the clock */

    i2c_send_buffer[0] = I2C_RTC_ADDR<<1 | I2C_WRITE_OP;
    i2c_send_buffer[1] = I2C_RTC_CONTROL_STATUS_REGISTER1_ADDR & 0xff;
    i2c_send_buffer[2] = control1;    
    i2c_send_buffer[3] = control2;    
    i2c_send_buffer[4] = seconds_bcd; 
    i2c_send_buffer[5] = minutes_bcd; 
    i2c_send_buffer[6] = hours_bcd; 
    i2c_send_buffer[7] = days_bcd; 
    i2c_send_buffer[8] = weekdays_bcd;
    i2c_send_buffer[9] = months_bcd; 
    i2c_send_buffer[10] = years_bcd;
    i2c_send_buffer[11] = minute_alarm; 
    i2c_send_buffer[12] = hour_alarm;
    i2c_send_buffer[13] = day_alarm;
    i2c_send_buffer[14] = weekday_alarm;
    i2c_send_buffer[15] = clkout;
    i2c_send_buffer[16] = timer;

    /* Write to the RTC */
    result = write(rtc_file, i2c_send_buffer, 17);



Thanks in advance for your help.