Hello! I have an HTRC110 and I cannot communicate my pic with it. I am using SPI interface so I make the start condition and then I configure the HTRC sending the appropiate values of config page. The problem is that it is always sending '1' in the output (SDO).
When I send for example get_config_page it sends '1'. The output (SDO) does not change any moment.
To configure the HTRC110 I send this code after the start condition:
//SET_CONFIG_PAGE page 3 (DISLP1=0, DISSMARTCOMP=0, FSEL=10[8MHz osc])
transmision_datos(0x72); //SET_CONFIG_PAGE_3()=01110010
Delay10KTCYx(20);
//SET_CONFIG_PAGE page 0 (GAIN=##, FILTERH=1, FILTERL=1)
transmision_datos(0x4F); //GET_CONFIG_PAGE_0()=01001111
Delay10KTCYx(20);
//SET_CONFIG_PAGE page 2 (THRESET=1, ACQAMP=1, FREEZE=11)
transmision_datos(0x6F); //GET_CONFIG_PAGE_2()=01101111
Delay10KTCYx(20);
//SET_CONFIG_PAGE page 1 (PD_MODE=0[active], PD=1[power down], HYSTERESIS=0[off], TXDIS=1[coil driver off])
transmision_datos(0x55); //GET_CONFIG_PAGE_0()=01010101
Delay10KTCYx(20);
After this, I send the process which is explained in the page 50 of the application note.
And finally, I send a command in order to received something, but I don't see anything with oscilloscope.
I hope some help.
Thank you very much!
David.
Yes, I don't know what is the problem... Because I have soldiered correctly, making sure to not burn it. So it is almost 100% of probabilities that is not the chip... therefore is the code. When I send the commands of config page, then I send the command of readphase, which I have to receive something, and I don't see anything. The TX of HTRC110 continues sending '1'...
If it is continuos sending '1' , i think htrc is working. Problem must be your code.
Check this library. Examine send and receive command .
I suggest you check your hardware. If you use a 3.3v mcu, do not forget to communicate with 5V.
Thank you for your answer. I have all with 5v... and I see it with the oscilloscope and it is correctly.. I don't know if the problem is in the order of the initialitzation of the HTRC110 or the time between the commands.
I am using this code for initialization . If your transmit function is correct, this code is run.
void HTRC110_Initialize(void){
/*-------------------Standart Configuration Installation-------------------*/
HTRC110_WriteandReadData(REG_PAGE0);
Delay_us(STATE_CHANGE_TIME);
HTRC110_WriteandReadData(REG_PAGE1);
Delay_us(STATE_CHANGE_TIME);
HTRC110_WriteandReadData(REG_PAGE2);
Delay_us(STATE_CHANGE_TIME);
HTRC110_WriteandReadData(REG_PAGE3);
Delay_us(STATE_CHANGE_TIME);
/*------------------------Sampling Time Calculation------------------------*/
uint16_t Temp;
HTRC110_Params.Phase = HTRC110_WriteandReadData(READ_PHASE);
Temp = HTRC110_Params.Phase << 1;
Temp = Temp + 0x3F;
HTRC110_Params.SamplingTime = (uint8_t)(Temp & 0x3F);
HTRC110_WriteandReadData(SET_SAMPLING_TIME | HTRC110_Params.SamplingTime );
HAL_Delay(2);
/*------------------------General Settling Sequence------------------------*/
HTRC110_WriteandReadData(SET_CONFIG_PAGE_2 | 0x0B);
HAL_Delay(4);
HTRC110_WriteandReadData(SET_CONFIG_PAGE_2 | 0x08);
HAL_Delay(1);
HTRC110_WriteandReadData(SET_CONFIG_PAGE_2 | 0x00);
}