stm32: return error when failing to read