Both sprintf and printk with uint32_t

I'm having trouble with both sprintf and printk when trying to print a variable of type uint32_t:

With the %d format, I often get negative numbers printed, depending on the value of the unsigned variable. Clearly, this is wrong.

With the %u format, I get huge random numbers printed that seem to be unrelated to the value of the variable.

What should be the correct format to use with uint32_t?

I'm using the Zephyr tool chain version 2.4.1

Parents Reply Children
No Data
Related