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.

RTOS/SENSOR-CONTROLLER-STUDIO: Execution code : Too many concurrent register variables.

Part Number: SENSOR-CONTROLLER-STUDIO
Other Parts Discussed in Thread: CC1310

Tool/software: TI-RTOS

Hi,

I am try to right the code for magnetometer using sensor studio. as you know there are 3 axis, ie X, Y, and Z..

code snippet:

i2cStart();

i2cTx(MAG_ADDR | I2C_OP_WRITE);

i2cTx(MAG_DR_STATUS);

if (state.i2cStatus == 0x0000) {

i2cRepeatedStart();

i2cTx(MAG_ADDR | I2C_OP_READ);

i2cRxAck(mag_status);

i2cRxAck(mag_x_msb);

i2cRxNack(mag_x_lsb);

i2cTx(MAG_ADDR | I2C_OP_READ);

i2cRxAck(mag_y_msb);

i2cRxNack(mag_y_lsb);

i2cTx(MAG_ADDR | I2C_OP_READ);

i2cRxAck(mag_z_msb);

i2cRxNack(mag_z_lsb);

}

i2cStop();

output.MagXyzStatus = mag_status;

output.magOut[0] = (mag_x_msb <<8) | mag_x_lsb;

output.magOut[1] = (mag_y_msb <<8) | mag_y_lsb;

//output.magOut[2] = (mag_z_msb <<8) | mag_z_lsb;    <<<------- if UN-commented this line then i get above given error " Too many concurrent register variables.conflict involves: mag_y_lsb,mag_z_lsb,mag_z_msb, mag_x_lsb, mag_y_msb,mag_x_msb, mag_status"

 

// Schedule the next execution

fwScheduleTask(1);

please help to resolve this issue.

  • Hi Himanshu,

    Which device are you using?
  • Launchapd cc1310 and MAG3110 as magnetometer
  • And what type of variables are mag_status, mag_*_msb, and such?
  • Either way, I'm able to reproduce the error. You are essentially using to many variables at the same time. Simply reusing variables fixes the issue, something along the lines of this:

    U16 status = 0;
    U16 msb = 0;
    U16 lsb = 0;
    
    i2cStart();
    
    i2cTx(MAG_ADDR | I2C_OP_WRITE);
    i2cTx(MAG_DR_STATUS);
        
    if (state.i2cStatus == 0x0000) {
        i2cRepeatedStart();
        
        i2cTx(MAG_ADDR | I2C_OP_READ);
        i2cRxAck(status);
        i2cRxAck(msb);
        i2cRxNack(lsb);
        
        output.MagXyzStatus = status;
        output.magOut[0] = (msb << 8) | lsb;
        
        i2cTx(MAG_ADDR | I2C_OP_READ);
        i2cRxAck(msb);
        i2cRxNack(lsb);
        
        output.magOut[1] = (msb << 8) | lsb;
        
        i2cTx(MAG_ADDR | I2C_OP_READ);
        i2cRxAck(msb);
        i2cRxNack(lsb);
        
        output.magOut[2] = (msb << 8) | lsb;
    }
    
    i2cStop();
    
    fwScheduleTask(1);
    

  • U16 mag_status;
    U16 mag_x_msb;
    U16 mag_y_msb;
    U16 mag_z_msb;
    U16 mag_x_lsb;
    U16 mag_y_lsb;
    U16 mag_z_lsb;

    mag_x_msb = 0x00;
    mag_y_msb = 0x00;
    mag_z_msb = 0x00;
    mag_x_lsb = 0x00;
    mag_y_lsb = 0x00;
    mag_z_lsb = 0x00;
    mag_status = 0x00;
  • with above code snippet issue is fixed, but output of magnetometer is  get wronged.  i am getting only x axis value and status field also changed.

    please refer video for issue.

  • Himanshu,

    Please refer to the MAG3110 data sheet or appropriate NXP support forums for how to interface with the MAG3110 sensor.

    But, just with a quick glance, it looks like you are just reading from the same register.
  • Can you please tell me how to add more variable, or how can i access 32bit address using one variable in SCS. and what is max limit of variable that can be used in SCS.

    As i know i2c can  access 16bit at a time is there any way to access 32bit through i2c.

  • The maximum word size on the Sensor Controller is 16 bits. You can emulate 32 bit variables by storing the high and low word of the 32 bit value, which the main application can create a 32 bit value out of. E.g.

    // Data structure members, x, y and z are U16 arrays of length 2
    output
        x[2]  // [0] is lsb, [1] is msb
        y[2]
        z[2]
    
    // In you task code
    // Fetch lsb and msb
    i2cRxAck(msb);
    i2cRxNack(lsb);
    output.x[0] = lsb;
    output.x[1] = msb;
    // Etc. for all other axis

    There isn't a limit of maximum number of variables you can create and use in Sensor Controller. There is, however, a limit of maximum number of variables you can use concurrently.

  • Thanks for help this fixed the issue..