ye
Joined: 11 May 2005 Posts: 57 Location: london
|
Desperately need help with 1-wire, or HDQ16 |
Posted: Thu Dec 15, 2005 5:52 am |
|
|
Hi all,
I am using 18f8722
There are 2 chips using 1-wire protocol in the system i am designing. One is DS2433 and the other is gas gauge BQ2060.
I have written a presence check code which works well with DS2433 but not on BQ2060.
The following one is my simple presence check code:
Code: |
void IsGasGaugePresent(void)
{
Bit_Clear(TrisE,5);
HDQ16 = 0;
delay_us(100);
// delay_ms(1);
Bit_Set(TrisE,5);
delay_us(5);
if(!HDQ16)
{
delay_us(500);
printf("\nLine failed to be pulled high\n");
while(1);
}
delay_us(60); //was 110uS, but now aim to sample at 70uS post reset pulse
present=(!HDQ16);
delay_us(300); // Allow time for the PRESENCE PULSE to go
if(present)
{
printf("\nFound the device after %d tries\n", k);
while(1);
}
} |
TI claims the 1-wire protocol on BQ2060 with a new name HDQ16. Since the same code works on one chip but not on another, my questions are:
1. is HDQ16 exactly following the timing of standard 1-wire protocol? If no, it could probably explain my case. However, it will be weird if the answer is no.
2. People may have realised I have a delay of 100us after HDQ16 = 0. It actually works and finds a logic-low pulse coming from HDQ16. However, it only found the gas gauge after being called 9 timers consecutively in a while(1) loop. Also the biggest point is, according to 1-wire protocol, the delay after 'HDQ16 = 0' is minimum 420us !
Can anybody help me with this strange timing?? |
|