[Solved] sprintf re-entry into 64bit operation in 32 bit MCU with interrupts


sprintf will ony fail during an interrupt if it is called again during that interrupt (assuming it uses global variables that are re-used; would it use only stack variables, then it is re-entrant).

So if your interrupt handler is calling sprintf and during that call a new, same or higher priority interrupt occurs then it can fail. However, during the processing of an interrupt, interrupts are normally disabled so there can’t (shouldn’t!) be another interupt of the same type occurring.

But why convert this raw data during interrupt handling? Why not store/pass this data to the user-level routine via a buffer and have that functionality convert the raw data? That would be consistent with the idea that an interrupt handler should be as short (fast) as possible.

3

solved sprintf re-entry into 64bit operation in 32 bit MCU with interrupts