I've never noticied that redmi k40 has A/B partitions, i've unlocked the phone and flashed the recovery phone with the latest aplha recovery and formatted data, anyway the internal memory wasn't writable, and i've picked up a USB-C pen and trasfered the rom inside it.I never used the "Factory reset" function in TWRP. I always used "Format Data" to do a clean installation/factory reset.
I'm flashing from the USB... Before i've tried to flash the stock rom with no positive result, because the flash via fastboot takes 0s, and the fastboot flash from twrp takes over 1200s going in timeout.
Finger crossed from me
Edit: All worked fine, but please help me to understood, if i don't have a usb-c pen how could i exit from that "dead-end"