2024-10-06 09:10 PM
Hi,
I am using sprintf to format data before sending it over a UART.
STM Cube IDE 1.16.1
STM32F103
The code works in one project but not in another. I have ticked "Use float with printf in MCU/MPU Settings"
int size = sprintf(&Buffer,"{\"src_addr\":\"%s\",\"PDOP\":%5.2lf,\"HDOP\":%5.2lf,\"VDOP\":%.2lf,\"Volts\":%.2f}\n",
"2", pdop, hdop, vdop,Volts);
for some reason the code end up in syscall.c
void _exit (int status)
{
_kill(status, -1);
while (1) {} /* Make sure we hang here */
}
Solved! Go to Solution.
2024-10-09 05:41 PM
I have rebuilt the project from scratch, must be something in the setup that caused an issue, perhaps I somehow put the buffer in an area that was not RAM.
Either way the code above does work correctly.
2024-10-07 01:29 AM
Hello,
@Jorgie wrote:
The code works in one project but not in another. I have ticked "Use float with printf in MCU/MPU Settings"
This occurs only when you print floats or whatever the type you print?
2024-10-07 02:37 AM - edited 2024-10-07 02:47 AM
I have managed to format with a string I will try with an integer tomorrow.
However, as mentioned this same line of code works correctly in a different project.
2024-10-09 05:41 PM
I have rebuilt the project from scratch, must be something in the setup that caused an issue, perhaps I somehow put the buffer in an area that was not RAM.
Either way the code above does work correctly.