2025-02-28 11:43 AM
Hello, I am trying to wire STM32F103C8T6 with DS18B20 sensor and I realize that after some actions it stopped to work and no data through the UART sent:
Probably it's not big deal, but I have no idea why UART completelly blocked and sending no information.
Current version of this code based on the materials of:
https://deepbluembedded.com/stm32-1-wire-one-wire-protocol-ds18b20-code-example/
2025-02-28 12:28 PM
You'll have to debug it. Your output buffer isn't really big enough to hold the string and NUL termination.
Try something more like
int number = 123;
uint8_t numarray[8]; // make sure you have enough space
...
while(1)
{ // sprintf returns the string length
HAL_UART_Transmit(&huart1, numarray, sprintf(numarray, "%d\n", number), 1000);
}
2025-02-28 12:41 PM
I extended buffer size but unfortunately nothing changed...
Can be something wrong with configuration I applied?
2025-02-28 1:06 PM
No idea
Do you have actual hardware? Can you put a scope on the signals, and use a debugger?
Check the code that configures the pins.
Do you have a supervisor or trainer?
Do you have any other working example in this environment?