How to debug this I2C hard fault?
Note that the solution was in a completely different part than the question mentions.

The problem was, that I use EEPROM simulation, which means on an STM32 that part of the flash is overwritten.

By default page 15 is used (out of 31) which means like about less than half way of the 64 KB Flash it has.

Since my program is growing gradually, instead of formatting/writing to the 'EEPROM simulation' Flash space, it was overwriting my program.

I changed the page number to 30 and now the problem is solved (unless my program gets too big again).

I thought the simulation flash 'library' would use the next 'free' page but it does not.