Please use Edge Impulse to train TensorFlow models. They have the complete tool chain setup to make this easy.
TF lite micro doesn’t support everything desktop tf lite supports. If you look at the code in that file you may be able to determine what layer is wrong.
I have found the solution, actually, if we use the code which I posted earlier, it only quantized the weights and not the input/activation tensors.
The following code can be used to fully quantize the model, but it requires representative database more details here: קוונטיזציה לאחר אימון | TensorFlow Lite
I added also the network created by stm32cubeai to the firmware. But now, there are sometimes nan, none and unreadable values in the output of network. Did you have the same problem, too?