Kspids,
Entonces las rutinas que tienes para comunicarte con el DS18B20 tiene mal los tiempos. POrque si dices que la subrutina HAL_Delay es en milisegundos, entonces tu función de ds18b20_init tiene los tiempos incorrectos:
uint8_t ds18b20_init (void)
{
gpio_set_output (); // set the pin as output
HAL_GPIO_WritePin (GPIOE, GPIO_PIN_8, 0); // pull the pin low
HAL_Delay(480); // delay according to datasheet [b]---> Desde que está mal porque deberían ser 480 microsegundos y no 480ms[/b]
gpio_set_input (); // set the pin as input
HAL_Delay(80); // delay according to datasheet[b] --->Este tiempo también está mal deberían ser 80 microsegundos y no 80ms[/b]
if (!(HAL_GPIO_ReadPin (GPIOE, GPIO_PIN_8))) // if the pin is low i.e the presence pulse is there
{
HAL_Delay(400); // wait for 400 us [b]---> Este de igual manera aunque tienes el comentario que son microsegundos no lo son[/b]
return 0;
}
else
{
HAL_Delay(400); [b]---> Deben ser microsegundos[/b]
return 1;
}
}
Basado en esto, entonces, en cualquier función que estás usando HAL_Delay para la comunicación con el sensor, esos tiempos estarían incorrectos ya que como mencionas la tueina es en ms y según el datasheet, los tiempos deben ser de microsegundos.
elreypic.