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.

Compiler/SM72442: I2C Communication and Read/Write Data Registers

Part Number: SM72442

Tool/software: TI C/C++ Compiler

Hi,

We are using SM72442 with STM32F105 micro controller to control and use the MPPT tracking on board. We successfully configured the I2C communication. Indeed for reading and writing data, we are also able to access to the 56byte data registers0-5. However, the values of data registers that are read as 10 bits do not match the given values in the data sheet (the one revised in 2013). Furthermore, the values are also off from the measurements we did on couple of the pins. The data registers are created according to the tables as union of structs and i have added the text on the question also. I am wondering if the data register settings given on the data sheet are correct? I am asking this because the bit values that we have do not really make sense/match with what is given in data sheet or  what is expected to be. In the attached txt. file, you can see how the read function used for reading the data register0 through I2C. If the register information on data sheet is correct, then is there way to calibrate the readings?

Another point to add is, that while establishing the I2C communication, we have found that the I2C device addresses are given in wrong order. 0x1 should have been 1-0-0 for I2C0,I2C1,I2C2 respectively. We have the pull up resistor for I2C0 and if we have followed the I2C settings from data sheet (as 1-0-0 --> 0x4<<1), this would give I2C error, even when one bit is shifted. We wanted to raise this issue to your knowledge for further correspondence.

Could you have a look at the register settings, and the code i have attached to compare and if there is an updated/coreect settings, to send it to me? 

Thanks for your cooperation and help.

Best,

Faik

uint16_t command_register=0xE0;
typedef union {
	uint8_t byte[35];
	 struct{
		union{
			uint8_t reg0[7];
			struct{

				uint16_t ADC00:10;
				uint16_t ADC02:10;
				uint16_t ADC04:10;
				uint16_t ADC06:10;
				uint16_t rsvd:16;
			}s0;
		}u0;
		union{
			uint8_t reg1[7];
			struct{
				uint16_t Iin:10;
				uint16_t Vin:10;
				uint16_t Iout:10;
				uint16_t Vout:10;
				uint8_t mppt_ok:1;
				uint16_t RSVD:15;
			}s1;
		}u1;
		union{
			uint8_t reg3[7];
			struct{
				uint8_t Open_LoopOp:1;
				uint8_t clk_oe_manual:1;
				uint8_t bb_reset:1;
				uint8_t pass_through_manual:1;
				uint8_t pass_through_sel:1;
				uint16_t dc_open:9;
				uint8_t tdon:3;
				uint8_t tdoff:3;
				uint16_t vout_max:10;
				uint16_t iout_max:10;
				uint8_t bb_in_ptmode_sel:2;
				uint8_t power_thr_sel:1;
				uint8_t RSVD:3;
				uint8_t overide_adcprog:1;
				uint16_t RSVD2:9;
			}s3;
		}u3;
		union{
			uint8_t reg4[7];
			struct{
				uint8_t Iin_offset:8;
				uint8_t Vin_offset:8;
				uint8_t Iout_offset:8;
				uint8_t Vout_offset:8;
				uint32_t RSVD:24;
			}s4;
		}u4;
		union{
			uint8_t reg5[7];
			struct{
				uint16_t Iout_lo_th:10;
				uint16_t Iout_hi_th:10;
				uint16_t Iin_lo_th:10;
				uint16_t Iin_hi_th:10;
				uint16_t RSVD:16;
			}s5;
		}u5;
	}s;
}SM72442_t;
SM72442_t read_data;
SM72442_t write_mpptdata;


//
+result=HAL_I2C_Mem_Read(&hi2c2,(0x1<<1),command_register,1,read_data.s.u0.reg0,7,1000);
if(result){
	Send_DebugMsg("I2C Read Error:",result);
}else{
	uint16_t Adc0=read_data.s.u0.s0.ADC00;
	uint16_t Adc2=read_data.s.u0.s0.ADC02;
	uint16_t Adc4=read_data.s.u0.s0.ADC04;
	uint16_t Adc6=read_data.s.u0.s0.ADC06;
	Send_DebugMsg("MPPT ADC0 Max Vout:",Adc0);
	Send_DebugMsg("MPPT ADC2 Mode:",Adc2);
	Send_DebugMsg("MPPT ADC4 Max Iout :",Adc4);
	Send_DebugMsg("Mppt Slew Rate Time constant:",Adc6);