User Activity

Every period of time i send ~33bytes through USB CDC, if suddenly USB cable disconnected and reconnect i get 16 bytes of the last message loaded, and then continue to get new messages.How can i detect disconnection and were these 16 bytes located?
I am working with STM32CubeIDE on device STM32H743I am working with the flash and sometimes the data inside them being corrupted, showing ?.What may be the reason causing some of the memory to show ?.How can i identify that without getting hardfault?...
I am using bluenrg-2 device with the low energy BLE example BLE-CHAT.The device stop advertising after a few hours of advertising and connections and disconnections.I leave the device working and advertising for whole night and in the morning it stop...
I experience  many disconnection in BLE communication and would like to compare to the BLE chat example code