Skip to main content
watchaphong
Explorer II
March 3, 2024
Solved

Why uint8_t uint16_t shows negative when value more than 127 or 32767.

  • March 3, 2024
  • 5 replies
  • 3952 views

Hi Everyone
          I confuse about uint8_t or uint16_t on stm32cubeide. When going to debug mode the Live Expressions (tab bar) when I change format to decimal value it shows negative value if the value more than 127 for uint8_t and 32767 for uint16_t. It should be store value 0 to 255 or 0 to 65535 without sign. Is it correct?

Hex format

Hex Format.png

 

 

 

 

 

Dec format

Dec Format.png

Best regard
watchaphong

    Best answer by TDK

    The Live Expressions tab is buggy at best. Be happy that it's working at all.

    It is interpreting the value as an integer instead of an unsigned integer. This is strictly an IDE display bug.

    5 replies

    TDK
    TDKBest answer
    Super User
    March 3, 2024

    The Live Expressions tab is buggy at best. Be happy that it's working at all.

    It is interpreting the value as an integer instead of an unsigned integer. This is strictly an IDE display bug.

    "If you feel a post has answered your question, please click ""Accept as Solution""."
    STTwo-32
    Technical Moderator
    March 4, 2024

    Hello @watchaphong and welcome to the ST Community :smiling_face_with_smiling_eyes:.

    Thank you so much for reporting this. I've been able to reproduce the issue and I will report it to the concerned team for correction.

    An internal Ticket 175153 is created for the tracking of this bug.

    (PS: Ticket 175153 is an internal tracking number, not accessible by customers and usable for internal tracking).

    Thank you again for reporting.

    Best Regards.

    STTwo-32 

    sam
    Explorer
    August 5, 2024

    ...and 5 months later, the bug is still there!

    Senior III
    February 6, 2025

    We are in 2025 and we still have the issue... Crazy @STTwo-32 

    Senior III
    March 11, 2025